Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs
===================================================================
diff -u -r908306b7ca54704c91fb317dc13eeab987019f00 -rac89cba5210640fa7f0c25b6cceab5f74267dd99
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision 908306b7ca54704c91fb317dc13eeab987019f00)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableAssessmentSectionFactory.cs (.../ExportableAssessmentSectionFactory.cs) (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -102,7 +102,8 @@
ExportableGrassCoverSlipOffOutwardsFailureMechanismFactory.CreateExportableGrassCoverSlipOffOutwardsFailureMechanism(assessmentSection.GrassCoverSlipOffOutwards),
ExportableGrassCoverSlipOffInwardsFailureMechanismFactory.CreateExportableGrassCoverSlipOffInwardsFailureMechanism(assessmentSection.GrassCoverSlipOffInwards),
ExportablePipingStructureFailureMechanismFactory.CreateExportablePipingStructureFailureMechanism(assessmentSection.PipingStructure),
- ExportableWaterPressureAsphaltCoverFailureMechanismFactory.CreateExportableWaterPressureAsphaltCoverFailureMechanism(assessmentSection.WaterPressureAsphaltCover)
+ ExportableWaterPressureAsphaltCoverFailureMechanismFactory.CreateExportableWaterPressureAsphaltCoverFailureMechanism(assessmentSection.WaterPressureAsphaltCover),
+ ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism(assessmentSection.StrengthStabilityLengthwiseConstruction)
};
}
}
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.cs
===================================================================
diff -u
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.cs (revision 0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.cs (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -0,0 +1,96 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.Exceptions;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.Data.StandAlone.AssemblyFactories;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Ringtoets.Integration.IO.Assembly;
+
+namespace Ringtoets.Integration.IO.Factories
+{
+ ///
+ /// Factory to create instances of
+ /// with assembly results for strength stability lengthwise construction.
+ ///
+ public static class ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory
+ {
+ private const ExportableFailureMechanismType failureMechanismCode = ExportableFailureMechanismType.STKWl;
+ private const ExportableFailureMechanismGroup failureMechanismGroup = ExportableFailureMechanismGroup.Group4;
+ private const ExportableAssemblyMethod failureMechanismAssemblyMethod = ExportableAssemblyMethod.WBI1A1;
+
+ ///
+ /// Creates a
+ /// with assembly results based on the input parameters.
+ ///
+ /// The to create a
+ /// for.
+ /// A with assembly results.
+ /// Thrown when any parameter is null.
+ /// Thrown when assembly results cannot be created.
+ public static ExportableFailureMechanism CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism(
+ StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism)
+ {
+ if (failureMechanism == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanism));
+ }
+
+ if (!failureMechanism.IsRelevant)
+ {
+ return ExportableFailureMechanismFactory.CreateDefaultExportableFailureMechanismWithoutProbability(failureMechanismCode,
+ failureMechanismGroup,
+ failureMechanismAssemblyMethod);
+ }
+
+ FailureMechanismAssemblyCategoryGroup failureMechanismAssembly = StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism);
+
+ Dictionary failureMechanismSectionsLookup =
+ failureMechanism.SectionResults
+ .ToDictionary(sectionResult => sectionResult,
+ sectionResult => ExportableFailureMechanismSectionFactory.CreateExportableFailureMechanismSection(sectionResult.Section));
+
+ return new ExportableFailureMechanism(
+ new ExportableFailureMechanismAssemblyResult(failureMechanismAssemblyMethod,
+ failureMechanismAssembly),
+ failureMechanismSectionsLookup.Values,
+ CreateFailureMechanismSectionResults(failureMechanismSectionsLookup),
+ failureMechanismCode,
+ failureMechanismGroup);
+ }
+
+ ///
+ /// Creates a collection of
+ /// with assembly results based on the sections in .
+ ///
+ /// The mapping between the
+ /// and .
+ /// A collection of .
+ /// Thrown when assembly results cannot be created.
+ private static IEnumerable CreateFailureMechanismSectionResults(
+ Dictionary failureMechanismSections)
+ {
+ var exportableResults = new List();
+ foreach (KeyValuePair failureMechanismSectionPair in failureMechanismSections)
+ {
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult failureMechanismSectionResult = failureMechanismSectionPair.Key;
+ FailureMechanismSectionAssemblyCategoryGroup simpleAssembly =
+ StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleSimpleAssessment(failureMechanismSectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssembly =
+ StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleTailorMadeAssessment(failureMechanismSectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly =
+ StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanismSectionResult);
+
+ exportableResults.Add(
+ new ExportableAggregatedFailureMechanismSectionAssemblyResultWithoutDetailedAssembly(
+ failureMechanismSectionPair.Value,
+ ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResult(simpleAssembly, ExportableAssemblyMethod.WBI0E1),
+ ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResult(tailorMadeAssembly, ExportableAssemblyMethod.WBI0T1),
+ ExportableSectionAssemblyResultFactory.CreateExportableSectionAssemblyResult(combinedAssembly, ExportableAssemblyMethod.WBI0A1)));
+ }
+
+ return exportableResults;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj
===================================================================
diff -u -r908306b7ca54704c91fb317dc13eeab987019f00 -rac89cba5210640fa7f0c25b6cceab5f74267dd99
--- Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision 908306b7ca54704c91fb317dc13eeab987019f00)
+++ Ringtoets/Integration/src/Ringtoets.Integration.IO/Ringtoets.Integration.IO.csproj (.../Ringtoets.Integration.IO.csproj) (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -54,6 +54,7 @@
+
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs
===================================================================
diff -u -r908306b7ca54704c91fb317dc13eeab987019f00 -rac89cba5210640fa7f0c25b6cceab5f74267dd99
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision 908306b7ca54704c91fb317dc13eeab987019f00)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableAssessmentSectionFactoryTest.cs (.../ExportableAssessmentSectionFactoryTest.cs) (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -69,6 +69,7 @@
FailureMechanismTestHelper.AddSections(assessmentSection.GrassCoverSlipOffInwards, random.Next(1, 10));
FailureMechanismTestHelper.AddSections(assessmentSection.PipingStructure, random.Next(1, 10));
FailureMechanismTestHelper.AddSections(assessmentSection.WaterPressureAsphaltCover, random.Next(1, 10));
+ FailureMechanismTestHelper.AddSections(assessmentSection.StrengthStabilityLengthwiseConstruction, random.Next(1, 10));
using (new AssemblyToolCalculatorFactoryConfig())
{
@@ -167,7 +168,7 @@
FailureMechanismAssemblyCalculatorStub failureMechanismAssemblyCalculator,
AssessmentSection assessmentSection)
{
- Assert.AreEqual(10, exportableFailureMechanisms.Count());
+ Assert.AreEqual(11, exportableFailureMechanisms.Count());
FailureMechanismAssemblyCategoryGroup expectedFailureMechanismAssemblyOutput = failureMechanismAssemblyCalculator.FailureMechanismAssemblyCategoryGroupOutput.Value;
AssertExportableFailureMechanismWithoutProbability(expectedFailureMechanismAssemblyOutput,
@@ -229,6 +230,12 @@
ExportableFailureMechanismGroup.Group4,
assessmentSection.WaterPressureAsphaltCover,
exportableFailureMechanisms.ElementAt(9));
+
+ AssertExportableFailureMechanismWithoutProbability(expectedFailureMechanismAssemblyOutput,
+ ExportableFailureMechanismType.STKWl,
+ ExportableFailureMechanismGroup.Group4,
+ assessmentSection.StrengthStabilityLengthwiseConstruction,
+ exportableFailureMechanisms.ElementAt(10));
}
private static void AssertExportableFailureMechanismWithoutProbability(FailureMechanismAssemblyCategoryGroup expectedAssemblyOutput,
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactoryTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Factories/ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactoryTest.cs (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -0,0 +1,137 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.AssemblyTool.KernelWrapper.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Ringtoets.Integration.IO.Assembly;
+using Ringtoets.Integration.IO.Factories;
+using Ringtoets.Integration.IO.TestUtil;
+
+namespace Ringtoets.Integration.IO.Test.Factories
+{
+ [TestFixture]
+ public class ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactoryTest
+ {
+ [Test]
+ public void CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () =>
+ ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanism", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism_WithFailureMechanismNotRelevant_ReturnsDefaultExportableFailureMechanism()
+ {
+ // Setup
+ var random = new Random(21);
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism
+ {
+ IsRelevant = false
+ };
+ FailureMechanismTestHelper.AddSections(failureMechanism, random.Next(2, 10));
+
+ // Call
+ ExportableFailureMechanism exportableFailureMechanism =
+ ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism(failureMechanism);
+
+ // Assert
+ Assert.AreEqual(ExportableFailureMechanismType.STKWl, exportableFailureMechanism.Code);
+ Assert.AreEqual(ExportableFailureMechanismGroup.Group4, exportableFailureMechanism.Group);
+
+ ExportableFailureMechanismAssemblyResult failureMechanismAssemblyResult = exportableFailureMechanism.FailureMechanismAssembly;
+ Assert.AreEqual(ExportableAssemblyMethod.WBI1A1, failureMechanismAssemblyResult.AssemblyMethod);
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, failureMechanismAssemblyResult.AssemblyCategory);
+
+ CollectionAssert.IsEmpty(exportableFailureMechanism.Sections);
+ CollectionAssert.IsEmpty(exportableFailureMechanism.SectionAssemblyResults);
+ }
+
+ [Test]
+ public void CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism_WithFailureMechanismRelevant_ReturnsExportableFailureMechanism()
+ {
+ // Setup
+ var random = new Random(21);
+ var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism();
+ FailureMechanismTestHelper.AddSections(failureMechanism, random.Next(2, 10));
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory)AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismAssemblyCalculatorStub failureMechanismAssemblyCalculator = calculatorfactory.LastCreatedFailureMechanismAssemblyCalculator;
+ FailureMechanismSectionAssemblyCalculatorStub failureMechanismSectionAssemblyCalculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ ExportableFailureMechanism exportableFailureMechanism =
+ ExportableStrengthStabilityLengthwiseConstructionFailureMechanismFactory.CreateExportableStrengthStabilityLengthwiseConstructionFailureMechanism(failureMechanism);
+
+ // Assert
+ Assert.AreEqual(ExportableFailureMechanismType.STKWl, exportableFailureMechanism.Code);
+ Assert.AreEqual(ExportableFailureMechanismGroup.Group4, exportableFailureMechanism.Group);
+
+ ExportableFailureMechanismAssemblyResult exportableFailureMechanismAssembly = exportableFailureMechanism.FailureMechanismAssembly;
+ Assert.AreEqual(failureMechanismAssemblyCalculator.FailureMechanismAssemblyCategoryGroupOutput, exportableFailureMechanismAssembly.AssemblyCategory);
+ Assert.AreEqual(ExportableAssemblyMethod.WBI1A1, exportableFailureMechanismAssembly.AssemblyMethod);
+
+ ExportableFailureMechanismSectionTestHelper.AssertExportableFailureMechanismSections(failureMechanism.Sections, exportableFailureMechanism.Sections);
+ AssertExportableFailureMechanismSectionResults(failureMechanismSectionAssemblyCalculator.SimpleAssessmentAssemblyOutput.Group,
+ failureMechanismSectionAssemblyCalculator.TailorMadeAssemblyCategoryOutput.Value,
+ failureMechanismSectionAssemblyCalculator.CombinedAssemblyCategoryOutput.Value,
+ exportableFailureMechanism.Sections,
+ exportableFailureMechanism.SectionAssemblyResults.Cast());
+ }
+ }
+
+ private static void AssertExportableFailureMechanismSectionResults(FailureMechanismSectionAssemblyCategoryGroup expectedSimpleAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup expectedTailorMadeAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup expectedCombinedAssembly,
+ IEnumerable sections,
+ IEnumerable results)
+ {
+ int expectedNrOfResults = sections.Count();
+ Assert.AreEqual(expectedNrOfResults, results.Count());
+
+ for (var i = 0; i < expectedNrOfResults; i++)
+ {
+ ExportableFailureMechanismSection section = sections.ElementAt(i);
+ ExportableAggregatedFailureMechanismSectionAssemblyResultWithoutDetailedAssembly result = results.ElementAt(i);
+
+ AssertExportableFailureMechanismSectionResult(expectedSimpleAssembly,
+ expectedTailorMadeAssembly,
+ expectedCombinedAssembly,
+ section,
+ result);
+ }
+ }
+
+ private static void AssertExportableFailureMechanismSectionResult(FailureMechanismSectionAssemblyCategoryGroup expectedSimpleAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup expectedTailorMadeAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup expectedCombinedAssembly,
+ ExportableFailureMechanismSection expectedSection,
+ ExportableAggregatedFailureMechanismSectionAssemblyResultWithoutDetailedAssembly actualResult)
+ {
+ Assert.AreSame(expectedSection, actualResult.FailureMechanismSection);
+
+ ExportableSectionAssemblyResultTestHelper.AssertExportableSectionAssemblyResult(expectedSimpleAssembly,
+ ExportableAssemblyMethod.WBI0E1,
+ actualResult.SimpleAssembly);
+
+ ExportableSectionAssemblyResultTestHelper.AssertExportableSectionAssemblyResult(expectedTailorMadeAssembly,
+ ExportableAssemblyMethod.WBI0T1,
+ actualResult.TailorMadeAssembly);
+
+ ExportableSectionAssemblyResultTestHelper.AssertExportableSectionAssemblyResult(expectedCombinedAssembly,
+ ExportableAssemblyMethod.WBI0A1,
+ actualResult.CombinedAssembly);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj
===================================================================
diff -u -r908306b7ca54704c91fb317dc13eeab987019f00 -rac89cba5210640fa7f0c25b6cceab5f74267dd99
--- Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision 908306b7ca54704c91fb317dc13eeab987019f00)
+++ Ringtoets/Integration/test/Ringtoets.Integration.IO.Test/Ringtoets.Integration.IO.Test.csproj (.../Ringtoets.Integration.IO.Test.csproj) (revision ac89cba5210640fa7f0c25b6cceab5f74267dd99)
@@ -56,6 +56,7 @@
+