Skip to content

Commit 81080d3

Browse files
Hunt MattHunt Matt
authored andcommitted
Removing GeographicPosition and replaced with Position. Created properties in IPosition and used.
1 parent 3416c68 commit 81080d3

24 files changed

Lines changed: 847 additions & 900 deletions

src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public void Has_Type_Property()
4040
[Test]
4141
public void Can_Serialize()
4242
{
43-
var collection = new Point(new GeographicPosition(1, 2, 3)) { CRS = new LinkedCRS(Href) };
43+
var collection = new Point(new Position(1, 2, 3)) { CRS = new LinkedCRS(Href) };
4444
var actualJson = JsonConvert.SerializeObject(collection);
4545

4646
JsonAssert.Contains("{\"properties\":{\"href\":\"http://localhost\"},\"type\":\"link\"}", actualJson);

src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ public class FeatureCollectionTests : TestBase
1414
[Test]
1515
public void Ctor_Throws_ArgumentNullException_When_Features_Is_Null()
1616
{
17-
Assert.Throws<ArgumentNullException>(() => { var collection = new FeatureCollection(null); });
17+
Assert.Throws<ArgumentNullException>(() =>
18+
{
19+
var featureCollection = new FeatureCollection(null);
20+
});
1821
}
1922

2023
[Test]
@@ -39,8 +42,8 @@ public void FeatureCollectionSerialization()
3942
{
4043
var geom = new LineString(new[]
4144
{
42-
new GeographicPosition(51.010, -1.034),
43-
new GeographicPosition(51.010, -0.034)
45+
new Position(51.010, -1.034),
46+
new Position(51.010, -0.034)
4447
});
4548

4649
var props = new Dictionary<string, object>
@@ -59,45 +62,7 @@ public void FeatureCollectionSerialization()
5962

6063
Assert.IsFalse(string.IsNullOrEmpty(actualJson));
6164
}
62-
63-
private FeatureCollection GetFeatureCollection()
64-
{
65-
var model = new FeatureCollection();
66-
for (var i = 10; i-- > 0;)
67-
{
68-
var geom = new LineString(new[]
69-
{
70-
new GeographicPosition(51.010, -1.034),
71-
new GeographicPosition(51.010, -0.034)
72-
});
73-
74-
var props = FeatureTests.GetPropertiesInRandomOrder();
75-
76-
var feature = new Net.Feature.Feature(geom, props);
77-
model.Features.Add(feature);
78-
}
79-
return model;
80-
}
81-
82-
private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right)
83-
{
84-
Assert.AreEqual(left, right);
85-
86-
Assert.IsTrue(left.Equals(right));
87-
Assert.IsTrue(right.Equals(left));
88-
89-
Assert.IsTrue(left.Equals(left));
90-
Assert.IsTrue(right.Equals(right));
91-
92-
Assert.IsTrue(left == right);
93-
Assert.IsTrue(right == left);
94-
95-
Assert.IsFalse(left != right);
96-
Assert.IsFalse(right != left);
97-
98-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
99-
}
100-
65+
10166
[Test]
10267
public void FeatureCollection_Equals_GetHashCode_Contract()
10368
{
@@ -130,15 +95,15 @@ public void FeatureCollection_Test_IndexOf()
13095

13196
for (var i = 0; i < 10; i++)
13297
{
133-
var id = "id" + i.ToString();
98+
var id = "id" + i;
13499

135100
expectedIds.Add(id);
136101
expectedIndexes.Add(i);
137102

138103
var geom = new LineString(new[]
139104
{
140-
new GeographicPosition(51.010, -1.034),
141-
new GeographicPosition(51.010, -0.034)
105+
new Position(51.010, -1.034),
106+
new Position(51.010, -0.034)
142107
});
143108

144109
var props = FeatureTests.GetPropertiesInRandomOrder();
@@ -167,5 +132,43 @@ public void FeatureCollection_Test_IndexOf()
167132

168133
}
169134

135+
136+
private FeatureCollection GetFeatureCollection()
137+
{
138+
var model = new FeatureCollection();
139+
for (var i = 10; i-- > 0;)
140+
{
141+
var geom = new LineString(new[]
142+
{
143+
new Position(51.010, -1.034),
144+
new Position(51.010, -0.034)
145+
});
146+
147+
var props = FeatureTests.GetPropertiesInRandomOrder();
148+
149+
var feature = new Net.Feature.Feature(geom, props);
150+
model.Features.Add(feature);
151+
}
152+
return model;
153+
}
154+
155+
private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right)
156+
{
157+
Assert.AreEqual(left, right);
158+
159+
Assert.IsTrue(left.Equals(right));
160+
Assert.IsTrue(right.Equals(left));
161+
162+
Assert.IsTrue(left.Equals(left));
163+
Assert.IsTrue(right.Equals(right));
164+
165+
Assert.IsTrue(left == right);
166+
Assert.IsTrue(right == left);
167+
168+
Assert.IsFalse(left != right);
169+
Assert.IsFalse(right != left);
170+
171+
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
172+
}
170173
}
171174
}

0 commit comments

Comments
 (0)