Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r8c78853745e5865dad910b2d9050ac52585daa87 -r1fb01bc36ec33516da52b9b7b688123b26d63624 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 8c78853745e5865dad910b2d9050ac52585daa87) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 1fb01bc36ec33516da52b9b7b688123b26d63624) @@ -27,6 +27,7 @@ using Core.Common.Base; using Core.Common.Base.Data; +using Core.Common.Base.Geometry; using Core.Common.Base.Plugin; using Core.Common.Gui; using Core.Common.Gui.Forms.MainWindow; @@ -212,24 +213,23 @@ Assert.NotNull(actualProject); Assert.AreNotSame(expectedProject, actualProject); - var expectedProjectAssessmentSection = expectedProject.Items.OfType().ToArray(); - var actualProjectAssessmentSection = actualProject.Items.OfType().ToArray(); - Assert.AreEqual(expectedProjectAssessmentSection.Length, actualProjectAssessmentSection.Length); - for (var i = 0; i < expectedProjectAssessmentSection.Length; i++) + AssessmentSection[] expectedProjectAssessmentSections = expectedProject.Items.OfType().ToArray(); + AssessmentSection[] actualProjectAssessmentSections = actualProject.Items.OfType().ToArray(); + Assert.AreEqual(expectedProjectAssessmentSections.Length, actualProjectAssessmentSections.Length); + for (var i = 0; i < expectedProjectAssessmentSections.Length; i++) { - Assert.AreEqual(expectedProjectAssessmentSection[i].StorageId, actualProjectAssessmentSection[i].StorageId); - Assert.AreEqual(expectedProjectAssessmentSection[i].Name, actualProjectAssessmentSection[i].Name); + AssessmentSection expectedAssessmentSection = expectedProjectAssessmentSections[i]; + AssessmentSection actualAssessmentSection = actualProjectAssessmentSections[i]; - IAssessmentSection expectedAssessmentSection = expectedProjectAssessmentSection[i]; - IAssessmentSection actualAssessmentSection = actualProjectAssessmentSection[i]; + Assert.AreEqual(expectedAssessmentSection.StorageId, actualAssessmentSection.StorageId); + Assert.AreEqual(expectedAssessmentSection.Name, actualAssessmentSection.Name); + AssertHydraulicBoundaryDatabase(expectedAssessmentSection.HydraulicBoundaryDatabase, actualAssessmentSection.HydraulicBoundaryDatabase); - IAssessmentSection expectedProject1 = expectedProjectAssessmentSection[i]; - IAssessmentSection actualProject1 = actualProjectAssessmentSection[i]; - AssertReferenceLine(expectedProject1.ReferenceLine, actualProject1.ReferenceLine); - AssertPipingFailureMechanism(expectedProjectAssessmentSection[i].PipingFailureMechanism, actualProjectAssessmentSection[i].PipingFailureMechanism); + AssertReferenceLine(expectedAssessmentSection.ReferenceLine, actualAssessmentSection.ReferenceLine); + AssertPipingFailureMechanism(expectedAssessmentSection.PipingFailureMechanism, actualAssessmentSection.PipingFailureMechanism); - var expectedProjectFailureMechanisms = expectedProjectAssessmentSection[i].GetFailureMechanisms().ToArray(); - var actualProjectFailureMechanisms = actualProjectAssessmentSection[i].GetFailureMechanisms().ToArray(); + IFailureMechanism[] expectedProjectFailureMechanisms = expectedAssessmentSection.GetFailureMechanisms().ToArray(); + IFailureMechanism[] actualProjectFailureMechanisms = actualAssessmentSection.GetFailureMechanisms().ToArray(); for (var fmi = 0; fmi < expectedProjectFailureMechanisms.Length; fmi++) { AssertFailureMechanism(expectedProjectFailureMechanisms[fmi], actualProjectFailureMechanisms[fmi]); @@ -254,8 +254,11 @@ for (var i = 0; i < expectedSectionsArray.Length; i++) { - Assert.AreEqual(expectedSectionsArray[i].Name, actualSectionsArray[i].Name); - Assert.AreEqual(expectedSectionsArray[i].Points, actualSectionsArray[i].Points); + FailureMechanismSection expectedSection = expectedSectionsArray[i]; + FailureMechanismSection actualSection = actualSectionsArray[i]; + + Assert.AreEqual(expectedSection.Name, actualSection.Name); + CollectionAssert.AreEqual(expectedSection.Points, actualSection.Points); } } @@ -268,25 +271,22 @@ for (int i = 0; i < expectedBoundaryDatabase.Locations.Count; i++) { - Assert.AreEqual(expectedBoundaryDatabase.Locations[i].Id, actualBoundaryDatabase.Locations[i].Id); - Assert.AreEqual(expectedBoundaryDatabase.Locations[i].Name, actualBoundaryDatabase.Locations[i].Name); - Assert.AreEqual(expectedBoundaryDatabase.Locations[i].DesignWaterLevel, actualBoundaryDatabase.Locations[i].DesignWaterLevel); - Assert.AreEqual(expectedBoundaryDatabase.Locations[i].StorageId, actualBoundaryDatabase.Locations[i].StorageId); - Assert.AreEqual(expectedBoundaryDatabase.Locations[i].Location, actualBoundaryDatabase.Locations[i].Location); + HydraulicBoundaryLocation expectedBoundaryLocation = expectedBoundaryDatabase.Locations[i]; + HydraulicBoundaryLocation actualBoundaryLocation = actualBoundaryDatabase.Locations[i]; + + Assert.AreEqual(expectedBoundaryLocation.Id, actualBoundaryLocation.Id); + Assert.AreEqual(expectedBoundaryLocation.Name, actualBoundaryLocation.Name); + Assert.AreEqual(expectedBoundaryLocation.DesignWaterLevel, actualBoundaryLocation.DesignWaterLevel); + Assert.AreEqual(expectedBoundaryLocation.StorageId, actualBoundaryLocation.StorageId); + Assert.AreEqual(expectedBoundaryLocation.Location, actualBoundaryLocation.Location); } } private static void AssertReferenceLine(ReferenceLine expectedReferenceLine, ReferenceLine actualReferenceLine) { Assert.IsNotNull(expectedReferenceLine); - for (int i = 0; i < expectedReferenceLine.Points.Count(); i++) - { - var expectedPoint = expectedReferenceLine.Points.ElementAt(i); - var resultingPoint = actualReferenceLine.Points.ElementAt(i); - Assert.AreEqual(expectedPoint.X, resultingPoint.X); - Assert.AreEqual(expectedPoint.Y, resultingPoint.Y); - } + CollectionAssert.AreEqual(expectedReferenceLine.Points, actualReferenceLine.Points); } private void AssertPipingFailureMechanism(PipingFailureMechanism expectedPipingFailureMechanism, PipingFailureMechanism actualPipingFailureMechanism) @@ -304,8 +304,8 @@ for (int i = 0; i < expectedModels.Count; i++) { - var expectedModel = expectedModels.ElementAt(i); - var actualModel = actualModels.ElementAt(i); + StochasticSoilModel expectedModel = expectedModels[i]; + StochasticSoilModel actualModel = actualModels[i]; Assert.AreEqual(expectedModel.Name, actualModel.Name); Assert.AreEqual(expectedModel.SegmentName, actualModel.SegmentName); @@ -320,8 +320,8 @@ for (int i = 0; i < expectedStochasticSoilProfiles.Count; i++) { - var expectedProfile = expectedStochasticSoilProfiles.ElementAt(i); - var actualProfile = actualStochasticSoilProfiles.ElementAt(i); + StochasticSoilProfile expectedProfile = expectedStochasticSoilProfiles[i]; + StochasticSoilProfile actualProfile = actualStochasticSoilProfiles[i]; Assert.AreEqual(expectedProfile.Probability, actualProfile.Probability); Assert.AreEqual(expectedProfile.SoilProfile.Bottom, actualProfile.SoilProfile.Bottom); @@ -332,15 +332,15 @@ private void AssertSoilLayers(IEnumerable expectedLayers, IEnumerable actualLayers) { - var actualLayerArray = actualLayers.ToArray(); - var expectedLayerArray = expectedLayers.ToArray(); + PipingSoilLayer[] actualLayerArray = actualLayers.ToArray(); + PipingSoilLayer[] expectedLayerArray = expectedLayers.ToArray(); Assert.Less(0, actualLayerArray.Length); Assert.AreEqual(expectedLayerArray.Length, actualLayerArray.Length); for (int i = 0; i < expectedLayerArray.Length; i++) { - var expectedLayer = actualLayerArray[i]; - var actualLayer = expectedLayerArray[i]; + PipingSoilLayer expectedLayer = actualLayerArray[i]; + PipingSoilLayer actualLayer = expectedLayerArray[i]; Assert.AreEqual(expectedLayer.Top, actualLayer.Top); Assert.AreEqual(expectedLayer.IsAquifer, actualLayer.IsAquifer); @@ -357,6 +357,7 @@ { RingtoetsPipingSurfaceLine expectedSurfaceLine = expectedSurfaceLines.ElementAt(i); RingtoetsPipingSurfaceLine actualSurfaceLine = expectedSurfaceLines.ElementAt(i); + AssertSurfaceLine(expectedSurfaceLine, actualSurfaceLine); } } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs =================================================================== diff -u -r8c78853745e5865dad910b2d9050ac52585daa87 -r1fb01bc36ec33516da52b9b7b688123b26d63624 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 8c78853745e5865dad910b2d9050ac52585daa87) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectHelper.cs (.../RingtoetsProjectHelper.cs) (revision 1fb01bc36ec33516da52b9b7b688123b26d63624) @@ -44,46 +44,47 @@ /// A new complete instance of . public static Project GetFullTestProject() { - var fullTestProject = new Project + var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike) { - Name = "tempProjectFile", - Description = "description", - Items = + Name = "assessmentSection", + HydraulicBoundaryDatabase = GetHydraulicBoundaryDatabase(), + ReferenceLine = GetReferenceLine(), + PipingFailureMechanism = { - new AssessmentSection(AssessmentSectionComposition.Dike) + StochasticSoilModels = { - Name = "assessmentSection", - HydraulicBoundaryDatabase = GetHydraulicBoundaryDatabase(), - ReferenceLine = GetReferenceLine(), - PipingFailureMechanism = + new StochasticSoilModel(-1, "modelName", "modelSegmentName") { - StochasticSoilModels = + StochasticSoilProfiles = { - new StochasticSoilModel(-1, "modelName", "modelSegmentName") + new StochasticSoilProfile(0.2, SoilProfileType.SoilProfile1D, -1) { - StochasticSoilProfiles = - { - new StochasticSoilProfile(0.2, SoilProfileType.SoilProfile1D, -1) - { - SoilProfile = new TestPipingSoilProfile() - }, - new StochasticSoilProfile(0.8, SoilProfileType.SoilProfile1D, -1) - { - SoilProfile = new TestPipingSoilProfile() - } - } + SoilProfile = new TestPipingSoilProfile() + }, + new StochasticSoilProfile(0.8, SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = new TestPipingSoilProfile() } - }, - SurfaceLines = - { - GetSurfaceLine() } } + }, + SurfaceLines = + { + GetSurfaceLine() } } }; - var assessmentSection = fullTestProject.Items.OfType().First(); + var fullTestProject = new Project + { + Name = "tempProjectFile", + Description = "description", + Items = + { + assessmentSection + } + }; + AddSections(assessmentSection.PipingFailureMechanism); AddSections(assessmentSection.GrassCoverErosionInwards); AddSections(assessmentSection.MacrostabilityInwards); @@ -102,6 +103,7 @@ AddSections(assessmentSection.PipingStructure); AddSections(assessmentSection.DuneErosion); AddSections(assessmentSection.TechnicalInnovation); + return fullTestProject; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/ClosingStructureFailureMechanism.cs =================================================================== diff -u -r8c78853745e5865dad910b2d9050ac52585daa87 -r1fb01bc36ec33516da52b9b7b688123b26d63624 --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/ClosingStructureFailureMechanism.cs (.../ClosingStructureFailureMechanism.cs) (revision 8c78853745e5865dad910b2d9050ac52585daa87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/ClosingStructureFailureMechanism.cs (.../ClosingStructureFailureMechanism.cs) (revision 1fb01bc36ec33516da52b9b7b688123b26d63624) @@ -29,7 +29,7 @@ { /// /// Model containing input and output needed to perform different levels of the - /// Closing Structure Inwards failure mechanism. + /// Closing Structure failure mechanism. /// public class ClosingStructureFailureMechanism : FailureMechanismBase, IHasSectionResults {