Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r581725e1056b02305f9ec09bc8501882b23657bd --- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/DikeProfile.cs (.../DikeProfile.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) @@ -76,7 +76,7 @@ /// /// Gets the foreshore profile. /// - public ForeshoreProfile ForeshoreProfile { get; private set; } + public ForeshoreProfile ForeshoreProfile { get; } /// /// Gets the ID of the dike profile. @@ -243,16 +243,16 @@ private void CopyForeshoreProfileProperties(DikeProfile fromDikeProfile) { - ForeshoreProfile = new ForeshoreProfile(fromDikeProfile.WorldReferencePoint, - fromDikeProfile.ForeshoreGeometry, - fromDikeProfile.BreakWater, - new ForeshoreProfile.ConstructionProperties - { - Id = fromDikeProfile.Id, - Name = fromDikeProfile.Name, - Orientation = fromDikeProfile.Orientation, - X0 = fromDikeProfile.X0 - }); + ForeshoreProfile.CopyProperties(new ForeshoreProfile(fromDikeProfile.WorldReferencePoint, + fromDikeProfile.ForeshoreGeometry, + fromDikeProfile.BreakWater, + new ForeshoreProfile.ConstructionProperties + { + Id = fromDikeProfile.Id, + Name = fromDikeProfile.Name, + Orientation = fromDikeProfile.Orientation, + X0 = fromDikeProfile.X0 + })); } private bool Equals(DikeProfile other) @@ -269,13 +269,12 @@ throw new ArgumentNullException(nameof(points), Resources.DikeProfile_SetGeometry_Collection_of_points_for_geometry_is_null); } - RoughnessPoint[] roughnessPoints = points.ToArray(); - if (roughnessPoints.Any(p => p == null)) + if (points.Any(p => p == null)) { throw new ArgumentException(Resources.DikeProfile_SetGeometry_A_point_in_the_collection_is_null); } - DikeGeometry = roughnessPoints; + DikeGeometry = points.Select(p => new RoughnessPoint(p.Point, p.Roughness)).ToArray(); } private bool EqualDikeGeometry(RoughnessPoint[] otherPoints) Index: Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs =================================================================== diff -u -r3327c16cf8fc44952976b5505944226edf78fe1c -r581725e1056b02305f9ec09bc8501882b23657bd --- Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs (.../ForeshoreProfile.cs) (revision 3327c16cf8fc44952976b5505944226edf78fe1c) +++ Ringtoets/Common/src/Ringtoets.Common.Data/DikeProfiles/ForeshoreProfile.cs (.../ForeshoreProfile.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) @@ -147,8 +147,10 @@ X0 = fromForeshoreProfile.X0; Orientation = fromForeshoreProfile.Orientation; - BreakWater = fromForeshoreProfile.BreakWater; - WorldReferencePoint = fromForeshoreProfile.WorldReferencePoint; + BreakWater = fromForeshoreProfile.BreakWater != null + ? new BreakWater(fromForeshoreProfile.BreakWater.Type, fromForeshoreProfile.BreakWater.Height) + : null; + WorldReferencePoint = new Point2D(fromForeshoreProfile.WorldReferencePoint.X, fromForeshoreProfile.WorldReferencePoint.Y); SetGeometry(fromForeshoreProfile.Geometry); } @@ -219,7 +221,7 @@ throw new ArgumentException(Resources.ForeshoreProfile_SetGeometry_A_point_in_the_collection_is_null); } - Geometry = new RoundedPoint2DCollection(2, foreshorePoints); + Geometry = new RoundedPoint2DCollection(2, foreshorePoints.Select(p => new Point2D(p.X, p.Y))); } private bool EqualGeometry(Point2D[] otherGeometry) Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs =================================================================== diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r581725e1056b02305f9ec09bc8501882b23657bd --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -780,9 +781,19 @@ // Assert Assert.AreEqual(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint); + Assert.AreNotSame(expectedWorldReferencePoint, dikeProfileToUpdate.WorldReferencePoint); CollectionAssert.AreEqual(expectedForeshoreGeometry, dikeProfileToUpdate.ForeshoreGeometry); + for (var i = 0; i < expectedForeshoreGeometry.Length; i++) + { + Assert.AreNotSame(expectedForeshoreGeometry[i], dikeProfileToUpdate.ForeshoreGeometry.ElementAt(i)); + } CollectionAssert.AreEqual(expectedDikeGeometry, dikeProfileToUpdate.DikeGeometry); + for (var i = 0; i < expectedDikeGeometry.Length; i++) + { + Assert.AreNotSame(expectedDikeGeometry[i], dikeProfileToUpdate.DikeGeometry.ElementAt(i)); + } Assert.AreEqual(expectedBreakWater, dikeProfileToUpdate.BreakWater); + Assert.AreNotSame(expectedBreakWater, dikeProfileToUpdate.BreakWater); Assert.AreEqual(expectedId, dikeProfileToUpdate.Id); Assert.AreEqual(expectedName, dikeProfileToUpdate.Name); Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs =================================================================== diff -u -r3327c16cf8fc44952976b5505944226edf78fe1c -r581725e1056b02305f9ec09bc8501882b23657bd --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs (.../ForeshoreProfileTest.cs) (revision 3327c16cf8fc44952976b5505944226edf78fe1c) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/DikeProfiles/ForeshoreProfileTest.cs (.../ForeshoreProfileTest.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using System.Linq; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; @@ -653,9 +654,14 @@ // Assert Assert.AreEqual(expectedWorldReferencePoint, foreshoreProfileToUpdate.WorldReferencePoint); + Assert.AreNotSame(expectedWorldReferencePoint, foreshoreProfileToUpdate.WorldReferencePoint); CollectionAssert.AreEqual(expectedForeshoreGeometry, foreshoreProfileToUpdate.Geometry); + for (var i = 0; i < expectedForeshoreGeometry.Length; i++) + { + Assert.AreNotSame(expectedForeshoreGeometry[i], foreshoreProfileToUpdate.Geometry.ElementAt(i)); + } Assert.AreEqual(expectedBreakWater, foreshoreProfileToUpdate.BreakWater); - + Assert.AreNotSame(expectedBreakWater, foreshoreProfileToUpdate.BreakWater); Assert.AreEqual(expectedId, foreshoreProfileToUpdate.Id); Assert.AreEqual(expectedName, foreshoreProfileToUpdate.Name); Assert.AreEqual(expectedX0, foreshoreProfileToUpdate.X0); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r5c348ad608dfd7af011130adf085ed0cc8272730 -r581725e1056b02305f9ec09bc8501882b23657bd --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 5c348ad608dfd7af011130adf085ed0cc8272730) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 581725e1056b02305f9ec09bc8501882b23657bd) @@ -1151,12 +1151,10 @@ AssertAreEqualButNotSame(expectedSurfaceLine.ReferenceLineIntersectionWorldPoint, actualSurfaceLine.ReferenceLineIntersectionWorldPoint); CollectionAssert.AreEqual(expectedSurfaceLine.Points, actualSurfaceLine.Points); - for (var i = 0; i < expectedSurfaceLine.Points.Length; i++) { Assert.AreNotSame(expectedSurfaceLine.Points[i], actualSurfaceLine.Points[i]); } - AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder);