Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs =================================================================== diff -u -r5579d8fdef4f553fb4ba94160825ec960b89bab9 -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision 5579d8fdef4f553fb4ba94160825ec960b89bab9) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Primitives/RingtoetsMacroStabilityInwardsSurfaceLine.cs (.../RingtoetsMacroStabilityInwardsSurfaceLine.cs) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -30,7 +30,6 @@ using Ringtoets.Common.Data; using Ringtoets.MacroStabilityInwards.Primitives.Exceptions; using Ringtoets.MacroStabilityInwards.Primitives.Properties; - using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; namespace Ringtoets.MacroStabilityInwards.Primitives @@ -543,8 +542,31 @@ ? new Point2D(fromSurfaceLine.ReferenceLineIntersectionWorldPoint) : null; SetGeometry(fromSurfaceLine.Points); + SetCharacteristicPoints(fromSurfaceLine); } + private void SetCharacteristicPoints(RingtoetsMacroStabilityInwardsSurfaceLine fromSurfaceLine) + { + SurfaceLevelOutside = PointFromGeometryOrNull(fromSurfaceLine.SurfaceLevelOutside); + TrafficLoadOutside = PointFromGeometryOrNull(fromSurfaceLine.TrafficLoadOutside); + TrafficLoadInside = PointFromGeometryOrNull(fromSurfaceLine.TrafficLoadInside); + DikeToeAtPolder = PointFromGeometryOrNull(fromSurfaceLine.DikeToeAtPolder); + ShoulderBaseInside = PointFromGeometryOrNull(fromSurfaceLine.ShoulderBaseInside); + ShoulderTopInside = PointFromGeometryOrNull(fromSurfaceLine.ShoulderTopInside); + BottomDitchDikeSide = PointFromGeometryOrNull(fromSurfaceLine.BottomDitchDikeSide); + BottomDitchPolderSide = PointFromGeometryOrNull(fromSurfaceLine.BottomDitchPolderSide); + DikeToeAtPolder = PointFromGeometryOrNull(fromSurfaceLine.DikeToeAtPolder); + DikeToeAtRiver = PointFromGeometryOrNull(fromSurfaceLine.DikeToeAtRiver); + DitchDikeSide = PointFromGeometryOrNull(fromSurfaceLine.DitchDikeSide); + DitchPolderSide = PointFromGeometryOrNull(fromSurfaceLine.DitchPolderSide); + SurfaceLevelInside = PointFromGeometryOrNull(fromSurfaceLine.SurfaceLevelInside); + } + + private Point3D PointFromGeometryOrNull(Point3D point3D) + { + return point3D != null ? GetPointFromGeometry(point3D) : null; + } + public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) @@ -572,6 +594,20 @@ hashCode = (hashCode * 397) ^ point.GetHashCode(); } + hashCode = (hashCode * 397) ^ (SurfaceLevelInside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (SurfaceLevelOutside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (TrafficLoadInside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (TrafficLoadOutside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DikeTopAtPolder?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (ShoulderBaseInside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (ShoulderTopInside?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DikeToeAtPolder?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DikeToeAtRiver?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DitchDikeSide?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (DitchPolderSide?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (BottomDitchDikeSide?.GetHashCode() ?? 0); + hashCode = (hashCode * 397) ^ (BottomDitchPolderSide?.GetHashCode() ?? 0); + return hashCode; } } @@ -608,9 +644,27 @@ { return string.Equals(Name, other.Name) && Equals(ReferenceLineIntersectionWorldPoint, other.ReferenceLineIntersectionWorldPoint) - && EqualGeometricPoints(other.Points); + && EqualGeometricPoints(other.Points) + && EqualCharacteristicPoints(other); } + private bool EqualCharacteristicPoints(RingtoetsMacroStabilityInwardsSurfaceLine other) + { + return Equals(SurfaceLevelInside, other.SurfaceLevelInside) + && Equals(SurfaceLevelOutside, other.SurfaceLevelOutside) + && Equals(TrafficLoadInside, other.TrafficLoadInside) + && Equals(TrafficLoadOutside, other.TrafficLoadOutside) + && Equals(DikeTopAtPolder, other.DikeTopAtPolder) + && Equals(ShoulderBaseInside, other.ShoulderBaseInside) + && Equals(ShoulderTopInside, other.ShoulderTopInside) + && Equals(DikeToeAtPolder, other.DikeToeAtPolder) + && Equals(DikeToeAtRiver, other.DikeToeAtRiver) + && Equals(DitchDikeSide, other.DitchDikeSide) + && Equals(DitchPolderSide, other.DitchPolderSide) + && Equals(BottomDitchDikeSide, other.BottomDitchDikeSide) + && Equals(BottomDitchPolderSide, other.BottomDitchPolderSide); + } + private bool EqualGeometricPoints(Point3D[] otherPoints) { int nrOfOtherPoints = otherPoints.Length; Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingtoetsMacroStabilityInwardsSurfaceLinePropertiesTest.cs =================================================================== diff -u -r36089e883fc170498c85a840b883f786b96023d8 -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingtoetsMacroStabilityInwardsSurfaceLinePropertiesTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLinePropertiesTest.cs) (revision 36089e883fc170498c85a840b883f786b96023d8) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/RingtoetsMacroStabilityInwardsSurfaceLinePropertiesTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLinePropertiesTest.cs) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -49,7 +49,18 @@ // Setup const string expectedName = ""; var point1 = new Point3D(1.1, 2.2, 3.3); - var point2 = new Point3D(2.1, 2.2, 3.3); + var point2 = new Point3D(2.1, 2.3, 3.3); + var point3 = new Point3D(3.8, 2.4, 5.5); + var point4 = new Point3D(4.4, 2.5, 4.4); + var point5 = new Point3D(5.1, 2.6, 3.3); + var point6 = new Point3D(6.1, 2.7, 3.3); + var point7 = new Point3D(7.4, 2.8, 1.2); + var point8 = new Point3D(8.2, 2.9, 1.2); + var point9 = new Point3D(9.3, 3.2, 1.0); + var point10 = new Point3D(10.1, 3.5, 0.5); + var point11 = new Point3D(12.2, 3.8, 0.5); + var point12 = new Point3D(13.1, 4.2, 1.0); + var point13 = new Point3D(15.1, 5.6, 1.1); var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine { @@ -58,9 +69,34 @@ surfaceLine.SetGeometry(new[] { point1, - point2 + point2, + point3, + point4, + point5, + point6, + point7, + point8, + point9, + point10, + point11, + point12, + point13 }); + surfaceLine.SetSurfaceLevelOutsideAt(point1); + surfaceLine.SetDikeToeAtRiverAt(point2); + surfaceLine.SetDikeTopAtPolderAt(point3); + surfaceLine.SetShoulderBaseInsideAt(point4); + surfaceLine.SetTrafficLoadOutsideAt(point5); + surfaceLine.SetTrafficLoadInsideAt(point6); + surfaceLine.SetShoulderTopInsideAt(point7); + surfaceLine.SetDikeTopAtPolderAt(point8); + surfaceLine.SetDitchDikeSideAt(point9); + surfaceLine.SetBottomDitchDikeSideAt(point10); + surfaceLine.SetBottomDitchPolderSideAt(point11); + surfaceLine.SetDitchPolderSideAt(point12); + surfaceLine.SetSurfaceLevelInsideAt(point13); + var properties = new RingtoetsMacroStabilityInwardsSurfaceLineProperties { Data = surfaceLine @@ -69,6 +105,19 @@ // Call & Assert Assert.AreEqual(expectedName, properties.Name); CollectionAssert.AreEqual(surfaceLine.Points, properties.Points); + Assert.AreEqual(surfaceLine.SurfaceLevelOutside, properties.SurfaceLevelOutside); + Assert.AreEqual(surfaceLine.DikeToeAtRiver, properties.DikeToeAtRiver); + Assert.AreEqual(surfaceLine.DikeTopAtPolder, properties.DikeTopAtPolder); + Assert.AreEqual(surfaceLine.ShoulderBaseInside, properties.ShoulderBaseInside); + Assert.AreEqual(surfaceLine.TrafficLoadOutside, properties.TrafficLoadOutside); + Assert.AreEqual(surfaceLine.TrafficLoadInside, properties.TrafficLoadInside); + Assert.AreEqual(surfaceLine.ShoulderTopInside, properties.ShoulderTopInside); + Assert.AreEqual(surfaceLine.DikeTopAtPolder, properties.DikeTopAtPolder); + Assert.AreEqual(surfaceLine.DitchDikeSide, properties.DitchDikeSide); + Assert.AreEqual(surfaceLine.BottomDitchDikeSide, properties.BottomDitchDikeSide); + Assert.AreEqual(surfaceLine.BottomDitchPolderSide, properties.BottomDitchPolderSide); + Assert.AreEqual(surfaceLine.DitchPolderSide, properties.DitchPolderSide); + Assert.AreEqual(surfaceLine.SurfaceLevelInside, properties.SurfaceLevelInside); } [Test] Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj =================================================================== diff -u -r9caa7daa14d0070e2a3f68c4b9e66109318bd9ab -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision 9caa7daa14d0070e2a3f68c4b9e66109318bd9ab) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/Ringtoets.MacroStabilityInwards.Primitives.Test.csproj (.../Ringtoets.MacroStabilityInwards.Primitives.Test.csproj) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -71,6 +71,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs =================================================================== diff -u -r9caa7daa14d0070e2a3f68c4b9e66109318bd9ab -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineTest.cs) (revision 9caa7daa14d0070e2a3f68c4b9e66109318bd9ab) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Primitives.Test/RingtoetsMacroStabilityInwardsSurfaceLineTest.cs (.../RingtoetsMacroStabilityInwardsSurfaceLineTest.cs) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -26,6 +26,7 @@ using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Ringtoets.Common.Data.TestUtil; using Ringtoets.MacroStabilityInwards.Primitives.Exceptions; @@ -949,6 +950,240 @@ } [Test] + public void Equals_DifferentSurfaceLevelInside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetSurfaceLevelInsideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentTrafficLoadInside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetTrafficLoadInsideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentTrafficLoadOutside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetTrafficLoadOutsideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentDikeTopAtPolder_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDikeTopAtPolderAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentShoulderBaseInside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetShoulderBaseInsideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentShoulderTopInside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetShoulderTopInsideAt(points[7]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentSurfaceLevelOutside_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetSurfaceLevelOutsideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentBottomDitchDikeSide_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetBottomDitchDikeSideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentBottomDitchPolderSide_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetBottomDitchPolderSideAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentDikeToeAtPolder_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDikeToeAtPolderAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentDikeToeAtRiver_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDikeToeAtRiverAt(points[5]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentDitchDikeSide_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDitchDikeSideAt(points[1]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] + public void Equals_DifferentDitchPolderSide_ReturnsFalse() + { + // Setup + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineOne = CreateSurfaceLineWithCharacteristicPoints(); + RingtoetsMacroStabilityInwardsSurfaceLine surfaceLineTwo = CreateSurfaceLineWithCharacteristicPoints(); + Point3D[] points = surfaceLineTwo.Points.ToArray(); + surfaceLineTwo.SetDitchPolderSideAt(points[1]); + + // Call + bool isLineOneEqualToLineTwo = surfaceLineOne.Equals(surfaceLineTwo); + bool isLineTwoEqualToLineOne = surfaceLineTwo.Equals(surfaceLineOne); + + // Assert + Assert.IsFalse(isLineOneEqualToLineTwo); + Assert.IsFalse(isLineTwoEqualToLineOne); + } + + [Test] public void Equals_NamesGeometriesAndReferenceLineIntersectionWorldPointAndCharacteristicPointsEqual_ReturnsTrue() { // Setup @@ -1006,8 +1241,32 @@ actualSurfaceLine.ReferenceLineIntersectionWorldPoint); CollectionAssert.AreEqual(expectedSurfaceLine.Points, actualSurfaceLine.Points); TestHelper.AssertCollectionAreNotSame(expectedSurfaceLine.Points, actualSurfaceLine.Points); + + Point3D[] actualSurfaceLinePoints = actualSurfaceLine.Points; + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.SurfaceLevelOutside, actualSurfaceLine.SurfaceLevelOutside); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.TrafficLoadOutside, actualSurfaceLine.TrafficLoadOutside); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.TrafficLoadInside, actualSurfaceLine.TrafficLoadInside); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DikeTopAtPolder, actualSurfaceLine.DikeTopAtPolder); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.ShoulderBaseInside, actualSurfaceLine.ShoulderBaseInside); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.ShoulderTopInside, actualSurfaceLine.ShoulderTopInside); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.SurfaceLevelInside, actualSurfaceLine.SurfaceLevelInside); } + private static void AssertAreEqualAndFromSurfaceLine(Point3D[] actualSurfaceLinePoints, Point3D expectedPoint, Point3D actualPoint) + { + Assert.AreEqual(expectedPoint, actualPoint); + if (actualPoint != null) + { + Assert.IsTrue(actualSurfaceLinePoints.Contains(actualPoint, new ReferenceEqualityComparer())); + } + } + private static RingtoetsMacroStabilityInwardsSurfaceLine CreateSurfaceLineWithCharacteristicPoints() { var surfaceLine = new RingtoetsMacroStabilityInwardsSurfaceLine @@ -1022,10 +1281,31 @@ new Point3D(2, 0, 3), new Point3D(3, 0, 0), new Point3D(4, 0, 2), - new Point3D(5, 0, 3) + new Point3D(5, 0, 3), + new Point3D(6, 0, 4), + new Point3D(7, 0, 5), + new Point3D(8, 0, 5), + new Point3D(9, 0, 4), + new Point3D(10, 0, 3), + new Point3D(11, 0, 2), + new Point3D(12, 0, 1) }; surfaceLine.SetGeometry(geometry); + surfaceLine.SetSurfaceLevelOutsideAt(geometry[0]); + surfaceLine.SetTrafficLoadOutsideAt(geometry[1]); + surfaceLine.SetTrafficLoadInsideAt(geometry[2]); + surfaceLine.SetDikeToeAtPolderAt(geometry[3]); + surfaceLine.SetShoulderBaseInsideAt(geometry[4]); + surfaceLine.SetShoulderTopInsideAt(geometry[5]); + surfaceLine.SetBottomDitchDikeSideAt(geometry[6]); + surfaceLine.SetBottomDitchPolderSideAt(geometry[7]); + surfaceLine.SetDikeToeAtPolderAt(geometry[8]); + surfaceLine.SetDikeToeAtRiverAt(geometry[9]); + surfaceLine.SetDitchDikeSideAt(geometry[10]); + surfaceLine.SetDitchPolderSideAt(geometry[11]); + surfaceLine.SetSurfaceLevelInsideAt(geometry[12]); + return surfaceLine; } Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj =================================================================== diff -u -r9caa7daa14d0070e2a3f68c4b9e66109318bd9ab -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj (.../Ringtoets.Piping.Primitives.Test.csproj) (revision 9caa7daa14d0070e2a3f68c4b9e66109318bd9ab) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/Ringtoets.Piping.Primitives.Test.csproj (.../Ringtoets.Piping.Primitives.Test.csproj) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -70,6 +70,10 @@ {3BBFD65B-B277-4E50-AE6D-BD24C3434609} Core.Common.Base + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + {D749EE4C-CE50-4C17-BF01-9A953028C126} Core.Common.TestUtil Index: Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/RingtoetsPipingSurfaceLineTest.cs =================================================================== diff -u -r9caa7daa14d0070e2a3f68c4b9e66109318bd9ab -re6106ea248df5d48159b78e37bb533856d2ebce7 --- Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision 9caa7daa14d0070e2a3f68c4b9e66109318bd9ab) +++ Ringtoets/Piping/test/Ringtoets.Piping.Primitives.Test/RingtoetsPipingSurfaceLineTest.cs (.../RingtoetsPipingSurfaceLineTest.cs) (revision e6106ea248df5d48159b78e37bb533856d2ebce7) @@ -26,6 +26,7 @@ using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Ringtoets.Piping.Primitives.Exceptions; @@ -953,12 +954,23 @@ actualSurfaceLine.ReferenceLineIntersectionWorldPoint); CollectionAssert.AreEqual(expectedSurfaceLine.Points, actualSurfaceLine.Points); TestHelper.AssertCollectionAreNotSame(expectedSurfaceLine.Points, actualSurfaceLine.Points); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); - TestHelper.AssertAreEqualButNotSame(expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); + + Point3D[] actualSurfaceLinePoints = actualSurfaceLine.Points; + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.BottomDitchDikeSide, actualSurfaceLine.BottomDitchDikeSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.BottomDitchPolderSide, actualSurfaceLine.BottomDitchPolderSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DikeToeAtPolder, actualSurfaceLine.DikeToeAtPolder); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DikeToeAtRiver, actualSurfaceLine.DikeToeAtRiver); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DitchPolderSide, actualSurfaceLine.DitchPolderSide); + AssertAreEqualAndFromSurfaceLine(actualSurfaceLinePoints, expectedSurfaceLine.DitchDikeSide, actualSurfaceLine.DitchDikeSide); } + + private static void AssertAreEqualAndFromSurfaceLine(Point3D[] actualSurfaceLinePoints, Point3D expectedPoint, Point3D actualPoint) + { + Assert.AreEqual(expectedPoint, actualPoint); + if (actualPoint != null) + { + Assert.IsTrue(actualSurfaceLinePoints.Contains(actualPoint, new ReferenceEqualityComparer())); + } + } } } \ No newline at end of file