Skip to content

Commit

Permalink
Merge pull request #180 from janusw/update_frameworks_and_pkgs
Browse files Browse the repository at this point in the history
  • Loading branch information
xfischer authored Jul 9, 2024
2 parents 7f46cdd + b9fee67 commit d873327
Show file tree
Hide file tree
Showing 19 changed files with 282 additions and 284 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore src/GeoJSON.Net.sln
- name: Build
Expand All @@ -38,9 +36,7 @@ jobs:
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
3.1.x
5.0.x
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore src/GeoJSON.Net.sln
- name: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public void Can_Serialize_Does_Not_Output_Crs_Property()

var json = JsonConvert.SerializeObject(collection);

Assert.IsTrue(!json.Contains("\"crs\""));
Assert.That(!json.Contains("\"crs\""));
}

[Test]
Expand All @@ -26,7 +26,7 @@ public void Can_Deserialize_When_Json_Does_Not_Contain_Crs_Property()

var point = JsonConvert.DeserializeObject<Point>(json);

Assert.IsNull(point.CRS);
Assert.That(point.CRS, Is.Null);
}

[Test]
Expand All @@ -36,8 +36,8 @@ public void Can_Deserialize_CRS_issue_89()

var point = JsonConvert.DeserializeObject<Point>(json);

Assert.IsNotNull(point.CRS);
Assert.AreEqual(CRSType.Name, point.CRS.Type);
Assert.That(point.CRS, Is.Not.Null);
Assert.That(point.CRS.Type, Is.EqualTo(CRSType.Name));
}

[Test]
Expand All @@ -49,8 +49,8 @@ public void Can_Serialize_CRS_issue_89()

var json = JsonConvert.SerializeObject(point);

Assert.IsNotNull(json);
Assert.AreEqual(expected, json);
Assert.That(json, Is.Not.Null);
Assert.That(json, Is.EqualTo(expected));
}

[Test]
Expand All @@ -62,8 +62,8 @@ public void Can_Serialize_DefaultCRS_issue_89()

var json = JsonConvert.SerializeObject(point);

Assert.IsNotNull(json);
Assert.AreEqual(expected, json);
Assert.That(json, Is.Not.Null);
Assert.That(json, Is.EqualTo(expected));
}
}
}
46 changes: 23 additions & 23 deletions src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ public class LinkedCRSTests : TestBase
public void Has_Correct_Type()
{
var crs = new LinkedCRS(Href);
Assert.AreEqual(CRSType.Link, crs.Type);
Assert.That(crs.Type, Is.EqualTo(CRSType.Link));
}

[Test]
public void Has_Href_Property_With_Href()
{
var crs = new LinkedCRS(Href);

Assert.IsTrue(crs.Properties.ContainsKey("href"));
Assert.AreEqual(Href, crs.Properties["href"]);
Assert.That(crs.Properties.ContainsKey("href"));
Assert.That(crs.Properties["href"], Is.EqualTo(Href));
}

[Test]
Expand All @@ -33,8 +33,8 @@ public void Has_Type_Property()
const string type = "ogcwkt";
var crs = new LinkedCRS(Href, type);

Assert.IsTrue(crs.Properties.ContainsKey("type"));
Assert.AreEqual(type, crs.Properties["type"]);
Assert.That(crs.Properties.ContainsKey("type"));
Assert.That(crs.Properties["type"], Is.EqualTo(type));
}

[Test]
Expand All @@ -53,9 +53,9 @@ public void Can_Deserialize_CRS_issue_101()
var pointWithCRS = JsonConvert.DeserializeObject<Point>(pointJson);
var linkCRS = pointWithCRS.CRS as LinkedCRS;

Assert.IsNotNull(linkCRS);
Assert.AreEqual(CRSType.Link, linkCRS.Type);
Assert.AreEqual(Href, linkCRS.Properties["href"]);
Assert.That(linkCRS, Is.Not.Null);
Assert.That(linkCRS.Type, Is.EqualTo(CRSType.Link));
Assert.That(linkCRS.Properties["href"], Is.EqualTo(Href));
}

