public void Can_Serialize_And_Deserialize_Geometry_As_Object_Property(GeoObject geometry)
        {
            var classWithGeometry = new ClassWithGeometryProperty(geometry);

            var json = JsonSerializer.SerializeToString(classWithGeometry);

            var deserializedClassWithGeometry = JsonSerializer.DeserializeFromString <ClassWithGeometryProperty>(json);

            Assert.AreEqual(classWithGeometry, deserializedClassWithGeometry);
        }
Beispiel #2
0
        public void Can_Serialize_And_Deserialize_Geometry_As_Object_Property(IGeometryObject geometry)
        {
            var classWithGeometry = new ClassWithGeometryProperty(geometry);

            var json = JsonConvert.SerializeObject(classWithGeometry);

            var deserializedClassWithGeometry = JsonConvert.DeserializeObject <ClassWithGeometryProperty>(json);

            Assert.AreEqual(classWithGeometry, deserializedClassWithGeometry);
        }
Beispiel #3
0
        public void Serialized_And_Deserialized_Equals_And_Share_HashCode(IGeometryObject geometry)
        {
            var classWithGeometry = new ClassWithGeometryProperty(geometry);

            var json = JsonConvert.SerializeObject(classWithGeometry);

            var deserializedClassWithGeometry = JsonConvert.DeserializeObject <ClassWithGeometryProperty>(json);

            var actual   = classWithGeometry;
            var expected = deserializedClassWithGeometry;

            Assert.IsTrue(actual.Equals(expected));
            Assert.IsTrue(actual.Equals(actual));

            Assert.IsTrue(expected.Equals(actual));
            Assert.IsTrue(expected.Equals(expected));

            Assert.IsTrue(classWithGeometry == deserializedClassWithGeometry);
            Assert.IsTrue(deserializedClassWithGeometry == classWithGeometry);

            Assert.AreEqual(actual.GetHashCode(), expected.GetHashCode());
        }
 protected bool Equals(ClassWithGeometryProperty other)
 {
     return(Geometry.Equals(other.Geometry));
 }
 protected bool Equals(ClassWithGeometryProperty other)
 {
     return Geometry.Equals(other.Geometry);
 }
        public void Serialized_And_Deserialized_Equals_And_Share_HashCode(IGeometryObject geometry)
        {
            var classWithGeometry = new ClassWithGeometryProperty(geometry);

            var json = JsonConvert.SerializeObject(classWithGeometry);

            var deserializedClassWithGeometry = JsonConvert.DeserializeObject<ClassWithGeometryProperty>(json);

            var actual = classWithGeometry;
            var expected = deserializedClassWithGeometry;
            
            Assert.IsTrue(actual.Equals(expected));
            Assert.IsTrue(actual.Equals(actual));

            Assert.IsTrue(expected.Equals(actual));
            Assert.IsTrue(expected.Equals(expected));

            Assert.IsTrue(classWithGeometry == deserializedClassWithGeometry);
            Assert.IsTrue(deserializedClassWithGeometry == classWithGeometry);

            Assert.AreEqual(actual.GetHashCode(), expected.GetHashCode());
        }
        public void Can_Serialize_And_Deserialize_Geometry_As_Object_Property(IGeometryObject geometry)
        {
            var classWithGeometry = new ClassWithGeometryProperty(geometry);

            var json = JsonConvert.SerializeObject(classWithGeometry);

            var deserializedClassWithGeometry = JsonConvert.DeserializeObject<ClassWithGeometryProperty>(json);

            Assert.AreEqual(classWithGeometry, deserializedClassWithGeometry);
        }
Beispiel #8
0
 private bool Equals(ClassWithGeometryProperty other)
 {
     return(Geometry.Equals(other.Geometry));
 }