Index: Core/Common/src/Core.Common.Base/Geometry/Point2D.cs
===================================================================
diff -u -rb25480536a8c434ef900066c8601480fc0959d1c -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c)
+++ Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -30,7 +30,7 @@
///
/// Defines a mathematical, immutable point in 2D Euclidean space.
///
- public sealed class Point2D
+ public sealed class Point2D : ICloneable
{
///
/// Creates a new instance of , with set to
@@ -194,5 +194,10 @@
{
return X.Equals(other.X) && Y.Equals(other.Y);
}
+
+ public object Clone()
+ {
+ return MemberwiseClone();
+ }
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj
===================================================================
diff -u -r07f3d67fe9512b3c8303ff09398b0a234900d546 -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 07f3d67fe9512b3c8303ff09398b0a234900d546)
+++ Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -118,6 +118,10 @@
{3bbfd65b-b277-4e50-ae6d-bd24c3434609}Core.Common.Base
+
+ {8E2FAB92-51AA-47B0-B18A-9AC0455EF77D}
+ Core.Common.Base.TestUtil
+ {0B0D2DFF-7E7E-4BB0-A007-61800C85809A}Core.Common.Data.TestUtil
Index: Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs
===================================================================
diff -u -r01bd90d4fab9699280c5619754fc55b4f03be08a -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 01bd90d4fab9699280c5619754fc55b4f03be08a)
+++ Core/Common/test/Core.Common.Base.Test/Geometry/Math2DTest.cs (.../Math2DTest.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -26,6 +26,7 @@
using System.Linq;
using Core.Common.Base.Geometry;
using Core.Common.Base.Properties;
+using Core.Common.Base.TestUtil.Geometry;
using Core.Common.TestUtil;
using NUnit.Framework;
Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs
===================================================================
diff -u -rb25480536a8c434ef900066c8601480fc0959d1c -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c)
+++ Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -21,6 +21,8 @@
using System;
using Core.Common.Base.Geometry;
+using Core.Common.Base.TestUtil.Geometry;
+using Core.Common.Data.TestUtil;
using Core.Common.TestUtil;
using MathNet.Numerics.LinearAlgebra;
using MathNet.Numerics.LinearAlgebra.Double;
@@ -43,6 +45,8 @@
var point = new Point2D(x, y);
// Assert
+ Assert.IsInstanceOf(point);
+
Assert.AreEqual(x, point.X);
Assert.AreEqual(y, point.Y);
}
@@ -389,6 +393,22 @@
Assert.AreEqual(euclideanDistance2, euclideanDistance1);
}
+ [Test]
+ public void Clone_Always_ReturnNewInstanceWithCopiedValues()
+ {
+ // Setup
+ var random = new Random(22);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ var original = new Point2D(x, y);
+
+ // Call
+ object clone = original.Clone();
+
+ // Assert
+ CoreCloneAssert.AreObjectClones(original, clone, GeometryCloneAssert.AreClones);
+ }
+
private static void DoToString_HasCoordinateValues_PrintCoordinateValuesInLocalCulture()
{
// Setup
Index: Core/Common/test/Core.Common.Base.TestUtil/Core.Common.Base.TestUtil.csproj
===================================================================
diff -u -r4840075b1266d759456ee0bc4a0d561e428cf5f1 -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.Base.TestUtil/Core.Common.Base.TestUtil.csproj (.../Core.Common.Base.TestUtil.csproj) (revision 4840075b1266d759456ee0bc4a0d561e428cf5f1)
+++ Core/Common/test/Core.Common.Base.TestUtil/Core.Common.Base.TestUtil.csproj (.../Core.Common.Base.TestUtil.csproj) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -50,6 +50,7 @@
Properties\GlobalAssembly.cs
+
Index: Core/Common/test/Core.Common.Base.TestUtil/Geometry/GeometryCloneAssert.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.Base.TestUtil/Geometry/GeometryCloneAssert.cs (revision 0)
+++ Core/Common/test/Core.Common.Base.TestUtil/Geometry/GeometryCloneAssert.cs (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -0,0 +1,46 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+
+namespace Core.Common.Base.TestUtil.Geometry
+{
+ ///
+ /// Class that defines methods for asserting whether two objects are clones.
+ ///
+ public static class GeometryCloneAssert
+ {
+ ///
+ /// Method that asserts whether and
+ /// are clones.
+ ///
+ /// The original object.
+ /// The cloned object.
+ /// Thrown when and
+ /// are not clones.
+ public static void AreClones(Point2D original, Point2D clone)
+ {
+ Assert.AreEqual(original.X, clone.X);
+ Assert.AreEqual(original.Y, clone.Y);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj
===================================================================
diff -u -ra1fa1538918813373bcc864f0bce092bf28fd0ce -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision a1fa1538918813373bcc864f0bce092bf28fd0ce)
+++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -99,6 +99,10 @@
{f49bd8b2-332a-4c91-a196-8cce0a2c7d98}Core.Common.Utils
+
+ {8E2FAB92-51AA-47B0-B18A-9AC0455EF77D}
+ Core.Common.Base.TestUtil
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}Core.Common.TestUtil
Index: Core/Common/test/Core.Common.TestUtil.Test/Point2DComparerWithToleranceTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Common/test/Core.Common.TestUtil.Test/Point2DComparerWithToleranceTest.cs (.../Point2DComparerWithToleranceTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Common/test/Core.Common.TestUtil.Test/Point2DComparerWithToleranceTest.cs (.../Point2DComparerWithToleranceTest.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -20,6 +20,7 @@
// All rights reserved.
using Core.Common.Base.Geometry;
+using Core.Common.Base.TestUtil.Geometry;
using NUnit.Framework;
namespace Core.Common.TestUtil.Test
Index: Core/Components/test/Core.Components.Gis.IO.Test/Core.Components.Gis.IO.Test.csproj
===================================================================
diff -u -ra1fa1538918813373bcc864f0bce092bf28fd0ce -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Components/test/Core.Components.Gis.IO.Test/Core.Components.Gis.IO.Test.csproj (.../Core.Components.Gis.IO.Test.csproj) (revision a1fa1538918813373bcc864f0bce092bf28fd0ce)
+++ Core/Components/test/Core.Components.Gis.IO.Test/Core.Components.Gis.IO.Test.csproj (.../Core.Components.Gis.IO.Test.csproj) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -79,6 +79,10 @@
{e344867e-9ac9-44c8-88a5-8185681679a9}Core.Common.IO
+
+ {8E2FAB92-51AA-47B0-B18A-9AC0455EF77D}
+ Core.Common.Base.TestUtil
+ {d749ee4c-ce50-4c17-bf01-9a953028c126}Core.Common.TestUtil
Index: Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs
===================================================================
diff -u -r67284323e2785c651633d9c52049ba12a9c70e6a -r354316fca628a0f9dcdee5ff156ae4d87e662677
--- Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs (.../PolygonShapeFileReaderTest.cs) (revision 67284323e2785c651633d9c52049ba12a9c70e6a)
+++ Core/Components/test/Core.Components.Gis.IO.Test/Readers/PolygonShapeFileReaderTest.cs (.../PolygonShapeFileReaderTest.cs) (revision 354316fca628a0f9dcdee5ff156ae4d87e662677)
@@ -24,6 +24,7 @@
using System.Linq;
using Core.Common.Base.Geometry;
using Core.Common.Base.IO;
+using Core.Common.Base.TestUtil.Geometry;
using Core.Common.TestUtil;
using Core.Components.Gis.Data;
using Core.Components.Gis.Features;