Skip to content

Commit

Permalink
Removing GeographicPosition and replaced with Position. Created prope…
Browse files Browse the repository at this point in the history
…rties in IPosition and used.
  • Loading branch information
Hunt Matt authored and Hunt Matt committed Apr 6, 2017
1 parent 3416c68 commit 81080d3
Show file tree
Hide file tree
Showing 24 changed files with 847 additions and 900 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void Has_Type_Property()
[Test]
public void Can_Serialize()
{
var collection = new Point(new GeographicPosition(1, 2, 3)) { CRS = new LinkedCRS(Href) };
var collection = new Point(new Position(1, 2, 3)) { CRS = new LinkedCRS(Href) };
var actualJson = JsonConvert.SerializeObject(collection);

JsonAssert.Contains("{\"properties\":{\"href\":\"http://localhost\"},\"type\":\"link\"}", actualJson);
Expand Down
93 changes: 48 additions & 45 deletions src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public class FeatureCollectionTests : TestBase
[Test]
public void Ctor_Throws_ArgumentNullException_When_Features_Is_Null()
{
Assert.Throws<ArgumentNullException>(() => { var collection = new FeatureCollection(null); });
Assert.Throws<ArgumentNullException>(() =>
{
var featureCollection = new FeatureCollection(null);
});
}

[Test]
Expand All @@ -39,8 +42,8 @@ public void FeatureCollectionSerialization()
{
var geom = new LineString(new[]
{
new GeographicPosition(51.010, -1.034),
new GeographicPosition(51.010, -0.034)
new Position(51.010, -1.034),
new Position(51.010, -0.034)
});

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

Assert.IsFalse(string.IsNullOrEmpty(actualJson));
}

private FeatureCollection GetFeatureCollection()
{
var model = new FeatureCollection();
for (var i = 10; i-- > 0;)
{
var geom = new LineString(new[]
{
new GeographicPosition(51.010, -1.034),
new GeographicPosition(51.010, -0.034)
});

var props = FeatureTests.GetPropertiesInRandomOrder();

var feature = new Net.Feature.Feature(geom, props);
model.Features.Add(feature);
}
return model;
}

private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right)
{
Assert.AreEqual(left, right);

Assert.IsTrue(left.Equals(right));
Assert.IsTrue(right.Equals(left));

Assert.IsTrue(left.Equals(left));
Assert.IsTrue(right.Equals(right));

Assert.IsTrue(left == right);
Assert.IsTrue(right == left);

Assert.IsFalse(left != right);
Assert.IsFalse(right != left);

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
}


[Test]
public void FeatureCollection_Equals_GetHashCode_Contract()
{
Expand Down Expand Up @@ -130,15 +95,15 @@ public void FeatureCollection_Test_IndexOf()

for (var i = 0; i < 10; i++)
{
var id = "id" + i.ToString();
var id = "id" + i;

expectedIds.Add(id);
expectedIndexes.Add(i);

var geom = new LineString(new[]
{
new GeographicPosition(51.010, -1.034),
new GeographicPosition(51.010, -0.034)
new Position(51.010, -1.034),
new Position(51.010, -0.034)
});

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

}


private FeatureCollection GetFeatureCollection()
{
var model = new FeatureCollection();
for (var i = 10; i-- > 0;)
{
var geom = new LineString(new[]
{
new Position(51.010, -1.034),
new Position(51.010, -0.034)
});

var props = FeatureTests.GetPropertiesInRandomOrder();

var feature = new Net.Feature.Feature(geom, props);
model.Features.Add(feature);
}
return model;
}

private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right)
{
Assert.AreEqual(left, right);

Assert.IsTrue(left.Equals(right));
Assert.IsTrue(right.Equals(left));

Assert.IsTrue(left.Equals(left));
Assert.IsTrue(right.Equals(right));

Assert.IsTrue(left == right);
Assert.IsTrue(right == left);

Assert.IsFalse(left != right);
Assert.IsFalse(right != left);

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
}
}
}
Loading

0 comments on commit 81080d3

Please sign in to comment.