Skip to content

Commit c384561

Browse files
committed
update NUnit to 4.1.0
* breaking changes in NUnit 4 require many mechnical replacements of "Assert." by "ClassicAssert."
1 parent d3582f7 commit c384561

17 files changed

+295
-280
lines changed

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using GeoJSON.Net.Geometry;
44
using Newtonsoft.Json;
55
using NUnit.Framework;
6+
using NUnit.Framework.Legacy;
67

78
namespace GeoJSON.Net.Tests.CoordinateReferenceSystem
89
{
@@ -16,7 +17,7 @@ public void Can_Serialize_Does_Not_Output_Crs_Property()
1617

1718
var json = JsonConvert.SerializeObject(collection);
1819

19-
Assert.IsTrue(!json.Contains("\"crs\""));
20+
ClassicAssert.IsTrue(!json.Contains("\"crs\""));
2021
}
2122

2223
[Test]
@@ -26,7 +27,7 @@ public void Can_Deserialize_When_Json_Does_Not_Contain_Crs_Property()
2627

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

29-
Assert.IsNull(point.CRS);
30+
ClassicAssert.IsNull(point.CRS);
3031
}
3132

3233
[Test]
@@ -36,8 +37,8 @@ public void Can_Deserialize_CRS_issue_89()
3637

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

39-
Assert.IsNotNull(point.CRS);
40-
Assert.AreEqual(CRSType.Name, point.CRS.Type);
40+
ClassicAssert.IsNotNull(point.CRS);
41+
ClassicAssert.AreEqual(CRSType.Name, point.CRS.Type);
4142
}
4243

4344
[Test]
@@ -49,8 +50,8 @@ public void Can_Serialize_CRS_issue_89()
4950

5051
var json = JsonConvert.SerializeObject(point);
5152

52-
Assert.IsNotNull(json);
53-
Assert.AreEqual(expected, json);
53+
ClassicAssert.IsNotNull(json);
54+
ClassicAssert.AreEqual(expected, json);
5455
}
5556

5657
[Test]
@@ -62,8 +63,8 @@ public void Can_Serialize_DefaultCRS_issue_89()
6263

6364
var json = JsonConvert.SerializeObject(point);
6465

65-
Assert.IsNotNull(json);
66-
Assert.AreEqual(expected, json);
66+
ClassicAssert.IsNotNull(json);
67+
ClassicAssert.AreEqual(expected, json);
6768
}
6869
}
6970
}

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

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using GeoJSON.Net.Geometry;
44
using Newtonsoft.Json;
55
using NUnit.Framework;
6+
using NUnit.Framework.Legacy;
67

78
namespace GeoJSON.Net.Tests.CoordinateReferenceSystem
89
{
@@ -15,16 +16,16 @@ public class LinkedCRSTests : TestBase
1516
public void Has_Correct_Type()
1617
{
1718
var crs = new LinkedCRS(Href);
18-
Assert.AreEqual(CRSType.Link, crs.Type);
19+
ClassicAssert.AreEqual(CRSType.Link, crs.Type);
1920
}
2021

2122
[Test]
2223
public void Has_Href_Property_With_Href()
2324
{
2425
var crs = new LinkedCRS(Href);
2526

26-
Assert.IsTrue(crs.Properties.ContainsKey("href"));
27-
Assert.AreEqual(Href, crs.Properties["href"]);
27+
ClassicAssert.IsTrue(crs.Properties.ContainsKey("href"));
28+
ClassicAssert.AreEqual(Href, crs.Properties["href"]);
2829
}
2930

3031
[Test]
@@ -33,8 +34,8 @@ public void Has_Type_Property()
3334
const string type = "ogcwkt";
3435
var crs = new LinkedCRS(Href, type);
3536

36-
Assert.IsTrue(crs.Properties.ContainsKey("type"));
37-
Assert.AreEqual(type, crs.Properties["type"]);
37+
ClassicAssert.IsTrue(crs.Properties.ContainsKey("type"));
38+
ClassicAssert.AreEqual(type, crs.Properties["type"]);
3839
}
3940

4041
[Test]
@@ -53,21 +54,21 @@ public void Can_Deserialize_CRS_issue_101()
5354
var pointWithCRS = JsonConvert.DeserializeObject<Point>(pointJson);
5455
var linkCRS = pointWithCRS.CRS as LinkedCRS;
5556

56-
Assert.IsNotNull(linkCRS);
57-
Assert.AreEqual(CRSType.Link, linkCRS.Type);
58-
Assert.AreEqual(Href, linkCRS.Properties["href"]);
57+
ClassicAssert.IsNotNull(linkCRS);
58+
ClassicAssert.AreEqual(CRSType.Link, linkCRS.Type);
59+
ClassicAssert.AreEqual(Href, linkCRS.Properties["href"]);
5960
}
6061

