Skip to content

Commit d873327

Browse files
authored
Merge pull request #180 from janusw/update_frameworks_and_pkgs
2 parents 7f46cdd + b9fee67 commit d873327

19 files changed

+282
-284
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ jobs:
1919
- name: Setup .NET Core
2020
uses: actions/setup-dotnet@v4
2121
with:
22-
dotnet-version: |
23-
3.1.x
24-
5.0.x
22+
dotnet-version: '8.0.x'
2523
- name: Install dependencies
2624
run: dotnet restore src/GeoJSON.Net.sln
2725
- name: Build
@@ -38,9 +36,7 @@ jobs:
3836
- name: Setup .NET Core
3937
uses: actions/setup-dotnet@v4
4038
with:
41-
dotnet-version: |
42-
3.1.x
43-
5.0.x
39+
dotnet-version: '8.0.x'
4440
- name: Install dependencies
4541
run: dotnet restore src/GeoJSON.Net.sln
4642
- name: Build

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public void Can_Serialize_Does_Not_Output_Crs_Property()
1616

1717
var json = JsonConvert.SerializeObject(collection);
1818

19-
Assert.IsTrue(!json.Contains("\"crs\""));
19+
Assert.That(!json.Contains("\"crs\""));
2020
}
2121

2222
[Test]
@@ -26,7 +26,7 @@ public void Can_Deserialize_When_Json_Does_Not_Contain_Crs_Property()
2626

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

29-
Assert.IsNull(point.CRS);
29+
Assert.That(point.CRS, Is.Null);
3030
}
3131

3232
[Test]
@@ -36,8 +36,8 @@ public void Can_Deserialize_CRS_issue_89()
3636

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

39-
Assert.IsNotNull(point.CRS);
40-
Assert.AreEqual(CRSType.Name, point.CRS.Type);
39+
Assert.That(point.CRS, Is.Not.Null);
40+
Assert.That(point.CRS.Type, Is.EqualTo(CRSType.Name));
4141
}
4242

4343
[Test]
@@ -49,8 +49,8 @@ public void Can_Serialize_CRS_issue_89()
4949

5050
var json = JsonConvert.SerializeObject(point);
5151

52-
Assert.IsNotNull(json);
53-
Assert.AreEqual(expected, json);
52+
Assert.That(json, Is.Not.Null);
53+
Assert.That(json, Is.EqualTo(expected));
5454
}
5555

5656
[Test]
@@ -62,8 +62,8 @@ public void Can_Serialize_DefaultCRS_issue_89()
6262

6363
var json = JsonConvert.SerializeObject(point);
6464

65-
Assert.IsNotNull(json);
66-
Assert.AreEqual(expected, json);
65+
Assert.That(json, Is.Not.Null);
66+
Assert.That(json, Is.EqualTo(expected));
6767
}
6868
}
6969
}

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ public class LinkedCRSTests : TestBase
1515
public void Has_Correct_Type()
1616
{
1717
var crs = new LinkedCRS(Href);
18-
Assert.AreEqual(CRSType.Link, crs.Type);
18+
Assert.That(crs.Type, Is.EqualTo(CRSType.Link));
1919
}
2020

2121
[Test]
2222
public void Has_Href_Property_With_Href()
2323
{
2424
var crs = new LinkedCRS(Href);
2525

26-
Assert.IsTrue(crs.Properties.ContainsKey("href"));
27-
Assert.AreEqual(Href, crs.Properties["href"]);
26+
Assert.That(crs.Properties.ContainsKey("href"));
27+
Assert.That(crs.Properties["href"], Is.EqualTo(Href));
2828
}
2929

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

36-
Assert.IsTrue(crs.Properties.ContainsKey("type"));
37-
Assert.AreEqual(type, crs.Properties["type"]);
36+
Assert.That(crs.Properties.ContainsKey("type"));
37+
Assert.That(crs.Properties["type"], Is.EqualTo(type));
3838
}
3939

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

56-
Assert.IsNotNull(linkCRS);
57-
Assert.AreEqual(CRSType.Link, linkCRS.Type);
58-
Assert.AreEqual(Href, linkCRS.Properties["href"]);
56+
Assert.That(linkCRS, Is.Not.Null);
57+
Assert.That(linkCRS.Type, Is.EqualTo(CRSType.Link));
58+
Assert.That(linkCRS.Properties["href"], Is.EqualTo(Href));
5959
}
6060

6161
[Test]
@@ -85,7 +85,7 @@ public void Ctor_Throws_ArgumentExpection_When_Href_Is_Not_Dereferencable_Uri()
8585
#endif
8686

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

9191
[Test]
@@ -106,30 +106,30 @@ public void Equals_GetHashCode_Contract()
106106
var left = new LinkedCRS(Href);
107107
var right = new LinkedCRS(Href);
108108