[Test]
Expand Down Expand Up @@ -85,7 +85,7 @@ public void Ctor_Throws_ArgumentExpection_When_Href_Is_Not_Dereferencable_Uri()
#endif

var argumentExpection = Assert.Throws<ArgumentException>(() => { var crs = new LinkedCRS("http://not-a-valid-<>-url"); });
Assert.AreEqual(expected, argumentExpection.Message);
Assert.That(argumentExpection.Message, Is.EqualTo(expected));
}

[Test]
Expand All @@ -106,30 +106,30 @@ public void Equals_GetHashCode_Contract()
var left = new LinkedCRS(Href);
var right = new LinkedCRS(Href);

Assert.AreEqual(left, right);
Assert.That(right, Is.EqualTo(left));

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

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

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

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));

right = new LinkedCRS(Href + "?query=null");

Assert.AreNotEqual(left, right);
Assert.That(right, Is.Not.EqualTo(left));

Assert.IsFalse(left == right);
Assert.IsFalse(right == left);
Assert.That(left == right, Is.False);
Assert.That(right == left, Is.False);

Assert.IsFalse(left.Equals(right));
Assert.IsFalse(right.Equals(left));
Assert.That(left.Equals(right), Is.False);
Assert.That(right.Equals(left), Is.False);

Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.Not.EqualTo(left.GetHashCode()));
}
}
}
34 changes: 17 additions & 17 deletions src/GeoJSON.Net.Tests/CoordinateReferenceSystem/NamedCrsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public void Has_Correct_Type()
var name = "EPSG:31370";
var crs = new NamedCRS(name);

Assert.AreEqual(CRSType.Name, crs.Type);
Assert.That(crs.Type, Is.EqualTo(CRSType.Name));
}

[Test]
Expand All @@ -24,8 +24,8 @@ public void Has_Name_Property_With_Name()
var name = "EPSG:31370";
var crs = new NamedCRS(name);

Assert.IsTrue(crs.Properties.ContainsKey("name"));
Assert.AreEqual(name, crs.Properties["name"]);
Assert.That(crs.Properties.ContainsKey("name"));
Assert.That(crs.Properties["name"], Is.EqualTo(name));
}

[Test]
Expand Down Expand Up @@ -57,31 +57,31 @@ public void Equals_GetHashCode_Contract()
var left = new NamedCRS(name);
var right = new NamedCRS(name);

Assert.AreEqual(left, right);
Assert.That(right, Is.EqualTo(left));

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

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

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

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));

name = "EPSG:25832";
right = new NamedCRS(name);

Assert.AreNotEqual(left, right);
Assert.That(right, Is.Not.EqualTo(left));

Assert.IsFalse(left == right);
Assert.IsFalse(right == left);
Assert.That(left == right, Is.False);
Assert.That(right == left, Is.False);

Assert.IsFalse(left.Equals(right));
Assert.IsFalse(right.Equals(left));
Assert.That(left.Equals(right), Is.False);
Assert.That(right.Equals(left), Is.False);

Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.Not.EqualTo(left.GetHashCode()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Has_Correct_Type()
{
var crs = new UnspecifiedCRS();

Assert.AreEqual(CRSType.Unspecified, crs.Type);
Assert.That(crs.Type, Is.EqualTo(CRSType.Unspecified));
}

[Test]
Expand All @@ -22,7 +22,7 @@ public void Can_Serialize_To_Null()
var collection = new FeatureCollection { CRS = new UnspecifiedCRS() };
var expectedJson = "{\"type\":\"FeatureCollection\",\"crs\":null,\"features\":[] }";
var actualJson = JsonConvert.SerializeObject(collection);

JsonAssert.AreEqual(expectedJson, actualJson);
}