6162
[Test]
6263
public void Ctor_Throws_ArgumentNullExpection_When_Href_String_Is_Null()
6364
{
64-
Assert.Throws<ArgumentNullException>(() => { var crs = new LinkedCRS((string)null); });
65+
ClassicAssert.Throws<ArgumentNullException>(() => { var crs = new LinkedCRS((string)null); });
6566
}
6667

6768
[Test]
6869
public void Ctor_Throws_ArgumentNullExpection_When_Href_Uri_Is_Null()
6970
{
70-
Assert.Throws<ArgumentNullException>(() => { var crs = new LinkedCRS((Uri)null); });
71+
ClassicAssert.Throws<ArgumentNullException>(() => { var crs = new LinkedCRS((Uri)null); });
7172
}
7273

7374
[Test]
@@ -84,20 +85,20 @@ public void Ctor_Throws_ArgumentExpection_When_Href_Is_Not_Dereferencable_Uri()
8485
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
8586
#endif
8687

87-
var argumentExpection = Assert.Throws<ArgumentException>(() => { var crs = new LinkedCRS("http://not-a-valid-<>-url"); });
88-
Assert.AreEqual(expected, argumentExpection.Message);
88+
var argumentExpection = ClassicAssert.Throws<ArgumentException>(() => { var crs = new LinkedCRS("http://not-a-valid-<>-url"); });
89+
ClassicAssert.AreEqual(expected, argumentExpection.Message);
8990
}
9091

9192
[Test]
9293
public void Ctor_Does_Not_Throw_When_Href_Is_Dereferencable_Uri()
9394
{
94-
Assert.DoesNotThrow(() => { var crs = new LinkedCRS("data.crs"); });
95+
ClassicAssert.DoesNotThrow(() => { var crs = new LinkedCRS("data.crs"); });
9596
}
9697

9798
[Test]
9899
public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Empty()
99100
{
100-
Assert.Throws<ArgumentException>(() => { var crs = new LinkedCRS(string.Empty); });
101+
ClassicAssert.Throws<ArgumentException>(() => { var crs = new LinkedCRS(string.Empty); });
101102
}
102103

103104
[Test]
@@ -106,30 +107,30 @@ public void Equals_GetHashCode_Contract()
106107
var left = new LinkedCRS(Href);
107108
var right = new LinkedCRS(Href);
108109

109-
Assert.AreEqual(left, right);
110+
ClassicAssert.AreEqual(left, right);
110111

111-
Assert.IsTrue(left == right);
112-
Assert.IsTrue(right == left);
112+
ClassicAssert.IsTrue(left == right);
113+
ClassicAssert.IsTrue(right == left);
113114

114-
Assert.IsTrue(left.Equals(right));
115-
Assert.IsTrue(right.Equals(left));
115+
ClassicAssert.IsTrue(left.Equals(right));
116+
ClassicAssert.IsTrue(right.Equals(left));
116117

117-
Assert.IsTrue(left.Equals(left));
118-
Assert.IsTrue(right.Equals(right));
118+
ClassicAssert.IsTrue(left.Equals(left));
119+
ClassicAssert.IsTrue(right.Equals(right));
119120

120-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
121+
ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode());
121122

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

124-
Assert.AreNotEqual(left, right);
125+
ClassicAssert.AreNotEqual(left, right);
125126

126-
Assert.IsFalse(left == right);
127-
Assert.IsFalse(right == left);
127+
ClassicAssert.IsFalse(left == right);
128+
ClassicAssert.IsFalse(right == left);
128129

129-
Assert.IsFalse(left.Equals(right));
130-
Assert.IsFalse(right.Equals(left));
130+
ClassicAssert.IsFalse(left.Equals(right));
131+
ClassicAssert.IsFalse(right.Equals(left));
131132

132-
Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
133+
ClassicAssert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
133134
}
134135
}
135136
}

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

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using GeoJSON.Net.Feature;
44
using Newtonsoft.Json;
55
using NUnit.Framework;
6+
using NUnit.Framework.Legacy;
67

78
namespace GeoJSON.Net.Tests.CoordinateReferenceSystem
89
{
@@ -15,7 +16,7 @@ public void Has_Correct_Type()
1516
var name = "EPSG:31370";
1617
var crs = new NamedCRS(name);
1718

18-
Assert.AreEqual(CRSType.Name, crs.Type);
19+
ClassicAssert.AreEqual(CRSType.Name, crs.Type);
1920
}
2021

2122
[Test]
@@ -24,8 +25,8 @@ public void Has_Name_Property_With_Name()
2425
var name = "EPSG:31370";
2526
var crs = new NamedCRS(name);
2627

