Index: DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.LayerCreator.Tests/LayerCreatorTests.cs =================================================================== diff -u -r3184 -r3185 --- DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.LayerCreator.Tests/LayerCreatorTests.cs (.../LayerCreatorTests.cs) (revision 3184) +++ DamTools/LayerOnSlopeTool/trunk/src/Deltares.LayerOnSlopeTool.LayerCreator.Tests/LayerCreatorTests.cs (.../LayerCreatorTests.cs) (revision 3185) @@ -112,220 +112,5 @@ Assert.IsTrue(lines[0].Contains("Handling location")); } - [Test] - public void TestDetermineLoweredSurfaceLineForGivenLayerThickness() - { - var originalSurfaceLine = CreateSimpleStraightSurfaceLine(); - var loweredSurfaceLine = originalSurfaceLine.CreateLoweredSurfaceLineForGivenLayerThickness(1); - Assert.AreEqual(11,loweredSurfaceLine.SurfaceLinePoints.Count); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[0].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[0].ZCoordinate, Diff); - Assert.AreEqual(5, loweredSurfaceLine.SurfaceLinePoints[1].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[1].ZCoordinate, Diff); - Assert.AreEqual(10, loweredSurfaceLine.SurfaceLinePoints[2].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[2].ZCoordinate, Diff); - Assert.AreEqual(12, loweredSurfaceLine.SurfaceLinePoints[3].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[3].ZCoordinate, Diff); - Assert.AreEqual(14, loweredSurfaceLine.SurfaceLinePoints[4].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[4].ZCoordinate, Diff); - Assert.AreEqual(14.01, loweredSurfaceLine.SurfaceLinePoints[5].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[5].ZCoordinate, Diff); - Assert.AreEqual(15, loweredSurfaceLine.SurfaceLinePoints[6].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[6].ZCoordinate, Diff); - Assert.AreEqual(15.99, loweredSurfaceLine.SurfaceLinePoints[7].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[7].ZCoordinate, Diff); - Assert.AreEqual(16, loweredSurfaceLine.SurfaceLinePoints[8].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[8].ZCoordinate, Diff); - Assert.AreEqual(22, loweredSurfaceLine.SurfaceLinePoints[9].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[9].ZCoordinate, Diff); - Assert.AreEqual(30, loweredSurfaceLine.SurfaceLinePoints[10].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[10].ZCoordinate, Diff); - - } - - [Test] - public void TestDetermineLoweredSurfaceLineForGivenLayerThicknessWithAckwardPoints() - { - var originalSurfaceLine = CreateSimpleStraightSurfaceLineWithAckwardPoints(); - var loweredSurfaceLine = originalSurfaceLine.CreateLoweredSurfaceLineForGivenLayerThickness(1); - Assert.AreEqual(11, loweredSurfaceLine.SurfaceLinePoints.Count); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[0].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[0].ZCoordinate, Diff); - Assert.AreEqual(5, loweredSurfaceLine.SurfaceLinePoints[1].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[1].ZCoordinate, Diff); - Assert.AreEqual(10, loweredSurfaceLine.SurfaceLinePoints[2].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[2].ZCoordinate, Diff); - Assert.AreEqual(12, loweredSurfaceLine.SurfaceLinePoints[3].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[3].ZCoordinate, Diff); - Assert.AreEqual(14, loweredSurfaceLine.SurfaceLinePoints[4].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[4].ZCoordinate, Diff); - Assert.AreEqual(14.01, loweredSurfaceLine.SurfaceLinePoints[5].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[5].ZCoordinate, Diff); - Assert.AreEqual(15.5, loweredSurfaceLine.SurfaceLinePoints[6].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[6].ZCoordinate, Diff); - Assert.AreEqual(15.99, loweredSurfaceLine.SurfaceLinePoints[7].XCoordinate, Diff); - Assert.AreEqual(-1, loweredSurfaceLine.SurfaceLinePoints[7].ZCoordinate, Diff); - Assert.AreEqual(16, loweredSurfaceLine.SurfaceLinePoints[8].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[8].ZCoordinate, Diff); - Assert.AreEqual(22, loweredSurfaceLine.SurfaceLinePoints[9].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[9].ZCoordinate, Diff); - Assert.AreEqual(30, loweredSurfaceLine.SurfaceLinePoints[10].XCoordinate, Diff); - Assert.AreEqual(0, loweredSurfaceLine.SurfaceLinePoints[10].ZCoordinate, Diff); - - } - private SurfaceLine CreateSimpleStraightSurfaceLine() - { - var surfaceLine = new SurfaceLine(); - surfaceLine.SurfaceLineId = "SimpleStraightSurfaceLine"; - var point = new SurfaceLinePoint - { - XCoordinate = 0, ZCoordinate = 0, PointType = CharacteristicPointType.SurfaceLevelOutside - }; - surfaceLine.SurfaceLinePoints.Add(point); - var pointA = new SurfaceLinePoint - { - XCoordinate = 5, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(pointA); - var point1 = new SurfaceLinePoint - { - XCoordinate = 10, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeToeAtRiver - }; - surfaceLine.SurfaceLinePoints.Add(point1); - var point2 = new SurfaceLinePoint - { - XCoordinate = 12, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeTopAtRiver - }; - surfaceLine.SurfaceLinePoints.Add(point2); - var point3 = new SurfaceLinePoint - { - XCoordinate = 14, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeTopAtPolder - }; - surfaceLine.SurfaceLinePoints.Add(point3); - var point3A = new SurfaceLinePoint - { - XCoordinate = 15, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point3A); - var point4 = new SurfaceLinePoint - { - XCoordinate = 16, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeToeAtPolder - }; - surfaceLine.SurfaceLinePoints.Add(point4); - var point4A = new SurfaceLinePoint - { - XCoordinate = 22, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point4A); - var point5 = new SurfaceLinePoint - { - XCoordinate = 30, - ZCoordinate = 0, - PointType = CharacteristicPointType.SurfaceLevelInside - }; - surfaceLine.SurfaceLinePoints.Add(point5); - return surfaceLine; - } - - private SurfaceLine CreateSimpleStraightSurfaceLineWithAckwardPoints() - { - var surfaceLine = new SurfaceLine(); - surfaceLine.SurfaceLineId = "SimpleStraightSurfaceLine"; - var point = new SurfaceLinePoint - { - XCoordinate = 0, - ZCoordinate = 0, - PointType = CharacteristicPointType.SurfaceLevelOutside - }; - surfaceLine.SurfaceLinePoints.Add(point); - var pointA = new SurfaceLinePoint - { - XCoordinate = 5, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(pointA); - var point1 = new SurfaceLinePoint - { - XCoordinate = 10, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeToeAtRiver - }; - surfaceLine.SurfaceLinePoints.Add(point1); - var point2 = new SurfaceLinePoint - { - XCoordinate = 12, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeTopAtRiver - }; - surfaceLine.SurfaceLinePoints.Add(point2); - var point3 = new SurfaceLinePoint - { - XCoordinate = 14, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeTopAtPolder - }; - surfaceLine.SurfaceLinePoints.Add(point3); - var point3A = new SurfaceLinePoint - { - // is less than 0.01 meter beyond the point that is to be lowered with offset of 0.01 m. So this point should NOT be found in the lowered line - XCoordinate = 14.001, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point3A); - var point3B = new SurfaceLinePoint - { - // make this 15.5 instead of 15 to be different from ordinary SimpleStraightSurfaceLine. - XCoordinate = 15.5, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point3B); - var point3C = new SurfaceLinePoint - { - // is less than 0.01 meter in front off the point that is to be lowered with offset of -0.01 m. So this point should NOT be found in the lowered line - XCoordinate = 15.999, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point3C); - var point4 = new SurfaceLinePoint - { - XCoordinate = 16, - ZCoordinate = 0, - PointType = CharacteristicPointType.DikeToeAtPolder - }; - surfaceLine.SurfaceLinePoints.Add(point4); - var point4A = new SurfaceLinePoint - { - XCoordinate = 22, - ZCoordinate = 0, - PointType = CharacteristicPointType.None - }; - surfaceLine.SurfaceLinePoints.Add(point4A); - var point5 = new SurfaceLinePoint - { - XCoordinate = 30, - ZCoordinate = 0, - PointType = CharacteristicPointType.SurfaceLevelInside - }; - surfaceLine.SurfaceLinePoints.Add(point5); - return surfaceLine; - } } } \ No newline at end of file