Index: Ringtoets.sln
===================================================================
diff -u -rc46bf659404f3caea7f90b053a9af10d28f7da94 -r989f3f218eadf42dc262b49c3b45d7c3886d2668
--- Ringtoets.sln (.../Ringtoets.sln) (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -1785,7 +1785,7 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test", "Ringtoets\AssemblyTool\test\Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test\Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.csproj", "{2482E455-076C-4FE4-83B3-3636395F164B}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test", "Ringtoets\AssemblyTool\test\Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test\Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.csproj", "{2482E455-076C-4FE4-83B3-3636395F164B}"
ProjectSection(ProjectDependencies) = postProject
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/AssessmentGradeConversionTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismAssemblyCalculatorStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/AssemblyToolCalculatorFactoryConfigTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/CategoriesListTestFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/AssessmentSectionAssemblyKernelStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismAssemblyKernelStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/AssemblyToolKernelFactoryConfigTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Categories/AssemblyCategoriesKernelStubTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/TestAssemblyToolKernelFactoryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 989f3f218eadf42dc262b49c3b45d7c3886d2668 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/packages.config'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/AssessmentGradeConversionTestHelperTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/AssessmentGradeConversionTestHelperTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/AssessmentGradeConversionTestHelperTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,60 @@
+// Copyright (C) Stichting Deltares 2018. 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 Assembly.Kernel.Model;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test
+{
+ [TestFixture]
+ public class AssessmentGradeConversionTestHelperTest
+ {
+ [Test]
+ public void AsssementGradeConversionCases_Always_ReturnsExpectedCases()
+ {
+ // Setup
+ IEnumerable testCases = AssessmentGradeConversionTestHelper.AsssementGradeConversionCases.ToArray();
+
+ // Assert
+ var expectedCases = new[]
+ {
+ new TestCaseData(EAssessmentGrade.APlus, AssessmentSectionAssemblyCategoryGroup.APlus),
+ new TestCaseData(EAssessmentGrade.A, AssessmentSectionAssemblyCategoryGroup.A),
+ new TestCaseData(EAssessmentGrade.B, AssessmentSectionAssemblyCategoryGroup.B),
+ new TestCaseData(EAssessmentGrade.C, AssessmentSectionAssemblyCategoryGroup.C),
+ new TestCaseData(EAssessmentGrade.D, AssessmentSectionAssemblyCategoryGroup.D),
+ new TestCaseData(EAssessmentGrade.Gr, AssessmentSectionAssemblyCategoryGroup.None),
+ new TestCaseData(EAssessmentGrade.Nvt, AssessmentSectionAssemblyCategoryGroup.NotApplicable),
+ new TestCaseData(EAssessmentGrade.Ngo, AssessmentSectionAssemblyCategoryGroup.NotAssessed)
+ };
+
+ Assert.AreEqual(expectedCases.Length, testCases.Count());
+ for (var i = 0; i < testCases.Count(); i++)
+ {
+ Assert.AreEqual(expectedCases[i].Arguments[0], testCases.ElementAt(i).Arguments[0]);
+ Assert.AreEqual(expectedCases[i].Arguments[1], testCases.ElementAt(i).Arguments[1]);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,361 @@
+// Copyright (C) Stichting Deltares 2018. 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.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Assembly
+{
+ [TestFixture]
+ public class AssessmentSectionAssemblyCalculatorStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.IsNull(calculator.FailureMechanismAssemblyInput);
+ Assert.IsNull(calculator.FailureMechanismAssemblyCategoryGroupInput);
+ Assert.IsNull(calculator.FailureMechanismsWithProbabilityInput);
+ Assert.AreEqual(0.0, calculator.LowerLimitNormInput);
+ Assert.AreEqual(0.0, calculator.SignalingNormInput);
+ Assert.AreEqual(0.0, calculator.FailureProbabilityMarginFactorInput);
+ Assert.AreEqual((FailureMechanismAssemblyCategoryGroup) 0,
+ calculator.FailureMechanismsWithoutProbabilityInput);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithProbability_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismAssembly output = calculator.AssembleFailureMechanisms(Enumerable.Empty(),
+ random.NextDouble(), random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreEqual(0.75, output.Probability);
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IIIt, output.Group);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithProbability_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ AssembleFailureMechanismsAssemblyOutput = new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismAssembly output = calculator.AssembleFailureMechanisms(Enumerable.Empty(),
+ random.NextDouble(), random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.AssembleFailureMechanismsAssemblyOutput, output);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithProbability_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(21);
+ double lowerLimitNorm = random.NextDouble();
+ double signalingNorm = random.NextDouble();
+ double failureProbabilityMarginFactorInput = random.NextDouble();
+
+ IEnumerable failureMechanisms = Enumerable.Empty();
+
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleFailureMechanisms(failureMechanisms, signalingNorm, lowerLimitNorm, failureProbabilityMarginFactorInput);
+
+ // Assert
+ Assert.AreSame(failureMechanisms, calculator.FailureMechanismAssemblyInput);
+ Assert.AreEqual(lowerLimitNorm, calculator.LowerLimitNormInput);
+ Assert.AreEqual(signalingNorm, calculator.SignalingNormInput);
+ Assert.AreEqual(failureProbabilityMarginFactorInput, calculator.FailureProbabilityMarginFactorInput);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithProbability_ThrowExceptionOnCalculateTrue_ThrowsAssessmentSectionAssemblyException()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate call = () => calculator.AssembleFailureMechanisms(Enumerable.Empty(),
+ random.NextDouble(), random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithoutProbability_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismAssemblyCategoryGroup output = calculator.AssembleFailureMechanisms(Enumerable.Empty());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IIIt, output);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithoutProbability_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ AssembleFailureMechanismsAssemblyCategoryGroupOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismAssemblyCategoryGroup output = calculator.AssembleFailureMechanisms(Enumerable.Empty());
+
+ // Assert
+ Assert.AreEqual(calculator.AssembleFailureMechanismsAssemblyCategoryGroupOutput, output);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithoutProbability_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ IEnumerable failureMechanisms = Enumerable.Empty();
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleFailureMechanisms(failureMechanisms);
+
+ // Assert
+ Assert.AreSame(failureMechanisms, calculator.FailureMechanismAssemblyCategoryGroupInput);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismsWithoutProbability_ThrowExceptionOnCalculateTrue_ThrowsAssessmentSectionAssemblyException()
+ {
+ // Setup
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate call = () => calculator.AssembleFailureMechanisms(Enumerable.Empty());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleAssessmentSection_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ AssessmentSectionAssemblyCategoryGroup output =
+ calculator.AssembleAssessmentSection(random.NextEnumValue(),
+ new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue()));
+
+ // Assert
+ Assert.AreEqual(AssessmentSectionAssemblyCategoryGroup.C, output);
+ }
+
+ [Test]
+ public void AssembleAssessmentSection_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ AssembleAssessmentSectionCategoryGroupOutput = random.NextEnumValue()
+ };
+
+ // Call
+ AssessmentSectionAssemblyCategoryGroup output =
+ calculator.AssembleAssessmentSection(random.NextEnumValue(),
+ new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue()));
+
+ // Assert
+ Assert.AreEqual(calculator.AssembleAssessmentSectionCategoryGroupOutput, output);
+ }
+
+ [Test]
+ public void AssembleAssessmentSection_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(21);
+ var failureMechanismsWithoutProbability = random.NextEnumValue();
+ var failureMechanismsWithProbability = new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue());
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleAssessmentSection(failureMechanismsWithoutProbability, failureMechanismsWithProbability);
+
+ // Assert
+ Assert.AreEqual(failureMechanismsWithoutProbability, calculator.FailureMechanismsWithoutProbabilityInput);
+ Assert.AreSame(failureMechanismsWithProbability, calculator.FailureMechanismsWithProbabilityInput);
+ }
+
+ [Test]
+ public void AssembleAssessmentSection_ThrowExceptionOnCalculateTrue_ThrowsAssessmentSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate call = () =>
+ calculator.AssembleAssessmentSection(random.NextEnumValue(),
+ new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue()));
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleCombinedFailureMechanismSections_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ CombinedFailureMechanismSectionAssembly[] output =
+ calculator.AssembleCombinedFailureMechanismSections(Enumerable.Empty(),
+ new Random(21).NextDouble()).ToArray();
+
+ // Assert
+ var expectedOutput = new[]
+ {
+ new CombinedFailureMechanismSectionAssembly(
+ new CombinedAssemblyFailureMechanismSection(0, 1, FailureMechanismSectionAssemblyCategoryGroup.IIIv)
+ , new FailureMechanismSectionAssemblyCategoryGroup[0])
+ };
+ Assert.AreEqual(expectedOutput[0].Section.SectionStart, output[0].Section.SectionStart);
+ Assert.AreEqual(expectedOutput[0].Section.SectionEnd, output[0].Section.SectionEnd);
+ Assert.AreEqual(expectedOutput[0].Section.CategoryGroup, output[0].Section.CategoryGroup);
+ CollectionAssert.AreEqual(expectedOutput[0].FailureMechanismResults, output[0].FailureMechanismResults);
+ }
+
+ [Test]
+ public void AssembleCombinedFailureMechanismSections_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ CombinedFailureMechanismSectionAssemblyOutput = new[]
+ {
+ new CombinedFailureMechanismSectionAssembly(
+ new CombinedAssemblyFailureMechanismSection(random.NextDouble(), random.NextDouble(),
+ random.NextEnumValue()),
+ new[]
+ {
+ random.NextEnumValue()
+ })
+ }
+ };
+
+ // Call
+ IEnumerable output =
+ calculator.AssembleCombinedFailureMechanismSections(Enumerable.Empty(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.CombinedFailureMechanismSectionAssemblyOutput, output);
+ }
+
+ [Test]
+ public void AssembleCombinedFailureMechanismSections_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ IEnumerable> failureMechanismSections = Enumerable.Empty();
+ double assessmentSectionLength = new Random(21).NextDouble();
+ var calculator = new AssessmentSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombinedFailureMechanismSections(failureMechanismSections, assessmentSectionLength);
+
+ // Assert
+ Assert.AreSame(failureMechanismSections, calculator.CombinedFailureMechanismSectionsInput);
+ Assert.AreEqual(assessmentSectionLength, calculator.AssessmentSectionLength);
+ }
+
+ [Test]
+ public void AssembleCombinedFailureMechanismSections_ThrowExceptionOnCalculateTrue_ThrowsAssessmentSectionAssemblyException()
+ {
+ // Setup
+ var calculator = new AssessmentSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate call = () => calculator.AssembleCombinedFailureMechanismSections(Enumerable.Empty(),
+ new Random(21).NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismAssemblyCalculatorStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismAssemblyCalculatorStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismAssemblyCalculatorStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,191 @@
+// Copyright (C) Stichting Deltares 2018. 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.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Assembly
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyCalculatorStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var calculator = new FailureMechanismAssemblyCalculatorStub();
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreEqual(null, calculator.FailureMechanismAssemblyCategoryGroupOutput);
+
+ Assert.IsNull(calculator.AssemblyCategoriesInput);
+ Assert.IsNull(calculator.FailureMechanismSectionAssemblies);
+ Assert.IsNull(calculator.FailureMechanismAssemblyOutput);
+ }
+
+ [Test]
+ public void Assemble_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismAssemblyCategoryGroup category = calculator.Assemble(Enumerable.Empty());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IIt, category);
+ }
+
+ [Test]
+ public void Assemble_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismAssemblyCalculatorStub
+ {
+ FailureMechanismAssemblyCategoryGroupOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismAssemblyCategoryGroup category = calculator.Assemble(Enumerable.Empty());
+
+ // Assert
+ Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, category);
+ }
+
+ [Test]
+ public void Assemble_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub();
+ IEnumerable sectionResults = Enumerable.Empty();
+
+ // Call
+ calculator.Assemble(sectionResults);
+
+ // Assert
+ Assert.AreSame(sectionResults, calculator.FailureMechanismSectionCategories);
+ }
+
+ [Test]
+ public void Assemble_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.Assemble(Enumerable.Empty());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleWithProbabilities_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismAssembly assembly = calculator.Assemble(Enumerable.Empty(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.IIIt, assembly.Group);
+ Assert.AreEqual(1.0, assembly.Probability);
+ }
+
+ [Test]
+ public void AssembleWithProbabilities_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismAssemblyCalculatorStub
+ {
+ FailureMechanismAssemblyOutput = new FailureMechanismAssembly(random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismAssembly assembly = calculator.Assemble(Enumerable.Empty(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.FailureMechanismAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleWithProbabilities_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub();
+ IEnumerable sectionResults = Enumerable.Empty();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ // Call
+ calculator.Assemble(sectionResults, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreSame(sectionResults, calculator.FailureMechanismSectionAssemblies);
+ Assert.AreSame(assemblyCategoriesInput, calculator.AssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleWithProbabilities_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.Assemble(Enumerable.Empty(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ private static AssemblyCategoriesInput CreateAssemblyCategoriesInput()
+ {
+ var random = new Random(39);
+ return new AssemblyCategoriesInput(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,1591 @@
+// Copyright (C) Stichting Deltares 2018. 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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Primitives;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Assembly
+{
+ [TestFixture]
+ public class FailureMechanismSectionAssemblyCalculatorStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreEqual((SimpleAssessmentResultType) 0, calculator.SimpleAssessmentInput);
+ Assert.AreEqual((SimpleAssessmentValidityOnlyResultType) 0, calculator.SimpleAssessmentValidityOnlyInput);
+ Assert.IsNull(calculator.SimpleAssessmentAssemblyOutput);
+
+ Assert.AreEqual(0.0, calculator.DetailedAssessmentFailureMechanismSectionNInput);
+ Assert.AreEqual(0.0, calculator.DetailedAssessmentFailureMechanismNInput);
+ Assert.AreEqual(0.0, calculator.DetailedAssessmentProbabilityInput);
+ Assert.AreEqual((DetailedAssessmentProbabilityOnlyResultType) 0, calculator.DetailedAssessmentProbabilityOnlyResultInput);
+ Assert.IsNull(calculator.DetailedAssessmentAssemblyOutput);
+
+ Assert.AreEqual((DetailedAssessmentResultType) 0, calculator.DetailedAssessmentResultForFactorizedSignalingNormInput);
+ Assert.AreEqual((DetailedAssessmentResultType) 0, calculator.DetailedAssessmentResultForSignalingNormInput);
+ Assert.AreEqual((DetailedAssessmentResultType) 0, calculator.DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput);
+ Assert.AreEqual((DetailedAssessmentResultType) 0, calculator.DetailedAssessmentResultForLowerLimitNormInput);
+ Assert.AreEqual((DetailedAssessmentResultType) 0, calculator.DetailedAssessmentResultForFactorizedLowerLimitNormInput);
+ Assert.IsNull(calculator.DetailedAssessmentAssemblyGroupOutput);
+ Assert.IsNull(calculator.DetailedAssessmentAssemblyCategoriesInput);
+
+ Assert.AreEqual(0.0, calculator.TailorMadeAssessmentProbabilityInput);
+
+ Assert.AreEqual((TailorMadeAssessmentProbabilityAndDetailedCalculationResultType) 0,
+ calculator.TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput);
+ Assert.AreEqual((TailorMadeAssessmentProbabilityCalculationResultType) 0,
+ calculator.TailorMadeAssessmentProbabilityCalculationResultInput);
+ Assert.IsNull(calculator.TailorMadeAssessmentAssemblyOutput);
+ Assert.IsNull(calculator.TailorMadeAssessmentAssemblyCategoriesInput);
+
+ Assert.AreEqual(0.0, calculator.TailorMadeAssessmentFailureMechanismContributionInput);
+ Assert.AreEqual(0.0, calculator.TailorMadeAssessmentFailureMechanismNInput);
+ Assert.AreEqual(0.0, calculator.TailorMadeAssessmentNormativeNormInput);
+
+ Assert.IsNull(calculator.CombinedSimpleAssemblyInput);
+ Assert.IsNull(calculator.CombinedDetailedAssemblyInput);
+ Assert.IsNull(calculator.CombinedTailorMadeAssemblyInput);
+ Assert.IsNull(calculator.CombinedAssemblyOutput);
+
+ Assert.AreEqual((FailureMechanismSectionAssemblyCategoryGroup) 0, calculator.CombinedSimpleAssemblyGroupInput);
+ Assert.AreEqual((FailureMechanismSectionAssemblyCategoryGroup) 0, calculator.CombinedDetailedAssemblyGroupInput);
+ Assert.AreEqual((FailureMechanismSectionAssemblyCategoryGroup) 0, calculator.CombinedTailorMadeAssemblyGroupInput);
+ Assert.IsNull(calculator.CombinedAssemblyCategoryOutput);
+
+ Assert.AreEqual(0.0, calculator.ManualAssemblyNInput);
+ Assert.AreEqual(0.0, calculator.ManualAssemblyProbabilityInput);
+ Assert.IsNull(calculator.ManualAssemblyAssemblyOutput);
+ Assert.IsNull(calculator.ManualAssemblyCategoriesInput);
+ }
+
+ private static AssemblyCategoriesInput CreateAssemblyCategoriesInput()
+ {
+ var random = new Random(39);
+ return new AssemblyCategoriesInput(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ }
+
+ #region Simple Assessment
+
+ [Test]
+ public void AssembleSimpleAssessment_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleSimpleAssessment(SimpleAssessmentResultType.None);
+
+ // Assert
+ Assert.AreEqual(0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.Iv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessment_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleSimpleAssessment(SimpleAssessmentResultType.None);
+
+ // Assert
+ Assert.AreSame(calculator.SimpleAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessment_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ const SimpleAssessmentResultType input = SimpleAssessmentResultType.None;
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleSimpleAssessment(input);
+
+ // Assert
+ Assert.AreEqual(input, calculator.SimpleAssessmentInput);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessment_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleSimpleAssessment((SimpleAssessmentResultType) 0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleSimpleAssessment(SimpleAssessmentValidityOnlyResultType.None);
+
+ // Assert
+ Assert.AreEqual(1, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleSimpleAssessment(SimpleAssessmentValidityOnlyResultType.None);
+
+ // Assert
+ Assert.AreSame(calculator.SimpleAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ const SimpleAssessmentValidityOnlyResultType input = SimpleAssessmentValidityOnlyResultType.None;
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleSimpleAssessment(input);
+
+ // Assert
+ Assert.AreEqual(input, calculator.SimpleAssessmentValidityOnlyInput);
+ }
+
+ [Test]
+ public void AssembleSimpleAssessmentValidityOnly_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleSimpleAssessment((SimpleAssessmentValidityOnlyResultType) 0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ #endregion
+
+ #region Detailed Assessment
+
+ [Test]
+ public void AssembleDetailedAssessmentWithDetailedAssessmentResult_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleDetailedAssessment(random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithDetailedAssessmentResult_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ DetailedAssessmentAssemblyGroupOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleDetailedAssessment(random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(calculator.DetailedAssessmentAssemblyGroupOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithDetailedAssessmentResult_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var detailedAssessmentResult = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleDetailedAssessment(detailedAssessmentResult);
+
+ // Assert
+ Assert.AreEqual(detailedAssessmentResult, calculator.DetailedAssessmentResultInput);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithDetailedAssessmentResult_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleDetailedAssessment(random.NextEnumValue());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(1.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.DetailedAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ var detailedAssessmentResult = random.NextEnumValue();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleDetailedAssessment(detailedAssessmentResult, probability, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(detailedAssessmentResult, calculator.DetailedAssessmentProbabilityOnlyResultInput);
+ Assert.AreEqual(probability, calculator.DetailedAssessmentProbabilityInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.DetailedAssessmentAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessment_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithNormativeNorm_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreEqual(0.25, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IVv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithNormativeNorm_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.DetailedAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithNormativeNorm_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ double normativeNorm = random.NextDouble();
+ double n = random.NextDouble(1, 10);
+ double failureMechanismContribution = random.NextDouble();
+ var detailedAssessmentResult = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleDetailedAssessment(detailedAssessmentResult,
+ probability,
+ normativeNorm,
+ n,
+ failureMechanismContribution);
+
+ // Assert
+ Assert.AreEqual(detailedAssessmentResult, calculator.DetailedAssessmentProbabilityOnlyResultInput);
+ Assert.AreEqual(probability, calculator.DetailedAssessmentProbabilityInput);
+ Assert.AreEqual(normativeNorm, calculator.DetailedAssessmentNormativeNormInput);
+ Assert.AreEqual(n, calculator.DetailedAssessmentFailureMechanismNInput);
+ Assert.AreEqual(failureMechanismContribution, calculator.DetailedAssessmentFailureMechanismContribution);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithNormativeNorm_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(1, 10),
+ random.NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(0.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.DetailedAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ double n = random.NextDouble(1.0, 10.0);
+ var detailedAssessmentResult = random.NextEnumValue();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleDetailedAssessment(detailedAssessmentResult, probability, n, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(detailedAssessmentResult, calculator.DetailedAssessmentProbabilityOnlyResultInput);
+ Assert.AreEqual(probability, calculator.DetailedAssessmentProbabilityInput);
+ Assert.AreEqual(n, calculator.DetailedAssessmentFailureMechanismSectionNInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.DetailedAssessmentAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithLengthEffect_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithCategoryResults_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithCategoryResults_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ DetailedAssessmentAssemblyGroupOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(calculator.DetailedAssessmentAssemblyGroupOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithCategoryResults_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var detailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleDetailedAssessment(detailedAssessmentResultForFactorizedSignalingNorm,
+ detailedAssessmentResultForSignalingNorm,
+ detailedAssessmentResultForMechanismSpecificLowerLimitNorm,
+ detailedAssessmentResultForLowerLimitNorm,
+ detailedAssessmentResultForFactorizedLowerLimitNorm);
+
+ // Assert
+ Assert.AreEqual(detailedAssessmentResultForFactorizedSignalingNorm, calculator.DetailedAssessmentResultForFactorizedSignalingNormInput);
+ Assert.AreEqual(detailedAssessmentResultForSignalingNorm, calculator.DetailedAssessmentResultForSignalingNormInput);
+ Assert.AreEqual(detailedAssessmentResultForMechanismSpecificLowerLimitNorm, calculator.DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput);
+ Assert.AreEqual(detailedAssessmentResultForLowerLimitNorm, calculator.DetailedAssessmentResultForLowerLimitNormInput);
+ Assert.AreEqual(detailedAssessmentResultForFactorizedLowerLimitNorm, calculator.DetailedAssessmentResultForFactorizedLowerLimitNormInput);
+ }
+
+ [Test]
+ public void AssembleDetailedAssessmentWithCategoryResults_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleDetailedAssessment(
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue(),
+ random.NextEnumValue());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ #endregion
+
+ #region Tailor Made Assessment
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithTailorMadeAssessmentResult_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleTailorMadeAssessment(random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithTailorMadeAssessmentResult_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ TailorMadeAssemblyCategoryOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleTailorMadeAssessment(random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(calculator.TailorMadeAssemblyCategoryOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithTailorMadeAssessmentResult_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleTailorMadeAssessment(tailorMadeAssessmentResult);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssessmentResult, calculator.TailorMadeAssessmentResultInput);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithTailorMadeAssessmentResult_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleTailorMadeAssessment(random.NextEnumValue());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityAndDetailedCalculationResult_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreEqual(1.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityAndDetailedCalculationResult_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.TailorMadeAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityAndDetailedCalculationResult_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double probability = random.NextDouble();
+ double normativeNorm = random.NextDouble();
+ double n = random.NextDouble();
+ double failureMechanismContribution = random.NextDouble();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleTailorMadeAssessment(tailorMadeAssessmentResult, probability, normativeNorm, n, failureMechanismContribution);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssessmentResult, calculator.TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput);
+ Assert.AreEqual(probability, calculator.TailorMadeAssessmentProbabilityInput);
+ Assert.AreEqual(normativeNorm, calculator.TailorMadeAssessmentNormativeNormInput);
+ Assert.AreEqual(n, calculator.TailorMadeAssessmentFailureMechanismNInput);
+ Assert.AreEqual(failureMechanismContribution, calculator.TailorMadeAssessmentFailureMechanismContributionInput);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityAndDetailedCalculationResult_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResult_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(1.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResult_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.TailorMadeAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResult_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleTailorMadeAssessment(tailorMadeAssessmentResult, probability, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssessmentResult, calculator.TailorMadeAssessmentProbabilityCalculationResultInput);
+ Assert.AreEqual(probability, calculator.TailorMadeAssessmentProbabilityInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.TailorMadeAssessmentAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResult_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResultWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(1.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResultWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.TailorMadeAssessmentAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResultWithLengthEffect_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ double n = random.NextDouble();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleTailorMadeAssessment(tailorMadeAssessmentResult, probability, n, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssessmentResult, calculator.TailorMadeAssessmentProbabilityCalculationResultInput);
+ Assert.AreEqual(probability, calculator.TailorMadeAssessmentProbabilityInput);
+ Assert.AreEqual(n, calculator.TailorMadeAssessmentFailureMechanismSectionNInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.TailorMadeAssessmentAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithProbabilityCalculationResultWithLengthEffect_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue(),
+ random.NextDouble(),
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithCategoryGroupResult_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.Iv, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithCategoryGroupResult_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ TailorMadeAssemblyCategoryOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup assembly = calculator.AssembleTailorMadeAssessment(
+ random.NextEnumValue());
+
+ // Assert
+ Assert.AreEqual(calculator.TailorMadeAssemblyCategoryOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithCategoryGroupResult_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleTailorMadeAssessment(tailorMadeAssessmentResult);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssessmentResult, calculator.TailorMadeAssessmentCategoryGroupResultInput);
+ }
+
+ [Test]
+ public void AssembleTailorMadeAssessmentWithCategoryGroupResult_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleTailorMadeAssessment(random.NextEnumValue());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ #endregion
+
+ #region Combined Assembly
+
+ [Test]
+ public void AssembleCombinedWithProbabilitiesAndSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly combinedAssembly = calculator.AssembleCombined(simpleAssembly);
+
+ // Assert
+ Assert.AreSame(simpleAssembly, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilitiesAndSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ CombinedAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly combinedAssembly = calculator.AssembleCombined(null);
+
+ // Assert
+ Assert.AreSame(calculator.CombinedAssemblyOutput, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilitiesAndSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombined(simpleAssembly);
+
+ // Assert
+ Assert.AreSame(simpleAssembly, calculator.CombinedSimpleAssemblyInput);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilitiesAndSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculateCombinedAssembly = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleCombined(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilities_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly combinedAssembly = calculator.AssembleCombined(null, null, tailorMadeAssembly);
+
+ // Assert
+ Assert.AreSame(tailorMadeAssembly, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilities_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ CombinedAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly combinedAssembly = calculator.AssembleCombined(null, null, null);
+
+ // Assert
+ Assert.AreSame(calculator.CombinedAssemblyOutput, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilities_ThrowExceptionOnCalculateCombinedAssemblyFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ var detailedAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+ var tailorMadeAssembly = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue());
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombined(simpleAssembly, detailedAssembly, tailorMadeAssembly);
+
+ // Assert
+ Assert.AreSame(simpleAssembly, calculator.CombinedSimpleAssemblyInput);
+ Assert.AreSame(detailedAssembly, calculator.CombinedDetailedAssemblyInput);
+ Assert.AreSame(tailorMadeAssembly, calculator.CombinedTailorMadeAssemblyInput);
+ }
+
+ [Test]
+ public void AssembleCombinedWithProbabilities_ThrowExceptionOnCalculateCombinedAssemblyTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculateCombinedAssembly = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleCombined(null, null, null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAndTailorMadeAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(
+ random.NextEnumValue(),
+ tailorMadeAssembly);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssembly, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAndTailorMadeAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ CombinedAssemblyCategoryOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(0, 0);
+
+ // Assert
+ Assert.AreEqual(calculator.CombinedAssemblyCategoryOutput, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAndTailorMadeAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = random.NextEnumValue();
+ var tailorMadeAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombined(simpleAssembly, tailorMadeAssembly);
+
+ // Assert
+ Assert.AreEqual(simpleAssembly, calculator.CombinedSimpleAssemblyGroupInput);
+ Assert.AreEqual((FailureMechanismSectionAssemblyCategoryGroup) 0, calculator.CombinedDetailedAssemblyGroupInput);
+ Assert.AreEqual(tailorMadeAssembly, calculator.CombinedTailorMadeAssemblyGroupInput);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAndTailorMadeAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculateCombinedAssembly = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleCombined(0, 0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(simpleAssembly);
+
+ // Assert
+ Assert.AreEqual(simpleAssembly, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ CombinedAssemblyCategoryOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(0);
+
+ // Assert
+ Assert.AreEqual(calculator.CombinedAssemblyCategoryOutput, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombined(simpleAssembly);
+
+ // Assert
+ Assert.AreEqual(simpleAssembly, calculator.CombinedSimpleAssemblyGroupInput);
+ }
+
+ [Test]
+ public void AssembleCombinedWithSimpleAssemblyOnly_ThrowExceptionOnCalculateCombinedAssemblyTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculateCombinedAssembly = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleCombined(0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleCombined_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var tailorMadeAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(0, 0, tailorMadeAssembly);
+
+ // Assert
+ Assert.AreEqual(tailorMadeAssembly, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombined_ThrowExceptionOnCalculateCombinedAssemblyFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ CombinedAssemblyCategoryOutput = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismSectionAssemblyCategoryGroup combinedAssembly = calculator.AssembleCombined(0, 0, 0);
+
+ // Assert
+ Assert.AreEqual(calculator.CombinedAssemblyCategoryOutput, combinedAssembly);
+ }
+
+ [Test]
+ public void AssembleCombined_ThrowExceptionOnCalculateCombinedAssemblyFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssembly = random.NextEnumValue();
+ var detailedAssembly = random.NextEnumValue();
+ var tailorMadeAssembly = random.NextEnumValue();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleCombined(simpleAssembly, detailedAssembly, tailorMadeAssembly);
+
+ // Assert
+ Assert.AreEqual(simpleAssembly, calculator.CombinedSimpleAssemblyGroupInput);
+ Assert.AreEqual(detailedAssembly, calculator.CombinedDetailedAssemblyGroupInput);
+ Assert.AreEqual(tailorMadeAssembly, calculator.CombinedTailorMadeAssemblyGroupInput);
+ }
+
+ [Test]
+ public void AssembleCombined_ThrowExceptionOnCalculateCombinedAssemblyTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculateCombinedAssembly = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleCombined(0, 0, 0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ #endregion
+
+ #region Manual Assessment
+
+ [Test]
+ public void AssembleManual_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleManual(
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(0.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.IIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleManual_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ManualAssemblyAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleManual(
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.ManualAssemblyAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleManual_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleManual(probability, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(probability, calculator.ManualAssemblyProbabilityInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.ManualAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleManual_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleManual(
+ random.NextDouble(),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void AssembleManualWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleManual(
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreEqual(1.0, assembly.Probability);
+ Assert.AreEqual(FailureMechanismSectionAssemblyCategoryGroup.VIIv, assembly.Group);
+ }
+
+ [Test]
+ public void AssembleManualWithLengthEffect_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnOutput()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ManualAssemblyAssemblyOutput = new FailureMechanismSectionAssembly(
+ random.NextDouble(),
+ random.NextEnumValue())
+ };
+
+ // Call
+ FailureMechanismSectionAssembly assembly = calculator.AssembleManual(
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.ManualAssemblyAssemblyOutput, assembly);
+ }
+
+ [Test]
+ public void AssembleManualWithLengthEffect_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double probability = random.NextDouble();
+ double n = random.NextDouble(1.0, 10.0);
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub();
+
+ // Call
+ calculator.AssembleManual(probability, n, assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreEqual(probability, calculator.ManualAssemblyProbabilityInput);
+ Assert.AreEqual(n, calculator.ManualAssemblyNInput);
+ Assert.AreSame(assemblyCategoriesInput, calculator.ManualAssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void AssembleManualWithLengthEffect_ThrowExceptionOnCalculateTrue_ThrowsFailureMechanismSectionAssemblyCalculatorException()
+ {
+ // Setup
+ var random = new Random(39);
+ var calculator = new FailureMechanismSectionAssemblyCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.AssembleManual(
+ random.NextDouble(),
+ random.NextDouble(1.0, 10.0),
+ CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/AssemblyToolCalculatorFactoryConfigTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/AssemblyToolCalculatorFactoryConfigTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/AssemblyToolCalculatorFactoryConfigTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,67 @@
+// Copyright (C) Stichting Deltares 2018. 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 NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators
+{
+ [TestFixture]
+ public class AssemblyToolCalculatorFactoryConfigTest
+ {
+ [Test]
+ public void Constructor_NewInstanceCanBeDisposed()
+ {
+ // Call
+ var factory = new AssemblyToolCalculatorFactoryConfig();
+
+ // Assert
+ Assert.IsInstanceOf(factory);
+ Assert.DoesNotThrow(() => factory.Dispose());
+ }
+
+ [Test]
+ public void Constructor_SetsTestFactoryForAssemblyToolCalculatorFactory()
+ {
+ // Call
+ using (new AssemblyToolCalculatorFactoryConfig())
+ {
+ // Assert
+ Assert.IsInstanceOf(AssemblyToolCalculatorFactory.Instance);
+ }
+ }
+
+ [Test]
+ public void Dispose_Always_ResetsFactoryToPreviousValue()
+ {
+ // Setup
+ IAssemblyToolCalculatorFactory expectedFactory = AssemblyToolCalculatorFactory.Instance;
+
+ // Call
+ using (new AssemblyToolCalculatorFactoryConfig()) {}
+
+ // Assert
+ Assert.AreSame(expectedFactory, AssemblyToolCalculatorFactory.Instance);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,401 @@
+// Copyright (C) Stichting Deltares 2018. 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 NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Categories;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators.Categories
+{
+ [TestFixture]
+ public class AssemblyCategoriesCalculatorStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.IsNull(calculator.AssessmentSectionCategoriesOutput);
+ Assert.IsNull(calculator.FailureMechanismSectionCategoriesOutput);
+ Assert.IsNull(calculator.AssemblyCategoriesInput);
+ Assert.AreEqual(0.0, calculator.SignalingNorm);
+ Assert.AreEqual(0.0, calculator.LowerLimitNorm);
+ Assert.AreEqual(0.0, calculator.NormativeNorm);
+ Assert.AreEqual(0.0, calculator.FailureMechanismN);
+ Assert.AreEqual(0.0, calculator.FailureMechanismContribution);
+ }
+
+ [Test]
+ public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ IEnumerable result = calculator.CalculateAssessmentSectionCategories(0, 0);
+
+ // Assert
+ Assert.AreSame(calculator.AssessmentSectionCategoriesOutput, result);
+ Assert.AreEqual(3, result.Count());
+ CollectionAssert.AreEqual(new[]
+ {
+ 1,
+ 2.01,
+ 3.01
+ }, result.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ 2,
+ 3,
+ 4
+ }, result.Select(r => r.UpperBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ AssessmentSectionAssemblyCategoryGroup.A,
+ AssessmentSectionAssemblyCategoryGroup.B,
+ AssessmentSectionAssemblyCategoryGroup.C
+ }, result.Select(r => r.Group));
+ }
+
+ [Test]
+ public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ AssessmentSectionCategoriesOutput = Enumerable.Empty()
+ };
+
+ // Call
+ IEnumerable result = calculator.CalculateAssessmentSectionCategories(0, 0);
+
+ // Assert
+ Assert.AreSame(calculator.AssessmentSectionCategoriesOutput, result);
+ }
+
+ [Test]
+ public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(39);
+ double signalingNorm = random.NextDouble();
+ double lowerLimitNorm = random.NextDouble();
+
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ calculator.CalculateAssessmentSectionCategories(signalingNorm, lowerLimitNorm);
+
+ // Assert
+ Assert.AreEqual(signalingNorm, calculator.SignalingNorm);
+ Assert.AreEqual(lowerLimitNorm, calculator.LowerLimitNorm);
+ }
+
+ [Test]
+ public void CalculateAssessmentSectionCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesCalculatorException()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.CalculateAssessmentSectionCategories(0, 0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismCategories_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ IEnumerable result = calculator.CalculateFailureMechanismCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.FailureMechanismCategoriesOutput, result);
+ Assert.AreEqual(3, result.Count());
+ CollectionAssert.AreEqual(new[]
+ {
+ 1,
+ 2.01,
+ 3.01
+ }, result.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ 2,
+ 3,
+ 4
+ }, result.Select(r => r.UpperBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ FailureMechanismAssemblyCategoryGroup.It,
+ FailureMechanismAssemblyCategoryGroup.IIt,
+ FailureMechanismAssemblyCategoryGroup.IIIt
+ }, result.Select(r => r.Group));
+ }
+
+ [Test]
+ public void CalculateFailureMechanismCategories_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ FailureMechanismCategoriesOutput = Enumerable.Empty()
+ };
+
+ // Call
+ IEnumerable result = calculator.CalculateFailureMechanismCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.FailureMechanismCategoriesOutput, result);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismCategories_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ calculator.CalculateFailureMechanismCategories(
+ assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreSame(assemblyCategoriesInput, calculator.AssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesCalculatorException()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.CalculateFailureMechanismCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ IEnumerable result = calculator.CalculateFailureMechanismSectionCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.FailureMechanismSectionCategoriesOutput, result);
+ Assert.AreEqual(3, result.Count());
+ CollectionAssert.AreEqual(new[]
+ {
+ 1,
+ 2.01,
+ 3.01
+ }, result.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ 2,
+ 3,
+ 4
+ }, result.Select(r => r.UpperBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ FailureMechanismSectionAssemblyCategoryGroup.Iv,
+ FailureMechanismSectionAssemblyCategoryGroup.IIv,
+ FailureMechanismSectionAssemblyCategoryGroup.IIIv
+ }, result.Select(r => r.Group));
+ }
+
+ [Test]
+ public void CalculateFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnsCategories()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ FailureMechanismSectionCategoriesOutput = Enumerable.Empty()
+ };
+
+ // Call
+ IEnumerable result = calculator.CalculateFailureMechanismSectionCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ Assert.AreSame(calculator.FailureMechanismSectionCategoriesOutput, result);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput();
+
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ calculator.CalculateFailureMechanismSectionCategories(
+ assemblyCategoriesInput);
+
+ // Assert
+ Assert.AreSame(assemblyCategoriesInput, calculator.AssemblyCategoriesInput);
+ }
+
+ [Test]
+ public void CalculateFailureMechanismSectionCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesCalculatorException()
+ {
+ // Setup
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.CalculateFailureMechanismSectionCategories(CreateAssemblyCategoriesInput());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ [Test]
+ public void CalculateGeotechnicalFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalseAndOutputNotSet_ReturnsCategories()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ IEnumerable result = calculator.CalculateGeotechnicalFailureMechanismSectionCategories(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.GeotechnicalFailureMechanismSectionCategoriesOutput, result);
+ Assert.AreEqual(3, result.Count());
+ CollectionAssert.AreEqual(new[]
+ {
+ 1,
+ 2.2,
+ 3.2
+ }, result.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ 2.1,
+ 3.1,
+ 4
+ }, result.Select(r => r.UpperBoundary));
+ CollectionAssert.AreEqual(new[]
+ {
+ FailureMechanismSectionAssemblyCategoryGroup.IIIv,
+ FailureMechanismSectionAssemblyCategoryGroup.IVv,
+ FailureMechanismSectionAssemblyCategoryGroup.Vv
+ }, result.Select(r => r.Group));
+ }
+
+ [Test]
+ public void CalculateGeotechnicalFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalseAndOutputSet_ReturnsCategories()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ GeotechnicalFailureMechanismSectionCategoriesOutput = Enumerable.Empty()
+ };
+
+ // Call
+ IEnumerable result = calculator.CalculateGeotechnicalFailureMechanismSectionCategories(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ Assert.AreSame(calculator.GeotechnicalFailureMechanismSectionCategoriesOutput, result);
+ }
+
+ [Test]
+ public void CalculateGeotechnicalFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalse_SetsInput()
+ {
+ // Setup
+ var random = new Random(21);
+ double normativeNorm = random.NextDouble();
+ double n = random.NextDouble();
+ double failureMechanismContribution = random.NextDouble();
+
+ var calculator = new AssemblyCategoriesCalculatorStub();
+
+ // Call
+ calculator.CalculateGeotechnicalFailureMechanismSectionCategories(normativeNorm, n, failureMechanismContribution);
+
+ // Assert
+ Assert.AreEqual(normativeNorm, calculator.NormativeNorm);
+ Assert.AreEqual(n, calculator.FailureMechanismN);
+ Assert.AreEqual(failureMechanismContribution, calculator.FailureMechanismContribution);
+ }
+
+ [Test]
+ public void CalculateGeotechnicalFailureMechanismSectionCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesCalculatorException()
+ {
+ // Setup
+ var random = new Random(21);
+ var calculator = new AssemblyCategoriesCalculatorStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => calculator.CalculateGeotechnicalFailureMechanismSectionCategories(random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ }
+
+ private static AssemblyCategoriesInput CreateAssemblyCategoriesInput()
+ {
+ return new AssemblyCategoriesInput(0, 0, 0, 0);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,105 @@
+// Copyright (C) Stichting Deltares 2018. 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 NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Categories;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Calculators
+{
+ [TestFixture]
+ public class TestAssemblyToolCalculatorFactoryTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var factory = new TestAssemblyToolCalculatorFactory();
+
+ // Assert
+ Assert.IsInstanceOf(factory);
+ Assert.IsNotNull(factory.LastCreatedAssemblyCategoriesCalculator);
+ Assert.IsNotNull(factory.LastCreatedFailureMechanismSectionAssemblyCalculator);
+ Assert.IsNotNull(factory.LastCreatedFailureMechanismAssemblyCalculator);
+ Assert.IsNotNull(factory.LastCreatedAssessmentSectionAssemblyCalculator);
+ }
+
+ [Test]
+ public void CreateAssemblyCategoriesCalculator_Always_ReturnStub()
+ {
+ // Setup
+ var factory = new TestAssemblyToolCalculatorFactory();
+
+ // Call
+ IAssemblyCategoriesCalculator calculator = factory.CreateAssemblyCategoriesCalculator(null);
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreSame(factory.LastCreatedAssemblyCategoriesCalculator, calculator);
+ }
+
+ [Test]
+ public void CreateFailureMechanismSectionAssemblyCalculator_Always_ReturnStub()
+ {
+ // Setup
+ var factory = new TestAssemblyToolCalculatorFactory();
+
+ // Call
+ IFailureMechanismSectionAssemblyCalculator calculator = factory.CreateFailureMechanismSectionAssemblyCalculator(null);
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreSame(factory.LastCreatedFailureMechanismSectionAssemblyCalculator, calculator);
+ }
+
+ [Test]
+ public void CreateFailureMechanismAssemblyCalculator_Always_ReturnStub()
+ {
+ // Setup
+ var factory = new TestAssemblyToolCalculatorFactory();
+
+ // Call
+ IFailureMechanismAssemblyCalculator calculator = factory.CreateFailureMechanismAssemblyCalculator(null);
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreSame(factory.LastCreatedFailureMechanismAssemblyCalculator, calculator);
+ }
+
+ [Test]
+ public void CreateAssessmentSectionAssemblyCalculator_Always_ReturnsStub()
+ {
+ // Setup
+ var factory = new TestAssemblyToolCalculatorFactory();
+
+ // Call
+ IAssessmentSectionAssemblyCalculator calculator = factory.CreateAssessmentSectionAssemblyCalculator(null);
+
+ // Assert
+ Assert.IsInstanceOf(calculator);
+ Assert.AreSame(factory.LastCreatedAssessmentSectionAssemblyCalculator, calculator);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/CategoriesListTestFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/CategoriesListTestFactoryTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/CategoriesListTestFactoryTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,105 @@
+// Copyright (C) Stichting Deltares 2018. 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 Assembly.Kernel.Model.CategoryLimits;
+using NUnit.Framework;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test
+{
+ [TestFixture]
+ public class CategoriesListTestFactoryTest
+ {
+ [Test]
+ public void CreateFailureMechanismSectionCategories_Always_ReturnsValidCategoriesList()
+ {
+ // Call
+ CategoriesList categories = CategoriesListTestFactory.CreateFailureMechanismSectionCategories();
+
+ // Assert
+ Assert.IsNotNull(categories);
+
+ FmSectionCategory[] sectionCategories = categories.Categories;
+ Assert.AreEqual(4, sectionCategories.Length);
+
+ Assert.AreEqual(0, sectionCategories[0].LowerLimit);
+ Assert.AreEqual(0.25, sectionCategories[0].UpperLimit);
+
+ Assert.AreEqual(0.25, sectionCategories[1].LowerLimit);
+ Assert.AreEqual(0.5, sectionCategories[1].UpperLimit);
+
+ Assert.AreEqual(0.5, sectionCategories[2].LowerLimit);
+ Assert.AreEqual(0.75, sectionCategories[2].UpperLimit);
+
+ Assert.AreEqual(0.75, sectionCategories[3].LowerLimit);
+ Assert.AreEqual(1, sectionCategories[3].UpperLimit);
+ }
+
+ [Test]
+ public void CreateFailureMechanismCategories_Always_ReturnsValidCategoriesList()
+ {
+ // Call
+ CategoriesList categories = CategoriesListTestFactory.CreateFailureMechanismCategories();
+
+ // Assert
+ Assert.IsNotNull(categories);
+
+ FailureMechanismCategory[] sectionCategories = categories.Categories;
+ Assert.AreEqual(4, sectionCategories.Length);
+
+ Assert.AreEqual(0, sectionCategories[0].LowerLimit);
+ Assert.AreEqual(0.25, sectionCategories[0].UpperLimit);
+
+ Assert.AreEqual(0.25, sectionCategories[1].LowerLimit);
+ Assert.AreEqual(0.5, sectionCategories[1].UpperLimit);
+
+ Assert.AreEqual(0.5, sectionCategories[2].LowerLimit);
+ Assert.AreEqual(0.75, sectionCategories[2].UpperLimit);
+
+ Assert.AreEqual(0.75, sectionCategories[3].LowerLimit);
+ Assert.AreEqual(1, sectionCategories[3].UpperLimit);
+ }
+
+ [Test]
+ public void CreateAssessmentSectionCategories_Always_ReturnsValidCategoriesList()
+ {
+ // Call
+ CategoriesList categories = CategoriesListTestFactory.CreateAssessmentSectionCategories();
+
+ // Assert
+ Assert.IsNotNull(categories);
+
+ AssessmentSectionCategory[] sectionCategories = categories.Categories;
+ Assert.AreEqual(4, sectionCategories.Length);
+
+ Assert.AreEqual(0, sectionCategories[0].LowerLimit);
+ Assert.AreEqual(0.25, sectionCategories[0].UpperLimit);
+
+ Assert.AreEqual(0.25, sectionCategories[1].LowerLimit);
+ Assert.AreEqual(0.5, sectionCategories[1].UpperLimit);
+
+ Assert.AreEqual(0.5, sectionCategories[2].LowerLimit);
+ Assert.AreEqual(0.75, sectionCategories[2].UpperLimit);
+
+ Assert.AreEqual(0.75, sectionCategories[3].LowerLimit);
+ Assert.AreEqual(1, sectionCategories[3].UpperLimit);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/AssessmentSectionAssemblyKernelStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/AssessmentSectionAssemblyKernelStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/AssessmentSectionAssemblyKernelStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,331 @@
+// Copyright (C) Stichting Deltares 2018. 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels.Assembly
+{
+ [TestFixture]
+ public class AssessmentSectionAssemblyKernelStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var kernel = new AssessmentSectionAssemblyKernelStub();
+
+ // Assert
+ Assert.IsInstanceOf(kernel);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResult);
+ Assert.IsNull(kernel.FailureMechanismCategories);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResults);
+ Assert.IsNull(kernel.AssemblyResultNoFailureProbability);
+ Assert.IsNull(kernel.AssemblyResultWithFailureProbability);
+ Assert.AreEqual((EAssessmentGrade) 0, kernel.AssessmentSectionAssemblyResult);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2A1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ bool partialAssembly = random.NextBoolean();
+ IEnumerable assemblyResults = Enumerable.Empty();
+
+ var kernel = new AssessmentSectionAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.AssembleAssessmentSectionWbi2A1(assemblyResults, partialAssembly);
+
+ // Assert
+ Assert.IsTrue(kernel.Calculated);
+ Assert.AreEqual(partialAssembly, kernel.PartialAssembly);
+ Assert.AreSame(assemblyResults, kernel.FailureMechanismAssemblyResults);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2A1_KernelDoesNotThrowException_ReturnAssessmentGrade()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ FailureMechanismCategoryResult = random.NextEnumValue()
+ };
+
+ // Call
+ EFailureMechanismCategory result = kernel.AssembleAssessmentSectionWbi2A1(Enumerable.Empty(),
+ random.NextBoolean());
+
+ // Assert
+ Assert.AreEqual(kernel.FailureMechanismCategoryResult, result);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2A1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2A1(Enumerable.Empty(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResults);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2A1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2A1(Enumerable.Empty(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+
+ Assert.IsNull(kernel.FailureMechanismAssemblyResults);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2B1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ bool partialAssembly = random.NextBoolean();
+ IEnumerable assemblyResults = Enumerable.Empty();
+ CategoriesList categories = CategoriesListTestFactory.CreateFailureMechanismCategories();
+
+ var kernel = new AssessmentSectionAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.AssembleAssessmentSectionWbi2B1(assemblyResults, categories, partialAssembly);
+
+ // Assert
+ Assert.IsTrue(kernel.Calculated);
+ Assert.AreEqual(partialAssembly, kernel.PartialAssembly);
+ Assert.AreSame(assemblyResults, kernel.FailureMechanismAssemblyResults);
+ Assert.AreSame(categories, kernel.FailureMechanismCategories);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2B1_KernelDoesNotThrowException_ReturnAssessmentGrade()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ FailureMechanismAssemblyResult = CreateFailureMechanismAssemblyResult()
+ };
+
+ // Call
+ FailureMechanismAssemblyResult result = kernel.AssembleAssessmentSectionWbi2B1(Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ random.NextBoolean());
+
+ // Assert
+ Assert.AreEqual(kernel.FailureMechanismAssemblyResult, result);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2B1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2B1(Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResults);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2B1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2B1(Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResults);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2C1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ var assemblyResultNoFailureProbability = random.NextEnumValue();
+ FailureMechanismAssemblyResult assemblyResultWithFailureProbability = CreateFailureMechanismAssemblyResult();
+
+ var kernel = new AssessmentSectionAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.AssembleAssessmentSectionWbi2C1(assemblyResultNoFailureProbability,
+ assemblyResultWithFailureProbability);
+
+ // Assert
+ Assert.IsTrue(kernel.Calculated);
+ Assert.AreEqual(assemblyResultNoFailureProbability, kernel.AssemblyResultNoFailureProbability);
+ Assert.AreSame(assemblyResultWithFailureProbability, kernel.AssemblyResultWithFailureProbability);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2C1_KernelDoesNotThrowException_ReturnAssessmentGrade()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ AssessmentSectionAssemblyResult = random.NextEnumValue()
+ };
+
+ // Call
+ EAssessmentGrade result = kernel.AssembleAssessmentSectionWbi2C1(random.NextEnumValue(),
+ CreateFailureMechanismAssemblyResult());
+
+ // Assert
+ Assert.AreEqual(kernel.AssessmentSectionAssemblyResult, result);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2C1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2C1(random.NextEnumValue(),
+ CreateFailureMechanismAssemblyResult());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.AssemblyResultNoFailureProbability);
+ Assert.IsNull(kernel.AssemblyResultWithFailureProbability);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleAssessmentSectionWbi2C1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new AssessmentSectionAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleAssessmentSectionWbi2C1(random.NextEnumValue(),
+ CreateFailureMechanismAssemblyResult());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.AssemblyResultNoFailureProbability);
+ Assert.IsNull(kernel.AssemblyResultWithFailureProbability);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ private static FailureMechanismAssemblyResult CreateFailureMechanismAssemblyResult()
+ {
+ var random = new Random(21);
+ return new FailureMechanismAssemblyResult(random.NextEnumValue(),
+ random.NextDouble());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,197 @@
+// Copyright (C) Stichting Deltares 2018. 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels.Assembly
+{
+ [TestFixture]
+ public class CombinedFailureMechanismSectionAssemblyKernelStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+
+ // Assert
+ Assert.IsInstanceOf(kernel);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsNull(kernel.AssessmentSectionLengthInput);
+ Assert.IsNull(kernel.FailureMechanismSectionListsInput);
+ Assert.IsNull(kernel.AssemblyResult);
+ }
+
+ [Test]
+ public void AssembleCommonFailureMechanismSections_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(21);
+ bool partialAssembly = random.NextBoolean();
+ double assessmentSectionLength = random.NextDouble();
+ IEnumerable failureMechanismSectionLists = Enumerable.Empty();
+
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+
+ // Call
+ kernel.AssembleCommonFailureMechanismSections(failureMechanismSectionLists, assessmentSectionLength, partialAssembly);
+
+ // Assert
+ Assert.IsTrue(kernel.Calculated);
+ Assert.AreSame(failureMechanismSectionLists, kernel.FailureMechanismSectionListsInput);
+ Assert.AreEqual(assessmentSectionLength, kernel.AssessmentSectionLengthInput);
+ Assert.AreEqual(partialAssembly, kernel.PartialAssembly);
+ }
+
+ [Test]
+ public void AssembleCommonFailureMechanismSections_KernelDoesNotThrowException_ReturnAssessmentGrade()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub
+ {
+ AssemblyResult = new AssemblyResult(Enumerable.Empty(), Enumerable.Empty())
+ };
+
+ // Call
+ AssemblyResult result = kernel.AssembleCommonFailureMechanismSections(Enumerable.Empty(),
+ random.NextDouble(),
+ random.NextBoolean());
+
+ // Assert
+ Assert.AreEqual(kernel.AssemblyResult, result);
+ }
+
+ [Test]
+ public void AssembleCommonFailureMechanismSections_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleCommonFailureMechanismSections(Enumerable.Empty(),
+ random.NextDouble(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.AssessmentSectionLengthInput);
+ Assert.IsNull(kernel.FailureMechanismSectionListsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsNull(kernel.AssemblyResult);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleCommonFailureMechanismSections_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleCommonFailureMechanismSections(Enumerable.Empty(),
+ random.NextDouble(),
+ random.NextBoolean());
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.AssessmentSectionLengthInput);
+ Assert.IsNull(kernel.FailureMechanismSectionListsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsNull(kernel.AssemblyResult);
+ Assert.IsFalse(kernel.Calculated);
+ }
+
+ [Test]
+ public void FindGreatestCommonDenominatorSectionsWbi3A1_Always_ThrowsNotImplementedException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+
+ // Call
+ TestDelegate test = () => kernel.FindGreatestCommonDenominatorSectionsWbi3A1(Enumerable.Empty(),
+ random.NextDouble());
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void TranslateFailureMechanismResultsToCommonSectionsWbi3B1_Always_ThrowsNotImplementedException()
+ {
+ // Setup
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+
+ // Call
+ TestDelegate test = () => kernel.TranslateFailureMechanismResultsToCommonSectionsWbi3B1(CreateFailureMechanismSectionList(),
+ CreateFailureMechanismSectionList());
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void DeterminCombinedResultPerCommonSectionWbi3C1_Always_ThrowsNotImplementedException()
+ {
+ // Setup
+ var random = new Random(21);
+ var kernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+
+ // Call
+ TestDelegate test = () => kernel.DeterminCombinedResultPerCommonSectionWbi3C1(Enumerable.Empty(),
+ random.NextBoolean());
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ private static FailureMechanismSectionList CreateFailureMechanismSectionList()
+ {
+ return new FailureMechanismSectionList(string.Empty, new[]
+ {
+ new FailureMechanismSection(0, 1)
+ });
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismAssemblyKernelStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismAssemblyKernelStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismAssemblyKernelStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,261 @@
+// Copyright (C) Stichting Deltares 2018. 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels.Assembly
+{
+ [TestFixture]
+ public class FailureMechanismAssemblyKernelStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var kernel = new FailureMechanismAssemblyKernelStub();
+
+ // Assert
+ Assert.IsInstanceOf(kernel);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsNull(kernel.Categories);
+ Assert.IsNull(kernel.FailureMechanismInput);
+ Assert.IsNull(kernel.FailureMechanismAssemblyResult);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsWithProbabilityInput);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsInput);
+ Assert.AreEqual((EFailureMechanismCategory) 0, kernel.FailureMechanismCategoryResult);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1A1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(39);
+ bool partialAssembly = random.NextBoolean();
+ IEnumerable sectionAssemblyResults = Enumerable.Empty();
+ var kernel = new FailureMechanismAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.AssembleFailureMechanismWbi1A1(sectionAssemblyResults, partialAssembly);
+
+ // Assert
+ Assert.AreSame(sectionAssemblyResults, kernel.FmSectionAssemblyResultsInput);
+ Assert.AreEqual(partialAssembly, kernel.PartialAssembly);
+ Assert.IsTrue(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1A1_KernelDoesNotThrowException_ReturnFailureMechanismSectionAssemblyResult()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ FailureMechanismCategoryResult = random.NextEnumValue()
+ };
+
+ // Call
+ EFailureMechanismCategory result = kernel.AssembleFailureMechanismWbi1A1(Enumerable.Empty(), random.NextBoolean());
+
+ // Assert
+ Assert.AreEqual(kernel.FailureMechanismCategoryResult, result);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1A1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleFailureMechanismWbi1A1(Enumerable.Empty(), true);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.AreEqual((EFailureMechanismCategory) 0, kernel.FailureMechanismCategoryResult);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1A1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleFailureMechanismWbi1A1(Enumerable.Empty(), true);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.AreEqual((EFailureMechanismCategory) 0, kernel.FailureMechanismCategoryResult);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1A2_Always_ThrowNotImplementedException()
+ {
+ // Setup
+ var kernel = new FailureMechanismAssemblyKernelStub();
+
+ // Call
+ TestDelegate test = () => kernel.AssembleFailureMechanismWbi1A2(null, false);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1B1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(39);
+ FailureMechanism failureMechanism = CreateRandomFailureMechanism(random);
+ IEnumerable sectionAssemblyResults = Enumerable.Empty();
+ CategoriesList categories = CategoriesListTestFactory.CreateFailureMechanismCategories();
+ bool partialAssembly = random.NextBoolean();
+ var kernel = new FailureMechanismAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.AssembleFailureMechanismWbi1B1(failureMechanism, sectionAssemblyResults, categories, partialAssembly);
+
+ // Assert
+ Assert.AreSame(failureMechanism, kernel.FailureMechanismInput);
+ Assert.AreSame(sectionAssemblyResults, kernel.FmSectionAssemblyResultsWithProbabilityInput);
+ Assert.AreSame(categories, kernel.Categories);
+ Assert.AreEqual(partialAssembly, kernel.PartialAssembly);
+ Assert.IsTrue(kernel.Calculated);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1B1_KernelDoesNotThrowException_ReturnFailureMechanismSectionAssemblyResult()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ FailureMechanismCategoryResult = random.NextEnumValue()
+ };
+
+ // Call
+ FailureMechanismAssemblyResult result = kernel.AssembleFailureMechanismWbi1B1(CreateRandomFailureMechanism(random),
+ Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ random.NextBoolean());
+
+ // Assert
+ Assert.AreEqual(kernel.FailureMechanismAssemblyResult, result);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1B1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleFailureMechanismWbi1B1(CreateRandomFailureMechanism(random),
+ Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ true);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.Categories);
+ Assert.IsNull(kernel.FailureMechanismInput);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.AreEqual((EFailureMechanismCategory) 0, kernel.FailureMechanismCategoryResult);
+ }
+
+ [Test]
+ public void AssembleFailureMechanismWbi1B1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.AssembleFailureMechanismWbi1B1(CreateRandomFailureMechanism(random),
+ Enumerable.Empty(),
+ CategoriesListTestFactory.CreateFailureMechanismCategories(),
+ true);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.Categories);
+ Assert.IsNull(kernel.FailureMechanismInput);
+ Assert.IsNull(kernel.FmSectionAssemblyResultsInput);
+ Assert.IsNull(kernel.PartialAssembly);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.AreEqual((EFailureMechanismCategory) 0, kernel.FailureMechanismCategoryResult);
+ }
+
+ private static FailureMechanism CreateRandomFailureMechanism(Random random)
+ {
+ var failureMechanism = new FailureMechanism(random.NextDouble(1, 5), random.NextDouble());
+ return failureMechanism;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStubTest.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStubTest.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStubTest.cs (revision 989f3f218eadf42dc262b49c3b45d7c3886d2668)
@@ -0,0 +1,1397 @@
+// Copyright (C) Stichting Deltares 2018. 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.Linq;
+using Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model.AssessmentResultTypes;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Test.Kernels.Assembly
+{
+ [TestFixture]
+ public class FailureMechanismSectionAssemblyKernelStubTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var kernel = new FailureMechanismSectionAssemblyKernelStub();
+
+ // Assert
+ Assert.IsInstanceOf(kernel);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.AssessmentResultTypeE1Input);
+ Assert.IsNull(kernel.AssessmentResultTypeE2Input);
+ Assert.IsNull(kernel.AssessmentResultTypeG1Input);
+ Assert.IsNull(kernel.AssessmentResultTypeG2Input);
+ Assert.IsNull(kernel.AssessmentResultTypeT1Input);
+ Assert.IsNull(kernel.AssessmentResultTypeT3Input);
+ Assert.IsNull(kernel.SectionCategoryInput);
+ Assert.IsNull(kernel.SimpleAssessmentResultInput);
+ Assert.IsNull(kernel.DetailedAssessmentResultInput);
+ Assert.IsNull(kernel.TailorMadeAssessmentResultInput);
+ Assert.IsNull(kernel.SimpleAssessmentResultInputWithProbability);
+ Assert.IsNull(kernel.DetailedAssessmentResultInputWithProbability);
+ Assert.IsNull(kernel.TailorMadeAssessmentResultInputWithProbability);
+ Assert.IsNull(kernel.AssessmentSectionInput);
+ Assert.IsNull(kernel.FailureMechanismInput);
+ Assert.IsNaN(kernel.FailureProbabilityInput);
+ Assert.IsNaN(kernel.LengthEffectFactorInput);
+ Assert.IsNull(kernel.CategoryCompliancyResultsInput);
+ Assert.IsNull(kernel.FailureMechanismSectionDirectResult);
+ Assert.IsNull(kernel.FailureMechanismSectionDirectResultWithProbability);
+ Assert.IsNull(kernel.FailureMechanismSectionCategories);
+ }
+
+ #region Simple Assessment
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E1_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(39);
+ var input = random.NextEnumValue();
+
+ var kernel = new FailureMechanismSectionAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.TranslateAssessmentResultWbi0E1(input);
+
+ // Assert
+ Assert.AreEqual(input, kernel.AssessmentResultTypeE1Input);
+ Assert.IsTrue(kernel.Calculated);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E1_KernelDoesNotThrowException_ReturnFailureMechanismSectionAssemblyResult()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismSectionAssemblyKernelStub
+ {
+ FailureMechanismSectionDirectResultWithProbability = new FmSectionAssemblyDirectResultWithProbability(random.NextEnumValue(),
+ random.NextDouble())
+ };
+
+ // Call
+ FmSectionAssemblyDirectResult result = kernel.TranslateAssessmentResultWbi0E1(0);
+
+ // Assert
+ Assert.AreSame(kernel.FailureMechanismSectionDirectResultWithProbability, result);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E1_ThrowExceptionOnCalculateTrue_ThrowsException()
+ {
+ // Setup
+ var kernel = new FailureMechanismSectionAssemblyKernelStub
+ {
+ ThrowExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.TranslateAssessmentResultWbi0E1(0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("Message", exception.Message);
+ Assert.IsNotNull(exception.InnerException);
+ Assert.IsNull(kernel.AssessmentResultTypeE1Input);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.FailureMechanismSectionDirectResult);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E1_ThrowAssemblyExceptionOnCalculateTrue_ThrowsAssemblyException()
+ {
+ // Setup
+ var kernel = new FailureMechanismSectionAssemblyKernelStub
+ {
+ ThrowAssemblyExceptionOnCalculate = true
+ };
+
+ // Call
+ TestDelegate test = () => kernel.TranslateAssessmentResultWbi0E1(0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ AssemblyErrorMessage errorMessage = exception.Errors.Single();
+ Assert.AreEqual("entity", errorMessage.EntityId);
+ Assert.AreEqual(EAssemblyErrors.CategoryLowerLimitOutOfRange, errorMessage.ErrorCode);
+ Assert.IsNull(kernel.AssessmentResultTypeE1Input);
+ Assert.IsFalse(kernel.Calculated);
+ Assert.IsNull(kernel.FailureMechanismSectionDirectResult);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E2_Always_ThrowNotImplementedException()
+ {
+ // Setup
+ var kernel = new FailureMechanismSectionAssemblyKernelStub();
+
+ // Call
+ TestDelegate test = () => kernel.TranslateAssessmentResultWbi0E2(0);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E3_KernelDoesNotThrowException_InputCorrectlySetToKernelAndCalculatedTrue()
+ {
+ // Setup
+ var random = new Random(39);
+ var input = random.NextEnumValue();
+
+ var kernel = new FailureMechanismSectionAssemblyKernelStub();
+
+ // Precondition
+ Assert.IsFalse(kernel.Calculated);
+
+ // Call
+ kernel.TranslateAssessmentResultWbi0E3(input);
+
+ // Assert
+ Assert.AreEqual(input, kernel.AssessmentResultTypeE2Input);
+ Assert.IsTrue(kernel.Calculated);
+ }
+
+ [Test]
+ public void TranslateAssessmentResultWbi0E3_KernelDoesNotThrowException_ReturnFailureMechanismSectionAssemblyResult()
+ {
+ // Setup
+ var random = new Random(39);
+ var kernel = new FailureMechanismSectionAssemblyKernelStub
+ {
+ FailureMechanismSectionDirectResultWithProbability = new FmSectionAssemblyDirectResultWithProbability(random.NextEnumValue