109-
Assert.AreEqual(left, right);
109+
Assert.That(right, Is.EqualTo(left));
110110

111-
Assert.IsTrue(left == right);
112-
Assert.IsTrue(right == left);
111+
Assert.That(left == right);
112+
Assert.That(right == left);
113113

114-
Assert.IsTrue(left.Equals(right));
115-
Assert.IsTrue(right.Equals(left));
114+
Assert.That(left.Equals(right));
115+
Assert.That(right.Equals(left));
116116

117-
Assert.IsTrue(left.Equals(left));
118-
Assert.IsTrue(right.Equals(right));
117+
Assert.That(left.Equals(left));
118+
Assert.That(right.Equals(right));
119119

120-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
120+
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
121121

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

124-
Assert.AreNotEqual(left, right);
124+
Assert.That(right, Is.Not.EqualTo(left));
125125

126-
Assert.IsFalse(left == right);
127-
Assert.IsFalse(right == left);
126+
Assert.That(left == right, Is.False);
127+
Assert.That(right == left, Is.False);
128128

129-
Assert.IsFalse(left.Equals(right));
130-
Assert.IsFalse(right.Equals(left));
129+
Assert.That(left.Equals(right), Is.False);
130+
Assert.That(right.Equals(left), Is.False);
131131

132-
Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
132+
Assert.That(right.GetHashCode(), Is.Not.EqualTo(left.GetHashCode()));
133133
}
134134
}
135135
}

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

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void Has_Correct_Type()
1515
var name = "EPSG:31370";
1616
var crs = new NamedCRS(name);
1717

18-
Assert.AreEqual(CRSType.Name, crs.Type);
18+
Assert.That(crs.Type, Is.EqualTo(CRSType.Name));
1919
}
2020

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

27-
Assert.IsTrue(crs.Properties.ContainsKey("name"));
28-
Assert.AreEqual(name, crs.Properties["name"]);
27+
Assert.That(crs.Properties.ContainsKey("name"));
28+
Assert.That(crs.Properties["name"], Is.EqualTo(name));
2929
}
3030

3131
[Test]
@@ -57,31 +57,31 @@ public void Equals_GetHashCode_Contract()
5757
var left = new NamedCRS(name);
5858
var right = new NamedCRS(name);
5959

60-
Assert.AreEqual(left, right);
60+
Assert.That(right, Is.EqualTo(left));
6161

62-
Assert.IsTrue(left == right);
63-
Assert.IsTrue(right == left);
62+
Assert.That(left == right);
63+
Assert.That(right == left);
6464

65-
Assert.IsTrue(left.Equals(right));
66-
Assert.IsTrue(right.Equals(left));
65+
Assert.That(left.Equals(right));
66+
Assert.That(right.Equals(left));
6767

68-
Assert.IsTrue(left.Equals(left));
69-
Assert.IsTrue(right.Equals(right));
68+
Assert.That(left.Equals(left));
69+
Assert.That(right.Equals(right));
7070

71-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
71+
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
7272

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

76-
Assert.AreNotEqual(left, right);
76+
Assert.That(right, Is.Not.EqualTo(left));
7777

78-
Assert.IsFalse(left == right);
79-
Assert.IsFalse(right == left);
78+
Assert.That(left == right, Is.False);
79+
Assert.That(right == left, Is.False);
8080

81-
Assert.IsFalse(left.Equals(right));
82-
Assert.IsFalse(right.Equals(left));
81+
Assert.That(left.Equals(right), Is.False);
82+
Assert.That(right.Equals(left), Is.False);
8383

84-
Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
84+
Assert.That(right.GetHashCode(), Is.Not.EqualTo(left.GetHashCode()));
8585
}
8686
}
8787
}

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void Has_Correct_Type()
1313
{
1414
var crs = new UnspecifiedCRS();
1515

16-
Assert.AreEqual(CRSType.Unspecified, crs.Type);
16+
Assert.That(crs.Type, Is.EqualTo(CRSType.Unspecified));
1717
}
1818

1919
[Test]
@@ -22,7 +22,7 @@ public void Can_Serialize_To_Null()
2222
var collection = new FeatureCollection { CRS = new UnspecifiedCRS() };
2323
var expectedJson = "{\"type\":\"FeatureCollection\",\"crs\":null,\"features\":[] }";
2424
var actualJson = JsonConvert.SerializeObject(collection);
25-
25+
2626
JsonAssert.AreEqual(expectedJson, actualJson);
2727
}
2828

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

35-
Assert.IsInstanceOf<UnspecifiedCRS>(featureCollection.CRS);
35+
Assert.That(featureCollection.CRS, Is.InstanceOf<UnspecifiedCRS>());
3636
}
3737

