Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/AssessmentSectionAssemblyTestHelperTest.cs (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -0,0 +1,117 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System.Collections.Generic;
+using System.Linq;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.Integration.Data.TestUtil.Test
+{
+ [TestFixture]
+ public class AssessmentSectionAssemblyTestHelperTest
+ {
+ [Test]
+ public void GetConfiguredAssessmentSectionWithGroup1And2FailureMechanisms_Always_ReturnsExpectedTestCases()
+ {
+ // Call
+ TestCaseData[] testCases = AssessmentSectionAssemblyTestHelper.GetConfiguredAssessmentSectionWithGroup1And2FailureMechanisms()
+ .ToArray();
+
+ // Assert
+ CollectionAssert.AreEqual(new[]
+ {
+ "Piping",
+ "MacroStabilityInwards",
+ "GrassCoverErosionInwards",
+ "ClosingStructures",
+ "HeightStructures",
+ "StabilityPointStructures"
+ }, testCases.Select(tc => tc.TestName));
+ Assert.IsTrue(testCases.All(tc => tc.Arguments.Length == 1));
+
+ var assessmentSectionWithPiping = (AssessmentSection) testCases[0].Arguments[0];
+ PipingFailureMechanism piping = assessmentSectionWithPiping.Piping;
+ AssertAssessmentSection(assessmentSectionWithPiping, piping);
+ PipingFailureMechanismSectionResult pipingSectionResult = piping.SectionResults.Single();
+ Assert.IsTrue(pipingSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, pipingSectionResult.ManualAssemblyProbability);
+
+ var assessmentSectionWithMacroStabilityInwards = (AssessmentSection) testCases[1].Arguments[0];
+ MacroStabilityInwardsFailureMechanism macroStabilityInwards = assessmentSectionWithMacroStabilityInwards.MacroStabilityInwards;
+ AssertAssessmentSection(assessmentSectionWithMacroStabilityInwards, macroStabilityInwards);
+ MacroStabilityInwardsFailureMechanismSectionResult macroStabilityInwardsSectionResult = macroStabilityInwards.SectionResults.Single();
+ Assert.IsTrue(macroStabilityInwardsSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, macroStabilityInwardsSectionResult.ManualAssemblyProbability);
+
+ var assessmentSectionWithGrassCoverErosionInwards = (AssessmentSection) testCases[2].Arguments[0];
+ GrassCoverErosionInwardsFailureMechanism grassCoverErosionInwards = assessmentSectionWithGrassCoverErosionInwards.GrassCoverErosionInwards;
+ AssertAssessmentSection(assessmentSectionWithGrassCoverErosionInwards, grassCoverErosionInwards);
+ GrassCoverErosionInwardsFailureMechanismSectionResult grassCoverErosionInwardsSectionResult = grassCoverErosionInwards.SectionResults.Single();
+ Assert.IsTrue(grassCoverErosionInwardsSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, grassCoverErosionInwardsSectionResult.ManualAssemblyProbability);
+
+ var assessmentSectionWithClosingStructures = (AssessmentSection) testCases[3].Arguments[0];
+ ClosingStructuresFailureMechanism closingStructures = assessmentSectionWithClosingStructures.ClosingStructures;
+ AssertAssessmentSection(assessmentSectionWithClosingStructures, closingStructures);
+ ClosingStructuresFailureMechanismSectionResult closingStructuresSectionResult = closingStructures.SectionResults.Single();
+ Assert.IsTrue(closingStructuresSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, closingStructuresSectionResult.ManualAssemblyProbability);
+
+ var assessmentSectionWithHeightStructures = (AssessmentSection) testCases[4].Arguments[0];
+ HeightStructuresFailureMechanism heightStructures = assessmentSectionWithHeightStructures.HeightStructures;
+ AssertAssessmentSection(assessmentSectionWithHeightStructures, heightStructures);
+ HeightStructuresFailureMechanismSectionResult heightStructuresSectionResult = heightStructures.SectionResults.Single();
+ Assert.IsTrue(heightStructuresSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, heightStructuresSectionResult.ManualAssemblyProbability);
+
+ var assessmentSectionWithStabilityPointStructures = (AssessmentSection) testCases[5].Arguments[0];
+ StabilityPointStructuresFailureMechanism stabilityPointStructures = assessmentSectionWithStabilityPointStructures.StabilityPointStructures;
+ AssertAssessmentSection(assessmentSectionWithStabilityPointStructures, stabilityPointStructures);
+ StabilityPointStructuresFailureMechanismSectionResult stabilityPointStructuresSectionResult = stabilityPointStructures.SectionResults.Single();
+ Assert.IsTrue(stabilityPointStructuresSectionResult.UseManualAssembly);
+ Assert.AreEqual(0.5, stabilityPointStructuresSectionResult.ManualAssemblyProbability);
+ }
+
+ private static void AssertAssessmentSection(AssessmentSection assessmentSection,
+ IFailureMechanism relevantFailureMechanism)
+ {
+ Assert.AreEqual(AssessmentSectionComposition.DikeAndDune, assessmentSection.Composition);
+
+ IEnumerable irrelevantFailureMechanisms = assessmentSection.GetFailureMechanisms()
+ .Where(fm => !ReferenceEquals(relevantFailureMechanism, fm));
+ AssertIrrelevantFailureMechanisms(irrelevantFailureMechanisms);
+ }
+
+ private static void AssertIrrelevantFailureMechanisms(IEnumerable failureMechanisms)
+ {
+ Assert.IsTrue(failureMechanisms.All(fm => !fm.IsRelevant));
+ CollectionAssert.IsEmpty(failureMechanisms.SelectMany(fm => fm.Sections));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/Ringtoets.Integration.Data.TestUtil.Test.csproj
===================================================================
diff -u -raba1dff72b3ea72b8a4489b9ec13fd9efffaff57 -r7112111f042c275b774622464cb27537a6563c66
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/Ringtoets.Integration.Data.TestUtil.Test.csproj (.../Ringtoets.Integration.Data.TestUtil.Test.csproj) (revision aba1dff72b3ea72b8a4489b9ec13fd9efffaff57)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/Ringtoets.Integration.Data.TestUtil.Test.csproj (.../Ringtoets.Integration.Data.TestUtil.Test.csproj) (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -7,15 +7,62 @@
+
+ ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll
+
+
Copying.licenseheader
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
+
+ {C6309704-D67B-434C-BC98-9F8910BC1D10}
+ Ringtoets.ClosingStructures.Data
+
+
+ {D4200F43-3F72-4F42-AF0A-8CED416A38EC}
+ Ringtoets.Common.Data
+
+
+ {90DE728E-48EF-4665-AB38-3D88E41D9F4D}
+ Ringtoets.GrassCoverErosionInwards.Data
+
+
+ {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99}
+ Ringtoets.HeightStructures.Data
+
+
+ {83D6B73E-91D5-46B0-9218-955DA1F75F7C}
+ Ringtoets.MacroStabilityInwards.Data
+
+
+ {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB}
+ Ringtoets.Piping.Data
+
+
+ {3D4B9740-8348-4434-8D77-B611FC6EE57F}
+ Ringtoets.StabilityPointStructures.Data
+
+
+ {11F1F874-45AF-43E4-8AE5-15A5C9593E28}
+ Ringtoets.Integration.Data
+
+
+ {2D51FD02-BBED-43FE-BDB7-4437152876A1}
+ Ringtoets.Integration.Data.TestUtil
+
+
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/packages.config
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/packages.config (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil.Test/packages.config (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/AssessmentSectionAssemblyTestHelper.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/AssessmentSectionAssemblyTestHelper.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/AssessmentSectionAssemblyTestHelper.cs (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -0,0 +1,155 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Core.Common.Util.Extensions;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.StabilityPointStructures.Data;
+
+namespace Ringtoets.Integration.Data.TestUtil
+{
+ ///
+ /// Helper which creates configurations of
+ /// which can be used for testing assembly results.
+ ///
+ public static class AssessmentSectionAssemblyTestHelper
+ {
+ ///
+ /// Gets a collection of configurations of
+ /// failure mechanisms belonging in groups 1 and 2, such that:
+ ///
+ /// - All other failure mechanisms are marked as irrelevant, except one failure mechanism.
+ /// - The aforementioned failure mechanism will have one section which contains manual assembly data.
+ ///
+ ///
+ /// A collection of configurations.
+ public static IEnumerable GetConfiguredAssessmentSectionWithGroup1And2FailureMechanisms()
+ {
+ foreach (FailureMechanismConfiguration assessmentSectionConfiguration in GetGroup1And2FailureMechanismConfigurations())
+ {
+ AssessmentSection assessmentSection = CreateAssessmentSectionWithIrrelevantFailureMechanisms();
+ assessmentSectionConfiguration.ConfigureAssessmentSection(assessmentSection);
+
+ yield return new TestCaseData(assessmentSection).SetName(assessmentSectionConfiguration.FailureMechanismName);
+ }
+ }
+
+ private static AssessmentSection CreateAssessmentSectionWithIrrelevantFailureMechanisms()
+ {
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.DikeAndDune);
+ assessmentSection.GetFailureMechanisms().ForEachElementDo(fm => fm.IsRelevant = false);
+ return assessmentSection;
+ }
+
+ private static IEnumerable GetGroup1And2FailureMechanismConfigurations()
+ {
+ const double manualAssemblyProbability = 0.5;
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ PipingFailureMechanism failureMechanism = section.Piping;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ PipingFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "Piping");
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ MacroStabilityInwardsFailureMechanism failureMechanism = section.MacroStabilityInwards;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ MacroStabilityInwardsFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "MacroStabilityInwards");
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ GrassCoverErosionInwardsFailureMechanism failureMechanism = section.GrassCoverErosionInwards;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "GrassCoverErosionInwards");
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ ClosingStructuresFailureMechanism failureMechanism = section.ClosingStructures;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ ClosingStructuresFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "ClosingStructures");
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ HeightStructuresFailureMechanism failureMechanism = section.HeightStructures;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ HeightStructuresFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "HeightStructures");
+
+ yield return new FailureMechanismConfiguration(section =>
+ {
+ StabilityPointStructuresFailureMechanism failureMechanism = section.StabilityPointStructures;
+ failureMechanism.IsRelevant = true;
+ FailureMechanismTestHelper.AddSections(failureMechanism, 1);
+
+ StabilityPointStructuresFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single();
+ sectionResult.UseManualAssembly = true;
+ sectionResult.ManualAssemblyProbability = manualAssemblyProbability;
+ }, "StabilityPointStructures");
+ }
+
+ private class FailureMechanismConfiguration
+ {
+ public FailureMechanismConfiguration(Action configureAssessmentSection,
+ string failureMechanismName)
+ {
+ ConfigureAssessmentSection = configureAssessmentSection;
+ FailureMechanismName = failureMechanismName;
+ }
+
+ public Action ConfigureAssessmentSection { get; }
+ public string FailureMechanismName { get; }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/Ringtoets.Integration.Data.TestUtil.csproj
===================================================================
diff -u -raba1dff72b3ea72b8a4489b9ec13fd9efffaff57 -r7112111f042c275b774622464cb27537a6563c66
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/Ringtoets.Integration.Data.TestUtil.csproj (.../Ringtoets.Integration.Data.TestUtil.csproj) (revision aba1dff72b3ea72b8a4489b9ec13fd9efffaff57)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/Ringtoets.Integration.Data.TestUtil.csproj (.../Ringtoets.Integration.Data.TestUtil.csproj) (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -7,15 +7,66 @@
+
+ ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll
+
+
Copying.licenseheader
+
+
+
+ {3BBFD65B-B277-4E50-AE6D-BD24C3434609}
+ Core.Common.Base
+
+
+ {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
+ Core.Common.Util
+
+
+ {C6309704-D67B-434C-BC98-9F8910BC1D10}
+ Ringtoets.ClosingStructures.Data
+
+
+ {D4200F43-3F72-4F42-AF0A-8CED416A38EC}
+ Ringtoets.Common.Data
+
+
+ {4843D6E5-066F-4795-94F5-1D53932DD03C}
+ Ringtoets.Common.Data.TestUtil
+
+
+ {90DE728E-48EF-4665-AB38-3D88E41D9F4D}
+ Ringtoets.GrassCoverErosionInwards.Data
+
+
+ {1C0017D8-35B5-4CA0-8FC7-A83F46DBDC99}
+ Ringtoets.HeightStructures.Data
+
+
+ {83D6B73E-91D5-46B0-9218-955DA1F75F7C}
+ Ringtoets.MacroStabilityInwards.Data
+
+
+ {CE994CC9-6F6A-48AC-B4BE-02C30A21F4DB}
+ Ringtoets.Piping.Data
+
+
+ {3D4B9740-8348-4434-8D77-B611FC6EE57F}
+ Ringtoets.StabilityPointStructures.Data
+
+
+ {11F1F874-45AF-43E4-8AE5-15A5C9593E28}
+ Ringtoets.Integration.Data
+
+
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/packages.config
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/packages.config (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.TestUtil/packages.config (revision 7112111f042c275b774622464cb27537a6563c66)
@@ -0,0 +1,26 @@
+
+
+
+
+
\ No newline at end of file