From c3845613b7a9802052d63b9687c23bf6da378991 Mon Sep 17 00:00:00 2001 From: Janus Weil Date: Mon, 8 Jul 2024 22:06:35 +0200 Subject: [PATCH] update NUnit to 4.1.0 * breaking changes in NUnit 4 require many mechnical replacements of "Assert." by "ClassicAssert." --- .../DefaultCrsTests.cs | 17 +-- .../LinkedCRSTests.cs | 57 ++++---- .../NamedCrsTests.cs | 39 ++--- .../UnspecifiedCRSTests.cs | 21 +-- .../Feature/FeatureCollectionTests.cs | 55 ++++---- src/GeoJSON.Net.Tests/Feature/FeatureTests.cs | 133 +++++++++--------- .../Feature/GenericFeatureTests.cs | 55 ++++---- .../GeoJSON.Net.Tests.csproj | 2 +- .../Geometry/GeometryTests.cs | 25 ++-- .../Geometry/LineStringTests.cs | 35 ++--- .../Geometry/MultiLineStringTests.cs | 23 +-- .../Geometry/MultiPointTests.cs | 21 +-- .../Geometry/MultiPolygonTests.cs | 21 +-- src/GeoJSON.Net.Tests/Geometry/PointTests.cs | 35 ++--- .../Geometry/PolygonTests.cs | 25 ++-- src/GeoJSON.Net.Tests/JsonAssert.cs | 6 +- .../Serialization/JsonTests.cs | 5 +- 17 files changed, 295 insertions(+), 280 deletions(-) diff --git a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/DefaultCrsTests.cs b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/DefaultCrsTests.cs index 0cd89bc3..5f7f8732 100644 --- a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/DefaultCrsTests.cs +++ b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/DefaultCrsTests.cs @@ -3,6 +3,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.CoordinateReferenceSystem { @@ -16,7 +17,7 @@ public void Can_Serialize_Does_Not_Output_Crs_Property() var json = JsonConvert.SerializeObject(collection); - Assert.IsTrue(!json.Contains("\"crs\"")); + ClassicAssert.IsTrue(!json.Contains("\"crs\"")); } [Test] @@ -26,7 +27,7 @@ public void Can_Deserialize_When_Json_Does_Not_Contain_Crs_Property() var point = JsonConvert.DeserializeObject(json); - Assert.IsNull(point.CRS); + ClassicAssert.IsNull(point.CRS); } [Test] @@ -36,8 +37,8 @@ public void Can_Deserialize_CRS_issue_89() var point = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(point.CRS); - Assert.AreEqual(CRSType.Name, point.CRS.Type); + ClassicAssert.IsNotNull(point.CRS); + ClassicAssert.AreEqual(CRSType.Name, point.CRS.Type); } [Test] @@ -49,8 +50,8 @@ public void Can_Serialize_CRS_issue_89() var json = JsonConvert.SerializeObject(point); - Assert.IsNotNull(json); - Assert.AreEqual(expected, json); + ClassicAssert.IsNotNull(json); + ClassicAssert.AreEqual(expected, json); } [Test] @@ -62,8 +63,8 @@ public void Can_Serialize_DefaultCRS_issue_89() var json = JsonConvert.SerializeObject(point); - Assert.IsNotNull(json); - Assert.AreEqual(expected, json); + ClassicAssert.IsNotNull(json); + ClassicAssert.AreEqual(expected, json); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs index d0897960..a26c663d 100644 --- a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs +++ b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/LinkedCRSTests.cs @@ -3,6 +3,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.CoordinateReferenceSystem { @@ -15,7 +16,7 @@ public class LinkedCRSTests : TestBase public void Has_Correct_Type() { var crs = new LinkedCRS(Href); - Assert.AreEqual(CRSType.Link, crs.Type); + ClassicAssert.AreEqual(CRSType.Link, crs.Type); } [Test] @@ -23,8 +24,8 @@ public void Has_Href_Property_With_Href() { var crs = new LinkedCRS(Href); - Assert.IsTrue(crs.Properties.ContainsKey("href")); - Assert.AreEqual(Href, crs.Properties["href"]); + ClassicAssert.IsTrue(crs.Properties.ContainsKey("href")); + ClassicAssert.AreEqual(Href, crs.Properties["href"]); } [Test] @@ -33,8 +34,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"]); + ClassicAssert.IsTrue(crs.Properties.ContainsKey("type")); + ClassicAssert.AreEqual(type, crs.Properties["type"]); } [Test] @@ -53,21 +54,21 @@ public void Can_Deserialize_CRS_issue_101() var pointWithCRS = JsonConvert.DeserializeObject(pointJson); var linkCRS = pointWithCRS.CRS as LinkedCRS; - Assert.IsNotNull(linkCRS); - Assert.AreEqual(CRSType.Link, linkCRS.Type); - Assert.AreEqual(Href, linkCRS.Properties["href"]); + ClassicAssert.IsNotNull(linkCRS); + ClassicAssert.AreEqual(CRSType.Link, linkCRS.Type); + ClassicAssert.AreEqual(Href, linkCRS.Properties["href"]); } [Test] public void Ctor_Throws_ArgumentNullExpection_When_Href_String_Is_Null() { - Assert.Throws(() => { var crs = new LinkedCRS((string)null); }); + ClassicAssert.Throws(() => { var crs = new LinkedCRS((string)null); }); } [Test] public void Ctor_Throws_ArgumentNullExpection_When_Href_Uri_Is_Null() { - Assert.Throws(() => { var crs = new LinkedCRS((Uri)null); }); + ClassicAssert.Throws(() => { var crs = new LinkedCRS((Uri)null); }); } [Test] @@ -84,20 +85,20 @@ public void Ctor_Throws_ArgumentExpection_When_Href_Is_Not_Dereferencable_Uri() System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US"); #endif - var argumentExpection = Assert.Throws(() => { var crs = new LinkedCRS("http://not-a-valid-<>-url"); }); - Assert.AreEqual(expected, argumentExpection.Message); + var argumentExpection = ClassicAssert.Throws(() => { var crs = new LinkedCRS("http://not-a-valid-<>-url"); }); + ClassicAssert.AreEqual(expected, argumentExpection.Message); } [Test] public void Ctor_Does_Not_Throw_When_Href_Is_Dereferencable_Uri() { - Assert.DoesNotThrow(() => { var crs = new LinkedCRS("data.crs"); }); + ClassicAssert.DoesNotThrow(() => { var crs = new LinkedCRS("data.crs"); }); } [Test] public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Empty() { - Assert.Throws(() => { var crs = new LinkedCRS(string.Empty); }); + ClassicAssert.Throws(() => { var crs = new LinkedCRS(string.Empty); }); } [Test] @@ -106,30 +107,30 @@ public void Equals_GetHashCode_Contract() var left = new LinkedCRS(Href); var right = new LinkedCRS(Href); - Assert.AreEqual(left, right); + ClassicAssert.AreEqual(left, right); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(right.Equals(left)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); right = new LinkedCRS(Href + "?query=null"); - Assert.AreNotEqual(left, right); + ClassicAssert.AreNotEqual(left, right); - Assert.IsFalse(left == right); - Assert.IsFalse(right == left); + ClassicAssert.IsFalse(left == right); + ClassicAssert.IsFalse(right == left); - Assert.IsFalse(left.Equals(right)); - Assert.IsFalse(right.Equals(left)); + ClassicAssert.IsFalse(left.Equals(right)); + ClassicAssert.IsFalse(right.Equals(left)); - Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/NamedCrsTests.cs b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/NamedCrsTests.cs index 88bdc2bf..32c62541 100644 --- a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/NamedCrsTests.cs +++ b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/NamedCrsTests.cs @@ -3,6 +3,7 @@ using GeoJSON.Net.Feature; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.CoordinateReferenceSystem { @@ -15,7 +16,7 @@ public void Has_Correct_Type() var name = "EPSG:31370"; var crs = new NamedCRS(name); - Assert.AreEqual(CRSType.Name, crs.Type); + ClassicAssert.AreEqual(CRSType.Name, crs.Type); } [Test] @@ -24,8 +25,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"]); + ClassicAssert.IsTrue(crs.Properties.ContainsKey("name")); + ClassicAssert.AreEqual(name, crs.Properties["name"]); } [Test] @@ -40,13 +41,13 @@ public void Can_Serialize() [Test] public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Null() { - Assert.Throws(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(null) }; }); + ClassicAssert.Throws(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(null) }; }); } [Test] public void Ctor_Throws_ArgumentNullExpection_When_Name_Is_Empty() { - Assert.Throws(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(string.Empty) }; }); + ClassicAssert.Throws(() => { var collection = new FeatureCollection() { CRS = new NamedCRS(string.Empty) }; }); } [Test] @@ -57,31 +58,31 @@ public void Equals_GetHashCode_Contract() var left = new NamedCRS(name); var right = new NamedCRS(name); - Assert.AreEqual(left, right); + ClassicAssert.AreEqual(left, right); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(right.Equals(left)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); name = "EPSG:25832"; right = new NamedCRS(name); - Assert.AreNotEqual(left, right); + ClassicAssert.AreNotEqual(left, right); - Assert.IsFalse(left == right); - Assert.IsFalse(right == left); + ClassicAssert.IsFalse(left == right); + ClassicAssert.IsFalse(right == left); - Assert.IsFalse(left.Equals(right)); - Assert.IsFalse(right.Equals(left)); + ClassicAssert.IsFalse(left.Equals(right)); + ClassicAssert.IsFalse(right.Equals(left)); - Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/UnspecifiedCRSTests.cs b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/UnspecifiedCRSTests.cs index e6448074..0c1078e7 100644 --- a/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/UnspecifiedCRSTests.cs +++ b/src/GeoJSON.Net.Tests/CoordinateReferenceSystem/UnspecifiedCRSTests.cs @@ -2,6 +2,7 @@ using GeoJSON.Net.Feature; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.CoordinateReferenceSystem { @@ -13,7 +14,7 @@ public void Has_Correct_Type() { var crs = new UnspecifiedCRS(); - Assert.AreEqual(CRSType.Unspecified, crs.Type); + ClassicAssert.AreEqual(CRSType.Unspecified, crs.Type); } [Test] @@ -32,7 +33,7 @@ public void Can_Deserialize_From_Null() var json = "{\"type\":\"FeatureCollection\",\"crs\":null,\"features\":[] }"; var featureCollection = JsonConvert.DeserializeObject(json); - Assert.IsInstanceOf(featureCollection.CRS); + ClassicAssert.IsInstanceOf(featureCollection.CRS); } [Test] @@ -41,18 +42,18 @@ public void Equals_GetHashCode_Contract() var left = new UnspecifiedCRS(); var right = new UnspecifiedCRS(); - Assert.AreEqual(left, right); + ClassicAssert.AreEqual(left, right); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(right.Equals(left)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs b/src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs index fe8d606b..a166aa1e 100644 --- a/src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs +++ b/src/GeoJSON.Net.Tests/Feature/FeatureCollectionTests.cs @@ -5,6 +5,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Feature { @@ -14,7 +15,7 @@ public class FeatureCollectionTests : TestBase [Test] public void Ctor_Throws_ArgumentNullException_When_Features_Is_Null() { - Assert.Throws(() => + ClassicAssert.Throws(() => { var featureCollection = new FeatureCollection(null); }); @@ -27,12 +28,12 @@ public void Can_Deserialize() var featureCollection = JsonConvert.DeserializeObject(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); + ClassicAssert.IsNotNull(featureCollection); + ClassicAssert.IsNotNull(featureCollection.Features); + ClassicAssert.AreEqual(featureCollection.Features.Count, 3); + ClassicAssert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Point), 1); + ClassicAssert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.MultiPolygon), 1); + ClassicAssert.AreEqual(featureCollection.Features.Count(x => x.Geometry.Type == GeoJSONObjectType.Polygon), 1); } [Test] @@ -42,11 +43,11 @@ public void Can_DeserializeGeneric() var featureCollection = JsonConvert.DeserializeObject>(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); + ClassicAssert.IsNotNull(featureCollection); + ClassicAssert.IsNotNull(featureCollection.Features); + ClassicAssert.AreEqual(featureCollection.Features.Count, 3); + ClassicAssert.AreEqual("DD", featureCollection.Features.First().Properties.Name); + ClassicAssert.AreEqual(123, featureCollection.Features.First().Properties.Size); } @@ -75,9 +76,9 @@ public void FeatureCollectionSerialization() var actualJson = JsonConvert.SerializeObject(model); - Assert.IsNotNull(actualJson); + ClassicAssert.IsNotNull(actualJson); - Assert.IsFalse(string.IsNullOrEmpty(actualJson)); + ClassicAssert.IsFalse(string.IsNullOrEmpty(actualJson)); } [Test] @@ -138,10 +139,10 @@ public void FeatureCollection_Test_IndexOf() var expectedId = expectedIds[i]; var expectedIndex = expectedIndexes[i]; - Assert.AreEqual(expectedId, actualId); - Assert.AreEqual(expectedIndex, actualIndex); + ClassicAssert.AreEqual(expectedId, actualId); + ClassicAssert.AreEqual(expectedIndex, actualIndex); - Assert.Inconclusive("not supported. the Feature.Id is optional. " + + ClassicAssert.Inconclusive("not supported. the Feature.Id is optional. " + " create a new class that inherits from" + " Feature and then override Equals and GetHashCode"); @@ -171,21 +172,21 @@ private FeatureCollection GetFeatureCollection() private void Assert_Are_Equal(FeatureCollection left, FeatureCollection right) { - Assert.AreEqual(left, right); + ClassicAssert.AreEqual(left, right); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(right.Equals(left)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.IsFalse(left != right); - Assert.IsFalse(right != left); + ClassicAssert.IsFalse(left != right); + ClassicAssert.IsFalse(right != left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } diff --git a/src/GeoJSON.Net.Tests/Feature/FeatureTests.cs b/src/GeoJSON.Net.Tests/Feature/FeatureTests.cs index 1b4075fa..b70cdd2d 100644 --- a/src/GeoJSON.Net.Tests/Feature/FeatureTests.cs +++ b/src/GeoJSON.Net.Tests/Feature/FeatureTests.cs @@ -1,6 +1,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; using System; using System.Collections.Generic; using System.Linq; @@ -17,16 +18,16 @@ public void Can_Deserialize_Point_Feature() var feature = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Any()); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Any()); - Assert.IsTrue(feature.Properties.ContainsKey("name")); - Assert.AreEqual(feature.Properties["name"], "Dinagat Islands"); + ClassicAssert.IsTrue(feature.Properties.ContainsKey("name")); + ClassicAssert.AreEqual(feature.Properties["name"], "Dinagat Islands"); - Assert.AreEqual("test-id", feature.Id); + ClassicAssert.AreEqual("test-id", feature.Id); - Assert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type); + ClassicAssert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type); } [Test] @@ -36,11 +37,11 @@ public void Can_Deserialize_Feature_Without_Props() var feature = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsEmpty(feature.Properties); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsEmpty(feature.Properties); - Assert.AreEqual(GeoJSONObjectType.Polygon, feature.Geometry.Type); + ClassicAssert.AreEqual(GeoJSONObjectType.Polygon, feature.Geometry.Type); } [Test] @@ -50,13 +51,13 @@ public void Can_Deserialize_Feature_With_Null_Geometry() var feature = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Any()); - Assert.IsTrue(feature.Properties.ContainsKey("name")); - Assert.AreEqual(feature.Properties["name"], "Unlocalized Feature"); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Any()); + ClassicAssert.IsTrue(feature.Properties.ContainsKey("name")); + ClassicAssert.AreEqual(feature.Properties["name"], "Unlocalized Feature"); - Assert.IsNull(feature.Geometry); + ClassicAssert.IsNull(feature.Geometry); } [Test] @@ -66,13 +67,13 @@ public void Can_Deserialize_Feature_Without_Geometry() var feature = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Any()); - Assert.IsTrue(feature.Properties.ContainsKey("name")); - Assert.AreEqual(feature.Properties["name"], "Unlocalized Feature"); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Any()); + ClassicAssert.IsTrue(feature.Properties.ContainsKey("name")); + ClassicAssert.AreEqual(feature.Properties["name"], "Unlocalized Feature"); - Assert.IsNull(feature.Geometry); + ClassicAssert.IsNull(feature.Geometry); } [Test] @@ -231,7 +232,7 @@ public void Can_Serialize_Dictionary_Subclass() var expectedJson = this.GetExpectedJson(); var actualJson = JsonConvert.SerializeObject(feature); - Assert.False(string.IsNullOrEmpty(expectedJson)); + ClassicAssert.False(string.IsNullOrEmpty(expectedJson)); JsonAssert.AreEqual(expectedJson, actualJson); } @@ -250,9 +251,9 @@ public void Ctor_Can_Add_Properties_Using_Object() Net.Feature.Feature feature = new Net.Feature.Feature(new Point(new Position(10, 10)), properties); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Count > 1); - Assert.AreEqual(feature.Properties.Count, 6); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Count > 1); + ClassicAssert.AreEqual(feature.Properties.Count, 6); } [Test] @@ -272,9 +273,9 @@ public void Ctor_Can_Add_Properties_Using_Object_Inheriting_Dictionary() Net.Feature.Feature feature = new Net.Feature.Feature(new Point(new Position(10, 10)), properties); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Count > 1); - Assert.AreEqual( + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Count > 1); + ClassicAssert.AreEqual( feature.Properties.Count, expectedProperties, $"Expected: {expectedProperties} Actual: {feature.Properties.Count}"); @@ -285,7 +286,7 @@ public void Ctor_Creates_Properties_Collection_When_Passed_Null_Proper_Object() { Net.Feature.Feature feature = new Net.Feature.Feature(new Point(new Position(10, 10)), (object)null); - Assert.IsNotNull(feature.Properties); + ClassicAssert.IsNotNull(feature.Properties); CollectionAssert.IsEmpty(feature.Properties); } @@ -408,14 +409,14 @@ public void Feature_Equals_Null_Issue94() bool equal2 = true; var feature = new Net.Feature.Feature(new Point(new Position(12, 123))); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature.Equals(null); equal2 = feature == null; }); - Assert.IsFalse(equal1); - Assert.IsFalse(equal2); + ClassicAssert.IsFalse(equal1); + ClassicAssert.IsFalse(equal2); } [Test] @@ -424,12 +425,12 @@ public void Feature_Null_Instance_Equals_Null_Issue94() var equal1 = true; Net.Feature.Feature feature = null; - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature != null; }); - Assert.IsFalse(equal1); + ClassicAssert.IsFalse(equal1); } [Test] @@ -439,14 +440,14 @@ public void Feature_Equals_Itself_Issue94() bool equal2 = false; var feature = new Net.Feature.Feature(new Point(new Position(12, 123))); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature == feature; equal2 = feature.Equals(feature); }); - Assert.IsTrue(equal1); - Assert.IsTrue(equal2); + ClassicAssert.IsTrue(equal1); + ClassicAssert.IsTrue(equal2); } [Test] @@ -458,14 +459,14 @@ public void Feature_Equals_Geometry_Null_Issue115() var feature1 = new Net.Feature.Feature(null); var feature2 = new Net.Feature.Feature(new Point(new Position(12, 123))); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature1 == feature2; equal2 = feature1.Equals(feature2); }); - Assert.IsFalse(equal1); - Assert.IsFalse(equal2); + ClassicAssert.IsFalse(equal1); + ClassicAssert.IsFalse(equal2); } [Test] @@ -477,14 +478,14 @@ public void Feature_Equals_Other_Geometry_Null_Issue115() var feature1 = new Net.Feature.Feature(new Point(new Position(12, 123))); var feature2 = new Net.Feature.Feature(null); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature1 == feature2; equal2 = feature1.Equals(feature2); }); - Assert.IsFalse(equal1); - Assert.IsFalse(equal2); + ClassicAssert.IsFalse(equal1); + ClassicAssert.IsFalse(equal2); } [Test] @@ -496,14 +497,14 @@ public void Feature_Equals_All_Geometry_Null_Issue115() var feature1 = new Net.Feature.Feature(null); var feature2 = new Net.Feature.Feature(null); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature1 == feature2; equal2 = feature1.Equals(feature2); }); - Assert.IsTrue(equal1); - Assert.IsTrue(equal2); + ClassicAssert.IsTrue(equal1); + ClassicAssert.IsTrue(equal2); } @@ -553,37 +554,37 @@ public static IDictionary GetPropertiesInRandomOrder() private void Assert_Are_Equal(Net.Feature.Feature left, Net.Feature.Feature right) { - Assert.AreEqual(left, right); + ClassicAssert.AreEqual(left, right); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(right.Equals(left)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.IsFalse(left != right); - Assert.IsFalse(right != left); + ClassicAssert.IsFalse(left != right); + ClassicAssert.IsFalse(right != left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } private void Assert_Are_Not_Equal(Net.Feature.Feature left, Net.Feature.Feature right) { - Assert.AreNotEqual(left, right); + ClassicAssert.AreNotEqual(left, right); - Assert.IsFalse(left.Equals(right)); - Assert.IsFalse(right.Equals(left)); + ClassicAssert.IsFalse(left.Equals(right)); + ClassicAssert.IsFalse(right.Equals(left)); - Assert.IsFalse(left == right); - Assert.IsFalse(right == left); + ClassicAssert.IsFalse(left == right); + ClassicAssert.IsFalse(right == left); - Assert.IsTrue(left != right); - Assert.IsTrue(right != left); + ClassicAssert.IsTrue(left != right); + ClassicAssert.IsTrue(right != left); - Assert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreNotEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Feature/GenericFeatureTests.cs b/src/GeoJSON.Net.Tests/Feature/GenericFeatureTests.cs index 78f0fd55..e9da15ef 100644 --- a/src/GeoJSON.Net.Tests/Feature/GenericFeatureTests.cs +++ b/src/GeoJSON.Net.Tests/Feature/GenericFeatureTests.cs @@ -4,6 +4,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Feature { @@ -17,19 +18,19 @@ public void Can_Deserialize_Point_Feature() var feature = JsonConvert.DeserializeObject>(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Any()); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Any()); - Assert.IsTrue(feature.Properties.ContainsKey("name")); - Assert.AreEqual("Dinagat Islands", feature.Properties["name"]); + ClassicAssert.IsTrue(feature.Properties.ContainsKey("name")); + ClassicAssert.AreEqual("Dinagat Islands", feature.Properties["name"]); - Assert.AreEqual("test-id", feature.Id); + ClassicAssert.AreEqual("test-id", feature.Id); - Assert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type); - Assert.AreEqual(125.6, feature.Geometry.Coordinates.Longitude); - Assert.AreEqual(10.1, feature.Geometry.Coordinates.Latitude); - Assert.AreEqual(456, feature.Geometry.Coordinates.Altitude); + ClassicAssert.AreEqual(GeoJSONObjectType.Point, feature.Geometry.Type); + ClassicAssert.AreEqual(125.6, feature.Geometry.Coordinates.Longitude); + ClassicAssert.AreEqual(10.1, feature.Geometry.Coordinates.Latitude); + ClassicAssert.AreEqual(456, feature.Geometry.Coordinates.Altitude); } [Test] @@ -39,18 +40,18 @@ public void Can_Deserialize_LineString_Feature() var feature = JsonConvert.DeserializeObject>(json); - Assert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.IsTrue(feature.Properties.Any()); + ClassicAssert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.IsTrue(feature.Properties.Any()); - Assert.IsTrue(feature.Properties.ContainsKey("name")); - Assert.AreEqual("Dinagat Islands", feature.Properties["name"]); + ClassicAssert.IsTrue(feature.Properties.ContainsKey("name")); + ClassicAssert.AreEqual("Dinagat Islands", feature.Properties["name"]); - Assert.AreEqual("test-id", feature.Id); + ClassicAssert.AreEqual("test-id", feature.Id); - Assert.AreEqual(GeoJSONObjectType.LineString, feature.Geometry.Type); + ClassicAssert.AreEqual(GeoJSONObjectType.LineString, feature.Geometry.Type); - Assert.AreEqual(4, feature.Geometry.Coordinates.Count); + ClassicAssert.AreEqual(4, feature.Geometry.Coordinates.Count); //Assert.AreEqual(125.6, feature.Geometry.Coordinates.Longitude); //Assert.AreEqual(10.1, feature.Geometry.Coordinates.Latitude); @@ -72,14 +73,14 @@ public void Feature_Generic_Equals_Null_Issure94() var feature = new Feature>(point, properties, "testid"); - Assert.DoesNotThrow(() => + ClassicAssert.DoesNotThrow(() => { equal1 = feature == null; equal2 = feature.Equals(null); }); - Assert.IsFalse(equal1); - Assert.IsFalse(equal2); + ClassicAssert.IsFalse(equal1); + ClassicAssert.IsFalse(equal2); } private class TypedFeatureProps @@ -96,15 +97,15 @@ public void Can_Deserialize_Typed_Point_Feature() var json = GetExpectedJson(); var feature = JsonConvert.DeserializeObject>(json); - Assert.IsNotNull(feature); + ClassicAssert.IsNotNull(feature); - Assert.IsNotNull(feature.Properties); - Assert.AreEqual(feature.Properties.Name, "Dinagat Islands"); - Assert.AreEqual(feature.Properties.Value, 4.2); + ClassicAssert.IsNotNull(feature.Properties); + ClassicAssert.AreEqual(feature.Properties.Name, "Dinagat Islands"); + ClassicAssert.AreEqual(feature.Properties.Value, 4.2); - Assert.AreEqual(feature.Id, "test-id"); + ClassicAssert.AreEqual(feature.Id, "test-id"); - Assert.AreEqual(feature.Geometry.Type, GeoJSONObjectType.Point); + ClassicAssert.AreEqual(feature.Geometry.Type, GeoJSONObjectType.Point); } diff --git a/src/GeoJSON.Net.Tests/GeoJSON.Net.Tests.csproj b/src/GeoJSON.Net.Tests/GeoJSON.Net.Tests.csproj index 5531a56a..ca854521 100644 --- a/src/GeoJSON.Net.Tests/GeoJSON.Net.Tests.csproj +++ b/src/GeoJSON.Net.Tests/GeoJSON.Net.Tests.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/GeoJSON.Net.Tests/Geometry/GeometryTests.cs b/src/GeoJSON.Net.Tests/Geometry/GeometryTests.cs index 0b9ce7db..8869081e 100644 --- a/src/GeoJSON.Net.Tests/Geometry/GeometryTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/GeometryTests.cs @@ -4,6 +4,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -120,7 +121,7 @@ public void Can_Serialize_And_Deserialize_Geometry(IGeometryObject geometry) var deserializedGeometry = JsonConvert.DeserializeObject(json, new GeometryConverter()); - Assert.AreEqual(geometry, deserializedGeometry); + ClassicAssert.AreEqual(geometry, deserializedGeometry); } [Test] @@ -128,7 +129,7 @@ public void Can_Serialize_And_Deserialize_Geometry(IGeometryObject geometry) public void Serialization_Observes_Indenting_Setting_Of_Serializer(IGeometryObject geometry) { var json = JsonConvert.SerializeObject(geometry, Formatting.Indented); - Assert.IsTrue(json.Contains(Environment.NewLine)); + ClassicAssert.IsTrue(json.Contains(Environment.NewLine)); } [Test] @@ -136,8 +137,8 @@ public void Serialization_Observes_Indenting_Setting_Of_Serializer(IGeometryObje public void Serialization_Observes_No_Indenting_Setting_Of_Serializer(IGeometryObject geometry) { var json = JsonConvert.SerializeObject(geometry, Formatting.None); - Assert.IsFalse(json.Contains(Environment.NewLine)); - Assert.IsFalse(json.Contains(" ")); + ClassicAssert.IsFalse(json.Contains(Environment.NewLine)); + ClassicAssert.IsFalse(json.Contains(" ")); } [Test] @@ -150,7 +151,7 @@ public void Can_Serialize_And_Deserialize_Geometry_As_Object_Property(IGeometryO var deserializedClassWithGeometry = JsonConvert.DeserializeObject(json); - Assert.AreEqual(classWithGeometry, deserializedClassWithGeometry); + ClassicAssert.AreEqual(classWithGeometry, deserializedClassWithGeometry); } [Test] @@ -166,16 +167,16 @@ public void Serialized_And_Deserialized_Equals_And_Share_HashCode(IGeometryObjec var actual = classWithGeometry; var expected = deserializedClassWithGeometry; - Assert.IsTrue(actual.Equals(expected)); - Assert.IsTrue(actual.Equals(actual)); + ClassicAssert.IsTrue(actual.Equals(expected)); + ClassicAssert.IsTrue(actual.Equals(actual)); - Assert.IsTrue(expected.Equals(actual)); - Assert.IsTrue(expected.Equals(expected)); + ClassicAssert.IsTrue(expected.Equals(actual)); + ClassicAssert.IsTrue(expected.Equals(expected)); - Assert.IsTrue(classWithGeometry == deserializedClassWithGeometry); - Assert.IsTrue(deserializedClassWithGeometry == classWithGeometry); + ClassicAssert.IsTrue(classWithGeometry == deserializedClassWithGeometry); + ClassicAssert.IsTrue(deserializedClassWithGeometry == classWithGeometry); - Assert.AreEqual(actual.GetHashCode(), expected.GetHashCode()); + ClassicAssert.AreEqual(actual.GetHashCode(), expected.GetHashCode()); } internal class ClassWithGeometryProperty diff --git a/src/GeoJSON.Net.Tests/Geometry/LineStringTests.cs b/src/GeoJSON.Net.Tests/Geometry/LineStringTests.cs index d203b870..14fbc963 100644 --- a/src/GeoJSON.Net.Tests/Geometry/LineStringTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/LineStringTests.cs @@ -3,6 +3,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -22,7 +23,7 @@ public void Is_Closed() var lineString = new LineString(coordinates); - Assert.IsTrue(lineString.IsClosed()); + ClassicAssert.IsTrue(lineString.IsClosed()); } [Test] @@ -38,7 +39,7 @@ public void Is_Not_Closed() var lineString = new LineString(coordinates); - Assert.IsFalse(lineString.IsClosed()); + ClassicAssert.IsFalse(lineString.IsClosed()); } @@ -76,24 +77,24 @@ public void Can_Deserialize() var json = GetExpectedJson(); var actualLineString = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectedLineString, actualLineString); + ClassicAssert.AreEqual(expectedLineString, actualLineString); - Assert.AreEqual(4, actualLineString.Coordinates.Count); - Assert.AreEqual(expectedLineString.Coordinates[0].Latitude, actualLineString.Coordinates[0].Latitude); - Assert.AreEqual(expectedLineString.Coordinates[0].Longitude, actualLineString.Coordinates[0].Longitude); + ClassicAssert.AreEqual(4, actualLineString.Coordinates.Count); + ClassicAssert.AreEqual(expectedLineString.Coordinates[0].Latitude, actualLineString.Coordinates[0].Latitude); + ClassicAssert.AreEqual(expectedLineString.Coordinates[0].Longitude, actualLineString.Coordinates[0].Longitude); } [Test] public void Constructor_No_Coordinates_Throws_Exception() { var coordinates = new List(); - Assert.Throws(() => new LineString(coordinates)); + ClassicAssert.Throws(() => new LineString(coordinates)); } [Test] public void Constructor_Null_Coordinates_Throws_Exception() { - Assert.Throws(() => new LineString((IEnumerable)null)); + ClassicAssert.Throws(() => new LineString((IEnumerable)null)); } private LineString GetLineString(double offset = 0.0) @@ -122,18 +123,18 @@ public void Equals_GetHashCode_Contract() var left = GetLineString(offset); var right = GetLineString(offset); - Assert.AreEqual(left, right); - Assert.AreEqual(right, left); + ClassicAssert.AreEqual(left, right); + ClassicAssert.AreEqual(right, left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Geometry/MultiLineStringTests.cs b/src/GeoJSON.Net.Tests/Geometry/MultiLineStringTests.cs index ac2b643d..0655fd63 100644 --- a/src/GeoJSON.Net.Tests/Geometry/MultiLineStringTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/MultiLineStringTests.cs @@ -2,6 +2,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -31,8 +32,8 @@ public void Can_Deserialize() var multiLineString = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(multiLineString); - Assert.AreEqual(expectedMultiLineString, multiLineString); + ClassicAssert.IsNotNull(multiLineString); + ClassicAssert.AreEqual(expectedMultiLineString, multiLineString); } [Test] @@ -98,18 +99,18 @@ public void Equals_GetHashCode_Contract() var right = new MultiLineString(rightLine); - Assert.AreEqual(left, right); - Assert.AreEqual(right, left); + ClassicAssert.AreEqual(left, right); + ClassicAssert.AreEqual(right, left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Geometry/MultiPointTests.cs b/src/GeoJSON.Net.Tests/Geometry/MultiPointTests.cs index 741f068e..f0625920 100644 --- a/src/GeoJSON.Net.Tests/Geometry/MultiPointTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/MultiPointTests.cs @@ -2,6 +2,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -40,7 +41,7 @@ public void Can_Deserialize() var json = GetExpectedJson(); var actualMultiPoint = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectedMultiPoint, actualMultiPoint); + ClassicAssert.AreEqual(expectedMultiPoint, actualMultiPoint); } private List GetPoints(double offset) @@ -68,18 +69,18 @@ public void Equals_GetHashCode_Contract() var left = new MultiPoint(GetPoints(offset)); var right = new MultiPoint(GetPoints(offset)); - Assert.AreEqual(left, right); - Assert.AreEqual(right, left); + ClassicAssert.AreEqual(left, right); + ClassicAssert.AreEqual(right, left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Geometry/MultiPolygonTests.cs b/src/GeoJSON.Net.Tests/Geometry/MultiPolygonTests.cs index d9c3aa71..7e41b777 100644 --- a/src/GeoJSON.Net.Tests/Geometry/MultiPolygonTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/MultiPolygonTests.cs @@ -2,6 +2,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -17,7 +18,7 @@ public void Can_Deserialize() var actualMultiPolygon = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectMultiPolygon, actualMultiPolygon); + ClassicAssert.AreEqual(expectMultiPolygon, actualMultiPolygon); } private MultiPolygon GetMultiPolygon(double offset = 0.0) @@ -122,18 +123,18 @@ public void Equals_GetHashCode_Contract() var left = GetMultiPolygon(offset); var right = GetMultiPolygon(offset); - Assert.AreEqual(left, right); - Assert.AreEqual(right, left); + ClassicAssert.AreEqual(left, right); + ClassicAssert.AreEqual(right, left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } } } \ No newline at end of file diff --git a/src/GeoJSON.Net.Tests/Geometry/PointTests.cs b/src/GeoJSON.Net.Tests/Geometry/PointTests.cs index f27683ad..d19fbf78 100644 --- a/src/GeoJSON.Net.Tests/Geometry/PointTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/PointTests.cs @@ -1,6 +1,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -40,12 +41,12 @@ public void Can_Deserialize_With_Lat_Lon_Alt() var actualPoint = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(actualPoint); - Assert.IsNotNull(actualPoint.Coordinates); - Assert.AreEqual(53.2455662, actualPoint.Coordinates.Latitude); - Assert.AreEqual(90.65464646, actualPoint.Coordinates.Longitude); - Assert.AreEqual(200.4567, actualPoint.Coordinates.Altitude); - Assert.AreEqual(expectedPoint, actualPoint); + ClassicAssert.IsNotNull(actualPoint); + ClassicAssert.IsNotNull(actualPoint.Coordinates); + ClassicAssert.AreEqual(53.2455662, actualPoint.Coordinates.Latitude); + ClassicAssert.AreEqual(90.65464646, actualPoint.Coordinates.Longitude); + ClassicAssert.AreEqual(200.4567, actualPoint.Coordinates.Altitude); + ClassicAssert.AreEqual(expectedPoint, actualPoint); } [Test] @@ -57,13 +58,13 @@ public void Can_Deserialize_With_Lat_Lon() var actualPoint = JsonConvert.DeserializeObject(json); - Assert.IsNotNull(actualPoint); - Assert.IsNotNull(actualPoint.Coordinates); - Assert.AreEqual(53.2455662, actualPoint.Coordinates.Latitude); - Assert.AreEqual(90.65464646, actualPoint.Coordinates.Longitude); - Assert.IsFalse(actualPoint.Coordinates.Altitude.HasValue); - Assert.IsNull(actualPoint.Coordinates.Altitude); - Assert.AreEqual(expectedPoint, actualPoint); + ClassicAssert.IsNotNull(actualPoint); + ClassicAssert.IsNotNull(actualPoint.Coordinates); + ClassicAssert.AreEqual(53.2455662, actualPoint.Coordinates.Latitude); + ClassicAssert.AreEqual(90.65464646, actualPoint.Coordinates.Longitude); + ClassicAssert.IsFalse(actualPoint.Coordinates.Altitude.HasValue); + ClassicAssert.IsNull(actualPoint.Coordinates.Altitude); + ClassicAssert.AreEqual(expectedPoint, actualPoint); } [Test] @@ -75,11 +76,11 @@ public void Equals_GetHashCode_Contract() var actualPoint = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectedPoint, actualPoint); - Assert.IsTrue(expectedPoint.Equals(actualPoint)); - Assert.IsTrue(actualPoint.Equals(expectedPoint)); + ClassicAssert.AreEqual(expectedPoint, actualPoint); + ClassicAssert.IsTrue(expectedPoint.Equals(actualPoint)); + ClassicAssert.IsTrue(actualPoint.Equals(expectedPoint)); - Assert.AreEqual(expectedPoint.GetHashCode(), actualPoint.GetHashCode()); + ClassicAssert.AreEqual(expectedPoint.GetHashCode(), actualPoint.GetHashCode()); } [Test] diff --git a/src/GeoJSON.Net.Tests/Geometry/PolygonTests.cs b/src/GeoJSON.Net.Tests/Geometry/PolygonTests.cs index b55f5359..72b5af4a 100644 --- a/src/GeoJSON.Net.Tests/Geometry/PolygonTests.cs +++ b/src/GeoJSON.Net.Tests/Geometry/PolygonTests.cs @@ -3,6 +3,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Geometry { @@ -51,7 +52,7 @@ public void Can_RoundTrip_IGeometryObject() var json = JsonConvert.SerializeObject(polygon, serializerSettings); var result = JsonConvert.DeserializeObject(json, serializerSettings); - Assert.AreEqual(result, polygon); + ClassicAssert.AreEqual(result, polygon); } [Test] @@ -265,7 +266,7 @@ public void Can_Deserialize_With_Exterior_And_Inner_Rings() }); var actualPolygon = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectedPolygon, actualPolygon); + ClassicAssert.AreEqual(expectedPolygon, actualPolygon); } [Test] @@ -286,7 +287,7 @@ public void Can_Deserialize() var actualPolygon = JsonConvert.DeserializeObject(json); - Assert.AreEqual(expectedPolygon, actualPolygon); + ClassicAssert.AreEqual(expectedPolygon, actualPolygon); } [Test] @@ -303,18 +304,18 @@ public void Equals_GetHashCode_Contract() var left = GetPolygon(offset); var right = GetPolygon(offset); - Assert.AreEqual(left, right); - Assert.AreEqual(right, left); + ClassicAssert.AreEqual(left, right); + ClassicAssert.AreEqual(right, left); - Assert.IsTrue(left.Equals(right)); - Assert.IsTrue(left.Equals(left)); - Assert.IsTrue(right.Equals(left)); - Assert.IsTrue(right.Equals(right)); + ClassicAssert.IsTrue(left.Equals(right)); + ClassicAssert.IsTrue(left.Equals(left)); + ClassicAssert.IsTrue(right.Equals(left)); + ClassicAssert.IsTrue(right.Equals(right)); - Assert.IsTrue(left == right); - Assert.IsTrue(right == left); + ClassicAssert.IsTrue(left == right); + ClassicAssert.IsTrue(right == left); - Assert.AreEqual(left.GetHashCode(), right.GetHashCode()); + ClassicAssert.AreEqual(left.GetHashCode(), right.GetHashCode()); } diff --git a/src/GeoJSON.Net.Tests/JsonAssert.cs b/src/GeoJSON.Net.Tests/JsonAssert.cs index fa8213ce..78d62366 100644 --- a/src/GeoJSON.Net.Tests/JsonAssert.cs +++ b/src/GeoJSON.Net.Tests/JsonAssert.cs @@ -1,6 +1,6 @@ using System.Linq; using Newtonsoft.Json.Linq; -using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests { @@ -20,7 +20,7 @@ public static class JsonAssert /// The actual json. public static void AreEqual(string expectJson, string actualJson) { - Assert.AreEqual( + ClassicAssert.AreEqual( JObject.Parse(expectJson).SortProperties().ToString(), JObject.Parse(actualJson).SortProperties().ToString()); } @@ -32,7 +32,7 @@ public static void AreEqual(string expectJson, string actualJson) /// The actual json. public static void Contains(string expectedJson, string actualJson) { - Assert.IsTrue(actualJson.Contains(expectedJson), "expected {0} to contain {1}", actualJson, expectedJson); + ClassicAssert.IsTrue(actualJson.Contains(expectedJson), "expected {0} to contain {1}", actualJson, expectedJson); } /// diff --git a/src/GeoJSON.Net.Tests/Serialization/JsonTests.cs b/src/GeoJSON.Net.Tests/Serialization/JsonTests.cs index 53ffa161..bb667fdd 100644 --- a/src/GeoJSON.Net.Tests/Serialization/JsonTests.cs +++ b/src/GeoJSON.Net.Tests/Serialization/JsonTests.cs @@ -2,6 +2,7 @@ using GeoJSON.Net.Geometry; using Newtonsoft.Json; using NUnit.Framework; +using NUnit.Framework.Legacy; namespace GeoJSON.Net.Tests.Serialization { @@ -16,7 +17,7 @@ public void Can_Serialize_as_GeoJSONObject() var deserialized = JsonConvert.DeserializeObject(json, new GeoJsonConverter()); - Assert.AreEqual(source, deserialized); + ClassicAssert.AreEqual(source, deserialized); } [Test] @@ -28,7 +29,7 @@ public void Can_Serialize_as_IGeoJSONObject() var deserialized = JsonConvert.DeserializeObject(json, new GeoJsonConverter()); - Assert.AreEqual(source, deserialized); + ClassicAssert.AreEqual(source, deserialized); } } }