diff options
author | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 13:02:25 -0700 |
---|---|---|
committer | Jason Smith <jason.smith@xamarin.com> | 2016-03-22 16:13:41 -0700 |
commit | 17fdde66d94155fc62a034fa6658995bef6fd6e5 (patch) | |
tree | b5e5073a2a7b15cdbe826faa5c763e270a505729 /Xamarin.Forms.Core.UnitTests/PinTests.cs | |
download | xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.gz xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.tar.bz2 xamarin-forms-17fdde66d94155fc62a034fa6658995bef6fd6e5.zip |
Initial import
Diffstat (limited to 'Xamarin.Forms.Core.UnitTests/PinTests.cs')
-rw-r--r-- | Xamarin.Forms.Core.UnitTests/PinTests.cs | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/Xamarin.Forms.Core.UnitTests/PinTests.cs b/Xamarin.Forms.Core.UnitTests/PinTests.cs new file mode 100644 index 00000000..6ee7af64 --- /dev/null +++ b/Xamarin.Forms.Core.UnitTests/PinTests.cs @@ -0,0 +1,105 @@ +using NUnit.Framework; +using Xamarin.Forms.Maps; + +namespace Xamarin.Forms.Core.UnitTests +{ + [TestFixture] + public class PinTests : BaseTestFixture + { + [Test] + public void Constructor () + { + Pin pin = new Pin { + Type = PinType.SavedPin, + Position = new Position (-92, 178), + Label = "My Desktop", + Address = "123 Hello World Street" + }; + + Assert.AreEqual (pin.Type, PinType.SavedPin); + Assert.AreEqual (pin.Position.Latitude, -90); + Assert.AreEqual (pin.Label, "My Desktop"); + Assert.AreEqual (pin.Address, "123 Hello World Street"); + } + + [Test] + public void Equals () + { + Pin pin1 = new Pin (); + Pin pin2 = new Pin (); + Pin pin3 = new Pin { + Type = PinType.Place, + Position = new Position (12, -24), + Label = "Test", + Address = "123 Test street" + }; + + Pin pin4 = new Pin { + Type = PinType.Place, + Position = new Position (12, -24), + Label = "Test", + Address = "123 Test street" + }; + + Assert.True (pin1.Equals (pin2)); + Assert.True (pin3.Equals (pin4)); + Assert.False (pin1.Equals (pin3)); + } + + [Test] + public void EqualsOp () { + var pin1 = new Pin { + Type = PinType.Place, + Position = new Position (12, -24), + Label = "Test", + Address = "123 Test street" + }; + + var pin2 = new Pin { + Type = PinType.Place, + Position = new Position (12, -24), + Label = "Test", + Address = "123 Test street" + }; + + Assert.True (pin1 == pin2); + } + + [Test] + public void InEqualsOp () { + var pin1 = new Pin { + Type = PinType.Place, + Position = new Position (11.9, -24), + Label = "Test", + Address = "123 Test street" + }; + + var pin2 = new Pin { + Type = PinType.Place, + Position = new Position (12, -24), + Label = "Test", + Address = "123 Test street" + }; + + Assert.True (pin1 != pin2); + } + + [Test] + public void Label () + { + var pin = new Pin { + Label = "OriginalLabel" + }; + + bool signaled = false; + pin.PropertyChanged += (sender, args) => { + if (args.PropertyName == "Label") + signaled = true; + }; + + pin.Label = "Should Signal"; + + Assert.True (signaled); + } + } +} |