27-
Assert.IsTrue(crs.Properties.ContainsKey("name"));
28-
Assert.AreEqual(name, crs.Properties["name"]);
28+
ClassicAssert.IsTrue(crs.Properties.ContainsKey("name"));
29+
ClassicAssert.AreEqual(name, crs.Properties["name"]);
2930
}
3031

3132
[Test]
@@ -40,13 +41,13 @@ public void Can_Serialize()
4041
[Test]
4142
public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Null()
4243
{
43-
Assert.Throws<ArgumentNullException>(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(null) }; });
44+
ClassicAssert.Throws<ArgumentNullException>(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(null) }; });
4445
}
4546

4647
[Test]
4748
public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Empty()
4849
{
49-
Assert.Throws<ArgumentException>(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(string.Empty) }; });
50+
ClassicAssert.Throws<ArgumentException>(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(string.Empty) }; });
5051
}
5152

5253
[Test]
@@ -57,31 +58,31 @@ public void Equals_GetHashCode_Contract()
5758
var left = new NamedCRS(name);
5859
var right = new NamedCRS(name);
5960

60-
Assert.AreEqual(left, right);
61+
ClassicAssert.AreEqual(left, right);
6162

62-
Assert.IsTrue(left == right);
63-
Assert.IsTrue(right == left);
63+
ClassicAssert.IsTrue(left == right);
64+
ClassicAssert.IsTrue(right == left);
6465

65-
Assert.IsTrue(left.Equals(right));
66-
Assert.IsTrue(right.Equals(left));
66+
ClassicAssert.IsTrue(left.Equals(right));
67+
ClassicAssert.IsTrue(right.Equals(left));
6768

68-
Assert.IsTrue(left.Equals(left));
69-
Assert.IsTrue(right.Equals(right));
69+
ClassicAssert.IsTrue(left.Equals(left));
70+
ClassicAssert.IsTrue(right.Equals(right));
7071

71-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
72+
ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode());
7273

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

76-
Assert.AreNotEqual(left, right);
77+
ClassicAssert.AreNotEqual(left, right);
7778

78-
Assert.IsFalse(left == right);
79-
Assert.IsFalse(right == left);
79+
ClassicAssert.IsFalse(left == right);
80+
ClassicAssert.IsFalse(right == left);
8081

81-
Assert.IsFalse(left.Equals(right));
82-
Assert.IsFalse(right.Equals(left));
82+
ClassicAssert.IsFalse(left.Equals(right));
83+
ClassicAssert.IsFalse(right.Equals(left));
8384

84-
Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
85+
ClassicAssert.AreNotEqual(left.GetHashCode(), right.GetHashCode());
8586
}
8687
}
8788
}

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

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using GeoJSON.Net.Feature;
33
using Newtonsoft.Json;
44
using NUnit.Framework;
5+
using NUnit.Framework.Legacy;
56

67
namespace GeoJSON.Net.Tests.CoordinateReferenceSystem
78
{
@@ -13,7 +14,7 @@ public void Has_Correct_Type()
1314
{
1415
var crs = new UnspecifiedCRS();
1516

16-
Assert.AreEqual(CRSType.Unspecified, crs.Type);
17+
ClassicAssert.AreEqual(CRSType.Unspecified, crs.Type);
1718
}
1819

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

35-
Assert.IsInstanceOf<UnspecifiedCRS>(featureCollection.CRS);
36+
ClassicAssert.IsInstanceOf<UnspecifiedCRS>(featureCollection.CRS);
3637
}
3738

3839
[Test]
@@ -41,18 +42,18 @@ public void Equals_GetHashCode_Contract()
4142
var left = new UnspecifiedCRS();
4243
var right = new UnspecifiedCRS();
4344

44-
Assert.AreEqual(left, right);
45+
ClassicAssert.AreEqual(left, right);
4546

46-
Assert.IsTrue(left == right);
47-
Assert.IsTrue(right == left);
47+
ClassicAssert.IsTrue(left == right);
48+
ClassicAssert.IsTrue(right == left);
4849

49-
Assert.IsTrue(left.Equals(right));
50-
Assert.IsTrue(right.Equals(left));
50+
ClassicAssert.IsTrue(left.Equals(right));
51+
ClassicAssert.IsTrue(right.Equals(left));
5152

52-
Assert.IsTrue(left.Equals(left));
53-
Assert.IsTrue(right.Equals(right));
53+
ClassicAssert.IsTrue(left.Equals(left));
54+
ClassicAssert.IsTrue(right.Equals(right));
5455

55-
Assert.AreEqual(left.GetHashCode(), right.GetHashCode());
56+
ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode());
5657
}
5758
}
5859
}

0 commit comments

Comments
 (0)