Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.cs
===================================================================
diff -u -r16e112e326a41572a9f111a3c82bd88d668b713e -ree906b38aaaf4333436ac5e4bc4eebcc9102afa1
--- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.cs) (revision 16e112e326a41572a9f111a3c82bd88d668b713e)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.cs) (revision ee906b38aaaf4333436ac5e4bc4eebcc9102afa1)
@@ -39,12 +39,12 @@
///
/// The failure mechanism section result to assemble the
/// simple assembly results for.
- /// A based on the .
+ /// A based on the .
/// Thrown when
/// is null.
- /// Thrown when the
+ /// Thrown when the
/// could not be created.
- public static FailureMechanismSectionAssembly AssembleSimpleAssessment(
+ public static FailureMechanismSectionAssemblyCategoryGroup AssembleSimpleAssessment(
StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult failureMechanismSectionResult)
{
if (failureMechanismSectionResult == null)
@@ -58,12 +58,80 @@
try
{
- return calculator.AssembleSimpleAssessment(failureMechanismSectionResult.SimpleAssessmentResult);
+ return calculator.AssembleSimpleAssessment(failureMechanismSectionResult.SimpleAssessmentResult).Group;
}
catch (FailureMechanismSectionAssemblyCalculatorException e)
{
throw new AssemblyException(e.Message, e);
}
}
+
+ ///
+ /// Assembles the tailor made assessment result.
+ ///
+ /// The failure mechanism section result to
+ /// assemble the tailor made assembly for.
+ /// A .
+ /// Thrown when
+ /// is null.
+ /// Thrown when the
+ /// could not be created.
+ public static FailureMechanismSectionAssemblyCategoryGroup AssembleTailorMadeAssessment(
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult failureMechanismSectionResult)
+ {
+ if (failureMechanismSectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanismSectionResult));
+ }
+
+ IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance;
+ IFailureMechanismSectionAssemblyCalculator calculator =
+ calculatorFactory.CreateFailureMechanismSectionAssemblyCalculator(AssemblyToolKernelFactory.Instance);
+
+ try
+ {
+ return calculator.AssembleTailorMadeAssessment(
+ failureMechanismSectionResult.TailorMadeAssessmentResult);
+ }
+ catch (FailureMechanismSectionAssemblyCalculatorException e)
+ {
+ throw new AssemblyException(e.Message, e);
+ }
+ }
+
+ ///
+ /// Assembles the combined assembly.
+ ///
+ /// The failure mechanism section result to
+ /// combine the assemblies for.
+ /// A .
+ /// Thrown when
+ /// is null.
+ /// Thrown when the
+ /// could not be created.
+ public static FailureMechanismSectionAssemblyCategoryGroup AssembleCombinedAssessment(
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult failureMechanismSectionResult)
+ {
+ if (failureMechanismSectionResult == null)
+ {
+ throw new ArgumentNullException(nameof(failureMechanismSectionResult));
+ }
+
+ FailureMechanismSectionAssemblyCategoryGroup simpleAssembly = AssembleSimpleAssessment(failureMechanismSectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssembly = AssembleTailorMadeAssessment(failureMechanismSectionResult);
+
+ IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance;
+ IFailureMechanismSectionAssemblyCalculator calculator =
+ calculatorFactory.CreateFailureMechanismSectionAssemblyCalculator(AssemblyToolKernelFactory.Instance);
+
+ try
+ {
+ return calculator.AssembleCombined(simpleAssembly, FailureMechanismSectionAssemblyCategoryGroup.None, tailorMadeAssembly);
+ }
+ catch (FailureMechanismSectionAssemblyCalculatorException e)
+ {
+ throw new AssemblyException(e.Message, e);
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest.cs
===================================================================
diff -u -rdeeb111cd648c41702c810d6b4f13ecc67098ccb -ree906b38aaaf4333436ac5e4bc4eebcc9102afa1
--- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision deeb111cd648c41702c810d6b4f13ecc67098ccb)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest.cs) (revision ee906b38aaaf4333436ac5e4bc4eebcc9102afa1)
@@ -39,12 +39,13 @@
[TestFixture]
public class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactoryTest
{
+ #region Simple Assembly
+
[Test]
public void AssembleSimpleAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () =>
- StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(null);
+ TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(null);
// Assert
var exception = Assert.Throws(call);
@@ -88,12 +89,12 @@
FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
// Call
- FailureMechanismSectionAssembly actualOutput =
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(sectionResult);
// Assert
FailureMechanismSectionAssembly calculatorOutput = calculator.SimpleAssessmentAssemblyOutput;
- Assert.AreSame(calculatorOutput, actualOutput);
+ Assert.AreEqual(calculatorOutput.Group, actualOutput);
}
}
@@ -120,5 +121,170 @@
Assert.AreEqual(innerException.Message, exception.Message);
}
}
+
+ #endregion
+
+ #region Tailor Made Assembly
+
+ [Test]
+ public void AssembleTailorMadeAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismSectionResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_WithInput_SetsInputOnCalculator()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ Assert.AreEqual(sectionResult.TailorMadeAssessmentResult, calculator.TailorMadeAssessmentResultInput);
+ }
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_AssemblyRan_ReturnsOutput()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup? calculatorOutput = calculator.TailorMadeAssemblyCategoryOutput;
+ Assert.AreEqual(calculatorOutput, actualOutput);
+ }
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessment_CalculatorThrowsExceptions_ThrowsAssemblyException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculate = true;
+
+ // Call
+ TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(sectionResult);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
+ }
+ }
+
+ #endregion
+
+ #region Combined Assembly
+
+ [Test]
+ public void AssembleCombinedAssessment_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("failureMechanismSectionResult", exception.ParamName);
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_WithInput_SetsInputOnCalculator()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(sectionResult);
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup expectedSimpleAssembly = StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(
+ sectionResult);
+ FailureMechanismSectionAssemblyCategoryGroup expectedTailorMadeAssembly = StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssessment(
+ sectionResult);
+
+ Assert.AreEqual(expectedSimpleAssembly, calculator.CombinedSimpleAssemblyGroupInput);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.None, calculator.CombinedDetailedAssemblyGroupInput);
+ Assert.AreEqual(expectedTailorMadeAssembly, calculator.CombinedTailorMadeAssemblyGroupInput);
+ }
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_AssemblyRan_ReturnsOutput()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup actualOutput =
+ StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(sectionResult);
+
+ // Assert
+ FailureMechanismSectionAssemblyCategoryGroup? calculatorOutput = calculator.CombinedAssemblyCategoryOutput;
+ Assert.AreEqual(calculatorOutput, actualOutput);
+ }
+ }
+
+ [Test]
+ public void AssembleCombinedAssessment_CalculatorThrowsExceptions_ThrowsAssemblyException()
+ {
+ // Setup
+ var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator;
+ calculator.ThrowExceptionOnCalculateCombinedAssembly = true;
+
+ // Call
+ TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultAssemblyFactory.AssembleCombinedAssessment(sectionResult);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Exception innerException = exception.InnerException;
+ Assert.IsInstanceOf(innerException);
+ Assert.AreEqual(innerException.Message, exception.Message);
+ }
+ }
+
+ #endregion
}
}
\ No newline at end of file