Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismViewTest.cs (.../ClosingStructuresFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -246,10 +246,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(8, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData( @@ -422,14 +422,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -460,8 +460,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -780,21 +780,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -831,22 +816,6 @@ Assert.AreEqual("Kunstwerken", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable> calculations, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/FailureMechanismViewTest.cs (.../FailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -206,10 +206,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(5, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); } } @@ -378,14 +378,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -416,8 +416,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -529,37 +529,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertEmptyMapData(MapDataCollection mapDataCollection) { Assert.AreEqual("Test failure mechanism", mapDataCollection.Name); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs =================================================================== diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs (.../MapDataTestHelperTest.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/MapDataTestHelperTest.cs (.../MapDataTestHelperTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -25,6 +25,7 @@ using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -39,7 +40,7 @@ public void AssertFailureMechanismSectionsMapData_MapDataNotMapLineData_ThrowAssertionException() { // Setup - var mapData = new MapPointData("test"); + var mapData = new MapPointData("Vakindeling"); // Call TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsMapData(Enumerable.Empty(), mapData); @@ -60,7 +61,7 @@ }) }; - var mapData = new MapLineData("test"); + var mapData = new MapLineData("Vakindeling"); // Precondition CollectionAssert.IsEmpty(mapData.Features); @@ -86,7 +87,7 @@ }) }; - var mapData = new MapLineData("test") + var mapData = new MapLineData("Vakindeling") { Features = new[] { @@ -193,7 +194,7 @@ public void AssertHydraulicBoundaryLocationsMapData_MapDataNotPointData_ThrowAssertionException() { // Setup - var mapData = new MapLineData("test"); + var mapData = new MapLineData("Hydraulische randvoorwaarden"); // Call TestDelegate test = () => MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(Enumerable.Empty(), mapData); @@ -206,7 +207,7 @@ public void AssertHydraulicBoundaryLocationsMapData_DatabaseNullMapDataHasFeatures_ThrowAssertionException() { // Setup - var mapData = new MapPointData("test") + var mapData = new MapPointData("Hydraulische randvoorwaarden") { Features = new[] { @@ -246,7 +247,7 @@ } }; - var mapData = new MapPointData("test"); + var mapData = new MapPointData("Hydraulische randvoorwaarden"); // Call TestDelegate test = () => MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapData); @@ -267,7 +268,7 @@ } }; - var mapData = new MapPointData("test") + var mapData = new MapPointData("Hydraulische randvoorwaarden") { Features = new[] { @@ -354,5 +355,596 @@ } #endregion + + #region AssertReferenceLineMapData + + [Test] + public void AssertReferenceLineMapData_MapDataNotLineData_ThrowAssertionException() + { + // Setup + var mapData = new MapPolygonData("Referentielijn"); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(new ReferenceLine(), mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertReferenceLineMapData_ReferenceLineNullMapDataHasFeatures_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("Referentielijn") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }) + } + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(null, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertReferenceLineMapData_MapDataMoreThanOneFeature_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("Referentielijn") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }), + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }) + } + }; + + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(new[] + { + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0) + }); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(referenceLine, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertReferenceLineMapData_FeatureGeometryNotSameAsReferenceLinePoints_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("Referentielijn") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(0.0, 0.0), + new Point2D(2.0, 2.0), + new Point2D(1.0, 1.0) + } + }) + }) + } + }; + + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(new[] + { + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0) + }); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(referenceLine, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertReferenceLineMapData_MapDataNameNotCorrect_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("test"); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(null, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertReferenceLineMapData_ReferenceLineNullMapDataCorrect_DoesNotThrow() + { + // Setup + var mapData = new MapLineData("Referentielijn"); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(null, mapData); + + // Assert + Assert.DoesNotThrow(test); + } + + [Test] + public void AssertReferenceLineMapData_WithReferenceLineMapDataCorrect_DoesNotThrow() + { + // Setup + // Setup + var mapData = new MapLineData("Referentielijn") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0) + } + }) + }) + } + }; + + var referenceLine = new ReferenceLine(); + referenceLine.SetGeometry(new[] + { + new Point2D(0.0, 0.0), + new Point2D(1.0, 1.0), + new Point2D(2.0, 2.0) + }); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertReferenceLineMapData(referenceLine, mapData); + + // Assert + Assert.DoesNotThrow(test); + } + + #endregion + + #region AssertFailureMechanismSectionsStartPointMapData + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_MapDataNotMapPointData_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("Vakindeling (startpunten)"); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(Enumerable.Empty(), mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_MapDataMoreThanOneFeature_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (startpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }), + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_SectionsEmptyMapDataHasGeometry_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (startpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(1, 1) + } + }) + }) + } + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(Enumerable.Empty(), mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_GeometryNotSameAsStartPoints_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (startpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(1, 1) + } + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_MapDataNameNotCorrect_ThrowAssertionException() + { + // Setup + var geometryPoints = new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }; + + var sections = new[] + { + new FailureMechanismSection("section1", geometryPoints) + }; + + var mapData = new MapLineData("test") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new[] + { + new Point2D(0, 0) + } + }) + }) + } + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsStartPointMapData_MapDataCorrect_DoesNotThrow() + { + // Setup + var mapData = new MapPointData("Vakindeling (startpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(0, 0) + } + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(sections, mapData); + + // Assert + Assert.DoesNotThrow(test); + } + + #endregion + + #region AssertFailureMechanismSectionsEndPointMapData + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_MapDataNotMapPointData_ThrowAssertionException() + { + // Setup + var mapData = new MapLineData("Vakindeling (eindpunten)"); + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(Enumerable.Empty(), mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_MapDataMoreThanOneFeature_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (eindpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }), + new MapFeature(new[] + { + new MapGeometry(new[] + { + Enumerable.Empty() + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_SectionsEmptyMapDataHasGeometry_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (eindpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(1, 1) + } + }) + }) + } + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(Enumerable.Empty(), mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_GeometryNotSameAsEndPoints_ThrowAssertionException() + { + // Setup + var mapData = new MapPointData("Vakindeling (eindpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(1, 1) + } + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_MapDataNameNotCorrect_ThrowAssertionException() + { + // Setup + var geometryPoints = new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }; + + var sections = new[] + { + new FailureMechanismSection("section1", geometryPoints) + }; + + var mapData = new MapLineData("test") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new[] + { + new Point2D(0, 0) + } + }) + }) + } + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(sections, mapData); + + // Assert + Assert.Throws(test); + } + + [Test] + public void AssertFailureMechanismSectionsEndPointMapData_MapDataCorrect_DoesNotThrow() + { + // Setup + var mapData = new MapPointData("Vakindeling (eindpunten)") + { + Features = new[] + { + new MapFeature(new[] + { + new MapGeometry(new[] + { + new [] + { + new Point2D(2, 2) + } + }) + }) + } + }; + + var sections = new[] + { + new FailureMechanismSection("section1", new[] + { + new Point2D(0, 0), + new Point2D(1, 1), + new Point2D(2, 2) + }) + }; + + // Call + TestDelegate test = () => MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(sections, mapData); + + // Assert + Assert.DoesNotThrow(test); + } + + #endregion } } \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs =================================================================== diff -u -r8905298103eb01ce13dd5c1a2f267f879d4fda3e -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision 8905298103eb01ce13dd5c1a2f267f879d4fda3e) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -25,6 +25,7 @@ using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Hydraulics; @@ -72,6 +73,7 @@ /// Thrown when: /// /// is not . + /// has features when is null. /// The number of hydraulic boundary locations and features in are not the same. /// The point of a hydraulic boundary location and the geometry of a corresponding feature are not the same. /// The name of the is not "Hydraulische randvoorwaarden". @@ -94,5 +96,76 @@ } Assert.AreEqual("Hydraulische randvoorwaarden", mapData.Name); } + + /// + /// Asserts whether the contains the data that is representative for the . + /// + /// The reference line that contain the original data. + /// The that needs to be asserted. + /// Thrown when: + /// + /// is not . + /// has features when is null. + /// has more than one feature. + /// The points of the reference line and the geometry of the first feature are not the same. + /// The name of the is not "Referentielijn". + /// + public static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) + { + Assert.IsInstanceOf(mapData); + var referenceLineData = (MapLineData)mapData; + if (referenceLine == null) + { + CollectionAssert.IsEmpty(referenceLineData.Features); + } + else + { + Assert.AreEqual(1, referenceLineData.Features.Length); + CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); + } + Assert.AreEqual("Referentielijn", mapData.Name); + } + + /// + /// Asserts whether the contains the data that is representative for the start points of the . + /// + /// The sections that contains the original data. + /// The that needs to be asserted. + /// Thrown when: + /// + /// is not . + /// has more than one feature. + /// The start points of the sections and the geometry of the first feature are not the same. + /// The name of the is not "Vakindeling (startpunten)". + /// + public static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) + { + Assert.IsInstanceOf(mapData); + var sectionsStartPointData = (MapPointData)mapData; + Assert.AreEqual(1, sectionsStartPointData.Features.Length); + CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); + Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); + } + + /// + /// Asserts whether the contains the data that is representative for the end points of the . + /// + /// The sections that contains the original data. + /// The that needs to be asserted. + /// Thrown when: + /// + /// is not . + /// has more than one feature. + /// The end points of the sections and the geometry of the first feature are not the same. + /// The name of the is not "Vakindeling (eindpunten)". + /// + public static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) + { + Assert.IsInstanceOf(mapData); + var sectionsEndPointData = (MapPointData)mapData; + Assert.AreEqual(1, sectionsEndPointData.Features.Length); + CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsEndPointData.Features.First().MapGeometries.First().PointCollections.First()); + Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); + } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -234,10 +234,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(8, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertDikeProfiles(failureMechanism.DikeProfiles, mapDataList[dikeProfilesIndex]); AssertForeshoreProfiles(failureMechanism.DikeProfiles.Select(dp => dp.ForeshoreProfile), mapDataList[foreshoreProfilesIndex]); @@ -411,15 +411,15 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); assessmentSection.ReferenceLine.SetGeometry(points2); // Call assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -451,8 +451,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -763,21 +763,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertDikeProfiles(IEnumerable dikeProfiles, MapData mapData) { Assert.NotNull(dikeProfiles, "dikeProfiles should never be null."); @@ -816,22 +801,6 @@ Assert.AreEqual("Voorlandprofielen", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable calculations, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsFailureMechanismViewTest.cs (.../GrassCoverErosionOutwardsFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -227,10 +227,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(7, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(failureMechanism.HydraulicBoundaryLocations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), @@ -305,14 +305,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -343,8 +343,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -617,21 +617,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -651,14 +636,6 @@ Assert.AreEqual("Voorlandprofielen", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable calculations, MapData mapData) { Assert.IsInstanceOf(mapData); @@ -683,14 +660,6 @@ Assert.AreEqual("Berekeningen", mapData.Name); } - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertEmptyMapData(MapDataCollection mapDataCollection) { Assert.AreEqual("Dijken en dammen - Grasbekleding erosie buitentalud", mapDataCollection.Name); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismViewTest.cs (.../HeightStructuresFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -240,10 +240,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(8, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData( @@ -416,14 +416,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -454,8 +454,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -774,21 +774,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -825,22 +810,6 @@ Assert.AreEqual("Kunstwerken", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable> calculations, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingFailureMechanismViewTest.cs (.../PipingFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -250,11 +250,11 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(8, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); AssertSurfacelinesMapData(failureMechanism.SurfaceLines, mapDataList[surfaceLinesIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertStochasticSoilModelsMapData(failureMechanism.StochasticSoilModels, mapDataList[stochasticSoilModelsIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); @@ -427,15 +427,15 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); assessmentSection.ReferenceLine.SetGeometry(points2); // Call assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -500,8 +500,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -801,37 +801,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertSurfacelinesMapData(IEnumerable surfaceLines, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismViewTest.cs (.../StabilityPointStructuresFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -240,10 +240,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(8, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData( @@ -416,14 +416,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -454,8 +454,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -774,21 +774,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -825,22 +810,6 @@ Assert.AreEqual("Kunstwerken", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable> calculations, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/Views/StabilityStoneCoverFailureMechanismViewTest.cs (.../StabilityStoneCoverFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -233,10 +233,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(7, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), mapDataList[calculationsIndex]); @@ -361,14 +361,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -399,8 +399,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -673,21 +673,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -707,22 +692,6 @@ Assert.AreEqual("Voorlandprofielen", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable calculations, MapData mapData) { Assert.IsInstanceOf(mapData); Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs =================================================================== diff -u -r325d885b0c90df169364b1afee4a9b176f081d56 -ra76c963dc2f487204029c90e1cbdd0e4eaeb0de5 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision 325d885b0c90df169364b1afee4a9b176f081d56) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/Views/WaveImpactAsphaltCoverFailureMechanismViewTest.cs (.../WaveImpactAsphaltCoverFailureMechanismViewTest.cs) (revision a76c963dc2f487204029c90e1cbdd0e4eaeb0de5) @@ -233,10 +233,10 @@ var mapDataList = mapData.Collection.ToList(); Assert.AreEqual(7, mapDataList.Count); - AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, mapDataList[referenceLineIndex]); MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, mapDataList[sectionsIndex]); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, mapDataList[sectionsStartPointIndex]); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, mapDataList[sectionsEndPointIndex]); MapDataTestHelper.AssertHydraulicBoundaryLocationsMapData(hydraulicBoundaryDatabase.Locations, mapDataList[hydraulicBoundaryLocationsIndex]); AssertForeshoreProfiles(failureMechanism.ForeshoreProfiles, mapDataList[foreshoreProfilesIndex]); AssertCalculationsMapData(failureMechanism.Calculations.Cast(), @@ -362,14 +362,14 @@ var referenceLineMapData = map.Data.Collection.ElementAt(referenceLineIndex); // Precondition - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); // Call assessmentSection.ReferenceLine.SetGeometry(points2); assessmentSection.NotifyObservers(); // Assert - AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); + MapDataTestHelper.AssertReferenceLineMapData(assessmentSection.ReferenceLine, referenceLineMapData); } } @@ -400,8 +400,8 @@ // Assert MapDataTestHelper.AssertFailureMechanismSectionsMapData(failureMechanism.Sections, sectionMapData); - AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); - AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsStartPointMapData(failureMechanism.Sections, sectionStartsMapData); + MapDataTestHelper.AssertFailureMechanismSectionsEndPointMapData(failureMechanism.Sections, sectionsEndsMapData); } } @@ -674,21 +674,6 @@ } } - private static void AssertReferenceLineMapData(ReferenceLine referenceLine, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var referenceLineData = (MapLineData) mapData; - if (referenceLine == null) - { - CollectionAssert.IsEmpty(referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - else - { - CollectionAssert.AreEqual(referenceLine.Points, referenceLineData.Features.First().MapGeometries.First().PointCollections.First()); - } - Assert.AreEqual("Referentielijn", mapData.Name); - } - private static void AssertForeshoreProfiles(IEnumerable foreshoreProfiles, MapData mapData) { Assert.NotNull(foreshoreProfiles, "foreshoreProfiles should never be null."); @@ -708,22 +693,6 @@ Assert.AreEqual("Voorlandprofielen", mapData.Name); } - private static void AssertFailureMechanismSectionsStartPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetStart()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (startpunten)", mapData.Name); - } - - private static void AssertFailureMechanismSectionsEndPointMapData(IEnumerable sections, MapData mapData) - { - Assert.IsInstanceOf(mapData); - var sectionsStartPointData = (MapPointData) mapData; - CollectionAssert.AreEqual(sections.Select(s => s.GetLast()), sectionsStartPointData.Features.First().MapGeometries.First().PointCollections.First()); - Assert.AreEqual("Vakindeling (eindpunten)", mapData.Name); - } - private static void AssertCalculationsMapData(IEnumerable calculations, MapData mapData) { Assert.IsInstanceOf(mapData);