Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/StructureBaseTest.cs =================================================================== diff -u -r9ff0a37a156186137dbaf5a4d43bc0fab10de1f0 -r5c348ad608dfd7af011130adf085ed0cc8272730 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/StructureBaseTest.cs (.../StructureBaseTest.cs) (revision 9ff0a37a156186137dbaf5a4d43bc0fab10de1f0) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/StructureBaseTest.cs (.../StructureBaseTest.cs) (revision 5c348ad608dfd7af011130adf085ed0cc8272730) @@ -221,10 +221,8 @@ Assert.AreNotEqual(otherStructure.Id, structure.Id); Assert.AreEqual(otherStructure.Name, structure.Name); Assert.AreEqual(otherStructure.Location, structure.Location); - Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation); - Assert.AreNotSame(otherStructure.Location, structure.Location); - Assert.AreNotSame(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation); + Assert.AreEqual(otherStructure.StructureNormalOrientation, structure.StructureNormalOrientation); } [Test] Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs =================================================================== diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r5c348ad608dfd7af011130adf085ed0cc8272730 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 5c348ad608dfd7af011130adf085ed0cc8272730) @@ -132,7 +132,7 @@ { throw new ArgumentException(Resources.RingtoetsPipingSurfaceLine_A_point_in_the_collection_was_null); } - Points = points.ToArray(); + Points = points.Select(p => new Point3D(p.X, p.Y, p.Z)).ToArray(); if (Points.Length > 0) { @@ -368,7 +368,8 @@ } Name = fromSurfaceLine.Name; - ReferenceLineIntersectionWorldPoint = fromSurfaceLine.ReferenceLineIntersectionWorldPoint; + ReferenceLineIntersectionWorldPoint = new Point2D(fromSurfaceLine.ReferenceLineIntersectionWorldPoint.X, + fromSurfaceLine.ReferenceLineIntersectionWorldPoint.Y); SetGeometry(fromSurfaceLine.Points); ClearCharacteristicPoints(); SetCharacteristicPoints(fromSurfaceLine); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r5c348ad608dfd7af011130adf085ed0cc8272730 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 5c348ad608dfd7af011130adf085ed0cc8272730) @@ -102,8 +102,8 @@ // Assert Assert.AreNotSame(sourceData, surfaceLine.Points); CollectionAssert.AreEqual(sourceData, surfaceLine.Points); - Assert.AreSame(sourceData[0], surfaceLine.StartingWorldPoint); - Assert.AreSame(sourceData[0], surfaceLine.EndingWorldPoint); + Assert.AreEqual(sourceData[0], surfaceLine.StartingWorldPoint); + Assert.AreEqual(sourceData[0], surfaceLine.EndingWorldPoint); } [Test] @@ -126,8 +126,8 @@ // Assert Assert.AreNotSame(sourceData, surfaceLine.Points); CollectionAssert.AreEqual(sourceData, surfaceLine.Points); - Assert.AreSame(sourceData[0], surfaceLine.StartingWorldPoint); - Assert.AreSame(sourceData[3], surfaceLine.EndingWorldPoint); + Assert.AreEqual(sourceData[0], surfaceLine.StartingWorldPoint); + Assert.AreEqual(sourceData[3], surfaceLine.EndingWorldPoint); } [Test] @@ -761,11 +761,7 @@ surfaceLine.CopyProperties(surfaceLineToUpdateFrom); // Assert - Assert.AreEqual(surfaceLineToUpdateFrom.Name, surfaceLine.Name); - Assert.AreEqual(surfaceLineToUpdateFrom.ReferenceLineIntersectionWorldPoint, - surfaceLine.ReferenceLineIntersectionWorldPoint); - CollectionAssert.AreEqual(expectedGeometry, surfaceLine.Points); - AssertCharacteristicPoints(surfaceLineToUpdateFrom, surfaceLine); + AssertPropertiesUpdated(surfaceLineToUpdateFrom, surfaceLine); } [Test] @@ -784,11 +780,7 @@ surfaceLine.CopyProperties(surfaceLineToUpdateFrom); // Assert - Assert.AreEqual(surfaceLineToUpdateFrom.Name, surfaceLine.Name); - Assert.AreEqual(surfaceLineToUpdateFrom.ReferenceLineIntersectionWorldPoint, - surfaceLine.ReferenceLineIntersectionWorldPoint); - CollectionAssert.AreEqual(surfaceLineToUpdateFrom.Points, surfaceLine.Points); - AssertCharacteristicPoints(surfaceLineToUpdateFrom, surfaceLine); + AssertPropertiesUpdated(surfaceLineToUpdateFrom, surfaceLine); } [Test] @@ -805,10 +797,7 @@ surfaceLine.CopyProperties(surfaceLineToUpdateFrom); // Assert - Assert.AreEqual(surfaceLineToUpdateFrom.Name, surfaceLine.Name); - Assert.AreEqual(expectedIntersectionPoint, surfaceLine.ReferenceLineIntersectionWorldPoint); - CollectionAssert.AreEqual(surfaceLineToUpdateFrom.Points, surfaceLine.Points); - AssertCharacteristicPoints(surfaceLineToUpdateFrom, surfaceLine); + AssertPropertiesUpdated(surfaceLineToUpdateFrom, surfaceLine); } [Test] @@ -822,11 +811,7 @@ surfaceLine.CopyProperties(surfaceLineToUpdateFrom); // Assert - Assert.AreEqual(surfaceLineToUpdateFrom.Name, surfaceLine.Name); - Assert.AreEqual(surfaceLineToUpdateFrom.ReferenceLineIntersectionWorldPoint, - surfaceLine.ReferenceLineIntersectionWorldPoint); - CollectionAssert.AreEqual(surfaceLineToUpdateFrom.Points, surfaceLine.Points); - AssertCharacteristicPoints(surfaceLineToUpdateFrom, surfaceLine); + AssertPropertiesUpdated(surfaceLineToUpdateFrom, surfaceLine); } [Test] @@ -1148,16 +1133,6 @@ return surfaceLine; } - private static void AssertCharacteristicPoints(RingtoetsPipingSurfaceLine expectedSurfaceLine, RingtoetsPipingSurfaceLine actualSurfaceLine) - { - Assert.AreEqual(expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); - Assert.AreEqual(expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); - Assert.AreEqual(expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); - Assert.AreEqual(expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); - Assert.AreEqual(expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); - Assert.AreEqual(expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); - } - private static void CreateTestGeometry(Point3D testPoint, RingtoetsPipingSurfaceLine surfaceLine) { var random = new Random(21); @@ -1169,5 +1144,35 @@ }; surfaceLine.SetGeometry(points); } + + private static void AssertPropertiesUpdated(RingtoetsPipingSurfaceLine expectedSurfaceLine, RingtoetsPipingSurfaceLine actualSurfaceLine) + { + Assert.AreEqual(expectedSurfaceLine.Name, actualSurfaceLine.Name); + 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); + AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); + AssertAreEqualButNotSame(expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); + AssertAreEqualButNotSame(expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); + } + + private static void AssertAreEqualButNotSame(object expected, object actual) + { + Assert.AreEqual(expected, actual, "Objects not equal"); + + if (expected != null) + { + Assert.AreNotSame(expected, actual, "Objects the same"); + } + } } } \ No newline at end of file