3838
[Test]
@@ -41,18 +41,18 @@ public void Equals_GetHashCode_Contract()
4141
var left = new UnspecifiedCRS();
4242
var right = new UnspecifiedCRS();
4343

44-
Assert.AreEqual(left, right);
44+
Assert.That(right, Is.EqualTo(left));
4545

46-
Assert.IsTrue(left == right);
47-
Assert.IsTrue(right == left);
46+
Assert.That(left == right);
47+
Assert.That(right == left);
4848

49-
Assert.IsTrue(left.Equals(right));
50-
Assert.IsTrue(right.Equals(left));
49+
Assert.That(left.Equals(right));
50+
Assert.That(right.Equals(left));
5151

52-
Assert.IsTrue(left.Equals(left));
53-
Assert.IsTrue(right.Equals(right));
52+
Assert.That(left.Equals(left));
53+
Assert.That(right.Equals(right));
5454

55-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
55+
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
5656
}
5757
}
5858
}

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

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ public void Can_Deserialize()
2727

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

30-
Assert.IsNotNull(featureCollection);
31-
Assert.IsNotNull(featureCollection.Features);
32-
Assert.AreEqual(featureCollection.Features.Count, 3);
33-
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Point), 1);
34-
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.MultiPolygon), 1);
35-
Assert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Polygon), 1);
30+
Assert.That(featureCollection, Is.Not.Null);
31+
Assert.That(featureCollection.Features, Is.Not.Null);
32+
Assert.That(featureCollection.Features.Count, Is.EqualTo(3));
33+
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Point), Is.EqualTo(1));
34+
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.MultiPolygon), Is.EqualTo(1));
35+
Assert.That(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Polygon), Is.EqualTo(1));
3636
}
3737

3838
[Test]
@@ -42,11 +42,11 @@ public void Can_DeserializeGeneric()
4242

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

45-
Assert.IsNotNull(featureCollection);
46-
Assert.IsNotNull(featureCollection.Features);
47-
Assert.AreEqual(featureCollection.Features.Count, 3);
48-
Assert.AreEqual("DD", featureCollection.Features.First().Properties.Name);
49-
Assert.AreEqual(123, featureCollection.Features.First().Properties.Size);
45+
Assert.That(featureCollection, Is.Not.Null);
46+
Assert.That(featureCollection.Features, Is.Not.Null);
47+
Assert.That(featureCollection.Features.Count, Is.EqualTo(3));
48+
Assert.That(featureCollection.Features.First().Properties.Name, Is.EqualTo("DD"));
49+
Assert.That(featureCollection.Features.First().Properties.Size, Is.EqualTo(123));
5050
}
5151

5252

@@ -75,9 +75,9 @@ public void FeatureCollectionSerialization()
7575

7676
var actualJson = JsonConvert.SerializeObject(model);
7777

78-
Assert.IsNotNull(actualJson);
78+
Assert.That(actualJson, Is.Not.Null);
7979

80-
Assert.IsFalse(string.IsNullOrEmpty(actualJson));
80+
Assert.That(string.IsNullOrEmpty(actualJson), Is.False);
8181
}
8282

8383
[Test]
@@ -138,8 +138,8 @@ public void FeatureCollection_Test_IndexOf()
138138
var expectedId = expectedIds[i];
139139
var expectedIndex = expectedIndexes[i];
140140

141-
Assert.AreEqual(expectedId, actualId);
142-
Assert.AreEqual(expectedIndex, actualIndex);
141+
Assert.That(actualId, Is.EqualTo(expectedId));
142+
Assert.That(actualIndex, Is.EqualTo(expectedIndex));
143143

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

172172
private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right)
173173
{
174-
Assert.AreEqual(left, right);
174+
Assert.That(right, Is.EqualTo(left));
175175

176-
Assert.IsTrue(left.Equals(right));
177-
Assert.IsTrue(right.Equals(left));
176+
Assert.That(left.Equals(right));
177+
Assert.That(right.Equals(left));
178178

179-
Assert.IsTrue(left.Equals(left));
180-
Assert.IsTrue(right.Equals(right));
179+
Assert.That(left.Equals(left));
180+
Assert.That(right.Equals(right));
181181

182-
Assert.IsTrue(left == right);
183-
Assert.IsTrue(right == left);
182+
Assert.That(left == right);
183+
Assert.That(right == left);
184184

185-
Assert.IsFalse(left != right);
186-
Assert.IsFalse(right != left);
185+
Assert.That(left != right, Is.False);
186+
Assert.That(right != left, Is.False);
187187

188-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
188+
Assert.That(right.GetHashCode(), Is.EqualTo(left.GetHashCode()));
189189
}
190190
}
191191

0 commit comments

Comments
 (0)