Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs =================================================================== diff -u -r2a81f01756e227d5ce93717b21b87e8a5cd5fcbb -rb00749b5923c5350263b1b549a469c436dbe66a2 --- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision 2a81f01756e227d5ce93717b21b87e8a5cd5fcbb) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/MapDataTestHelper.cs (.../MapDataTestHelper.cs) (revision b00749b5923c5350263b1b549a469c436dbe66a2) @@ -23,10 +23,13 @@ using System.Linq; using Core.Common.Base.Geometry; using Core.Common.Geometry; +using Core.Common.Util; using Core.Components.Gis.Data; using Core.Components.Gis.Features; using Core.Components.Gis.Geometries; using NUnit.Framework; +using Ringtoets.AssemblyTool.Data; +using Ringtoets.AssemblyTool.Forms; using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.DikeProfiles; @@ -279,6 +282,62 @@ structuresData.Features.SelectMany(f => f.MapGeometries.First().PointCollections.First())); } + /// + /// Asserts whether the contains the data that is representative + /// for the and supplied . + /// + /// The expected simple assembly. + /// The expected detailed assembly. + /// The expected tailor made assembly. + /// The expected combined assembly. + /// The that needs to be asserted. + /// The the map data collection belongs to. + /// Thrown when: + /// + /// there is an incorrect amount of items in ; + /// one of the items in has incorrect properties. + /// + /// + public static void AssertAssemblyMapDataCollection(FailureMechanismSectionAssembly expectedSimpleAssembly, + FailureMechanismSectionAssembly expectedDetailedAssembly, + FailureMechanismSectionAssembly expectedTailorMadeAssembly, + FailureMechanismSectionAssembly expectedCombinedAssembly, + MapDataCollection assemblyMapData, + IFailureMechanism failureMechanism) + { + IEnumerable assemblyMapDataCollection = assemblyMapData.Collection; + Assert.AreEqual(4, assemblyMapDataCollection.Count()); + AssertAssemblyMapData("Toetsoordeel toets op maat", failureMechanism, expectedTailorMadeAssembly, assemblyMapDataCollection.ElementAt(0)); + AssertAssemblyMapData("Toetsoordeel gedetailleerde toets", failureMechanism, expectedDetailedAssembly, assemblyMapDataCollection.ElementAt(1)); + AssertAssemblyMapData("Toetsoordeel eenvoudige toets", failureMechanism, expectedSimpleAssembly, assemblyMapDataCollection.ElementAt(2)); + AssertAssemblyMapData("Gecombineerd toetsoordeel", failureMechanism, expectedCombinedAssembly, assemblyMapDataCollection.ElementAt(3)); + } + + private static void AssertAssemblyMapData(string expectedMapDataName, + IFailureMechanism failureMechanism, + FailureMechanismSectionAssembly expectedAssembly, + MapData mapData) + { + var assemblyMapLineData = (MapLineData) mapData; + Assert.AreEqual(expectedMapDataName, assemblyMapLineData.Name); + + MapFeature[] features = assemblyMapLineData.Features.ToArray(); + FailureMechanismSection[] sections = failureMechanism.Sections.ToArray(); + Assert.AreEqual(sections.Length, features.Length); + + for (var index = 0; index < sections.Length; index++) + { + MapFeature feature = features[index]; + + FailureMechanismSection failureMechanismSection = sections[index]; + CollectionAssert.AreEqual(failureMechanismSection.Points, feature.MapGeometries.Single().PointCollections.Single()); + + Assert.AreEqual(new EnumDisplayWrapper( + DisplayFailureMechanismSectionAssemblyCategoryGroupConverter.Convert(expectedAssembly.Group)).DisplayName, feature.MetaData["Categorie"]); + Assert.AreEqual(expectedAssembly.Probability, feature.MetaData["Faalkans"]); + } + } + private static IEnumerable GetWorldPoints(ForeshoreProfile foreshoreProfile) { return AdvancedMath2D.FromXToXY(