Index: Core/Common/src/Core.Common.Base/Geometry/Point2D.cs =================================================================== diff -u -r4b8ab1201eba50035392ce074fa1cc5da25ff4a7 -rb25480536a8c434ef900066c8601480fc0959d1c --- Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision 4b8ab1201eba50035392ce074fa1cc5da25ff4a7) +++ Core/Common/src/Core.Common.Base/Geometry/Point2D.cs (.../Point2D.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c) @@ -49,8 +49,18 @@ /// taken from . /// /// The to take the properties from. - public Point2D(Point2D point) : this(point.X, point.Y) {} + /// Thrown when is null. + public Point2D(Point2D point) + { + if (point == null) + { + throw new ArgumentNullException(nameof(point)); + } + X = point.X; + Y = point.Y; + } + /// /// Gets or sets the x coordinate. /// Index: Core/Common/src/Core.Common.Base/Geometry/Point3D.cs =================================================================== diff -u -r4b8ab1201eba50035392ce074fa1cc5da25ff4a7 -rb25480536a8c434ef900066c8601480fc0959d1c --- Core/Common/src/Core.Common.Base/Geometry/Point3D.cs (.../Point3D.cs) (revision 4b8ab1201eba50035392ce074fa1cc5da25ff4a7) +++ Core/Common/src/Core.Common.Base/Geometry/Point3D.cs (.../Point3D.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Globalization; namespace Core.Common.Base.Geometry @@ -46,8 +47,19 @@ /// and taken from . /// /// The to take the properties from. - public Point3D(Point3D point) : this(point.X, point.Y, point.Z) {} + /// Thrown when is null. + public Point3D(Point3D point) + { + if (point == null) + { + throw new ArgumentNullException(nameof(point)); + } + X = point.X; + Y = point.Y; + Z = point.Z; + } + /// /// Gets or sets the x coordinate. /// Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs =================================================================== diff -u -r72100b160a77aa268c4cb3aca0124473fc924c70 -rb25480536a8c434ef900066c8601480fc0959d1c --- Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision 72100b160a77aa268c4cb3aca0124473fc924c70) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Point2DTest.cs (.../Point2DTest.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c) @@ -48,6 +48,17 @@ } [Test] + public void CopyConstructor_PointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new Point2D(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("point", paramName); + } + + [Test] public void CopyConstructor_WithPointWithXandY_SetProperties() { // Setup Index: Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs =================================================================== diff -u -r72100b160a77aa268c4cb3aca0124473fc924c70 -rb25480536a8c434ef900066c8601480fc0959d1c --- Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs (.../Point3DTest.cs) (revision 72100b160a77aa268c4cb3aca0124473fc924c70) +++ Core/Common/test/Core.Common.Base.Test/Geometry/Point3DTest.cs (.../Point3DTest.cs) (revision b25480536a8c434ef900066c8601480fc0959d1c) @@ -46,6 +46,17 @@ } [Test] + public void CopyConstructor_PointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new Point3D(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("point", paramName); + } + + [Test] public void CopyConstructor_WithPointWithXandY_SetProperties() { // Setup