Expand All @@ -32,7 +32,7 @@ public void Can_Deserialize_From_Null()
var json = "{\"type\":\"FeatureCollection\",\"crs\":null,\"features\":[] }";
var featureCollection = JsonConvert.DeserializeObject<FeatureCollection>(json);

Assert.IsInstanceOf<UnspecifiedCRS>(featureCollection.CRS);
Assert.That(featureCollection.CRS, Is.InstanceOf<UnspecifiedCRS>());
}

[Test]
Expand All @@ -41,18 +41,18 @@ public void Equals_GetHashCode_Contract()
var left = new UnspecifiedCRS();
var right = new UnspecifiedCRS();

Assert.AreEqual(left, right);
Assert.That(right, Is.EqualTo(left));

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

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

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

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
}
}
}
50 changes: 25 additions & 25 deletions src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ public void Can_Deserialize()

var featureCollection = JsonConvert.DeserializeObject<FeatureCollection>(json);

Assert.IsNotNull(featureCollection);
Assert.IsNotNull(featureCollection.Features);
Assert.AreEqual(featureCollection.Features.Count, 3);
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Point), 1);
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.MultiPolygon), 1);
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Polygon), 1);
Assert.That(featureCollection, Is.Not.Null);
Assert.That(featureCollection.Features, Is.Not.Null);
Assert.That(featureCollection.Features.Count, Is.EqualTo(3));
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Point), Is.EqualTo(1));
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.MultiPolygon), Is.EqualTo(1));
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Polygon), Is.EqualTo(1));
}

[Test]
Expand All @@ -42,11 +42,11 @@ public void Can_DeserializeGeneric()

var featureCollection = JsonConvert.DeserializeObject<FeatureCollection<FeatureCollectionTestPropertyObject>>(json);

Assert.IsNotNull(featureCollection);
Assert.IsNotNull(featureCollection.Features);
Assert.AreEqual(featureCollection.Features.Count, 3);
Assert.AreEqual("DD", featureCollection.Features.First().Properties.Name);
Assert.AreEqual(123, featureCollection.Features.First().Properties.Size);
Assert.That(featureCollection, Is.Not.Null);
Assert.That(featureCollection.Features, Is.Not.Null);
Assert.That(featureCollection.Features.Count, Is.EqualTo(3));
Assert.That(featureCollection.Features.First().Properties.Name, Is.EqualTo("DD"));
Assert.That(featureCollection.Features.First().Properties.Size, Is.EqualTo(123));
}


Expand Down Expand Up @@ -75,9 +75,9 @@ public void FeatureCollectionSerialization()

var actualJson = JsonConvert.SerializeObject(model);

Assert.IsNotNull(actualJson);
Assert.That(actualJson, Is.Not.Null);

Assert.IsFalse(string.IsNullOrEmpty(actualJson));
Assert.That(string.IsNullOrEmpty(actualJson), Is.False);
}

[Test]
Expand Down Expand Up @@ -138,8 +138,8 @@ public void FeatureCollection_Test_IndexOf()
var expectedId = expectedIds[i];
var expectedIndex = expectedIndexes[i];

Assert.AreEqual(expectedId, actualId);
Assert.AreEqual(expectedIndex, actualIndex);
Assert.That(actualId, Is.EqualTo(expectedId));
Assert.That(actualIndex, Is.EqualTo(expectedIndex));

Assert.Inconclusive("not supported. the Feature.Id is optional. " +
" create a new class that inherits from" +
Expand Down Expand Up @@ -171,21 +171,21 @@ private FeatureCollection GetFeatureCollection()

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

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

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

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

Assert.IsFalse(left != right);
Assert.IsFalse(right != left);
Assert.That(left != right, Is.False);
Assert.That(right != left, Is.False);

Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
}
}

Expand Down
Loading

0 comments on commit d873327

Please sign in to comment.