1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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);
}
}
}
|