Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs =================================================================== diff -u -rf440769c26234dd8ccfeb987d039926a7ce532c7 -rbb740f0278e4ce8ea6f6bbeaf02e550609eae576 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (.../AssemblyCategoriesCalculator.cs) (revision f440769c26234dd8ccfeb987d039926a7ce532c7) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/AssemblyCategoriesCalculator.cs (.../AssemblyCategoriesCalculator.cs) (revision bb740f0278e4ce8ea6f6bbeaf02e550609eae576) @@ -89,5 +89,13 @@ throw new AssemblyCategoriesCalculatorException(e.Message, e); } } + + public IEnumerable CalculateGeoTechnicFailureMechanismSectionCategories(double signalingNorm, + double lowerLimitNorm, + double probabilityDistributionFactor, + double n) + { + throw new NotImplementedException(); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs =================================================================== diff -u -rf440769c26234dd8ccfeb987d039926a7ce532c7 -rbb740f0278e4ce8ea6f6bbeaf02e550609eae576 --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision f440769c26234dd8ccfeb987d039926a7ce532c7) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Categories/IAssemblyCategoriesCalculator.cs (.../IAssemblyCategoriesCalculator.cs) (revision bb740f0278e4ce8ea6f6bbeaf02e550609eae576) @@ -55,5 +55,19 @@ /// when performing the calculation. IEnumerable CalculateFailureMechanismSectionCategories( double signalingNorm, double lowerLimitNorm, double probabilityDistributionFactor, double n); + + /// + /// Performs the calculation for getting the failure mechanism section categories. + /// + /// The signaling norm to calculate with. + /// The lower limit norm to calculate with. + /// The probability distribution factor to calculate with. + /// The n to calculate with. + /// An with categories of + /// . + /// Thrown when an error occurs + /// when performing the calculation. + IEnumerable CalculateGeoTechnicFailureMechanismSectionCategories( + double signalingNorm, double lowerLimitNorm, double probabilityDistributionFactor, double n); } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs =================================================================== diff -u -rf440769c26234dd8ccfeb987d039926a7ce532c7 -rbb740f0278e4ce8ea6f6bbeaf02e550609eae576 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision f440769c26234dd8ccfeb987d039926a7ce532c7) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/Categories/AssemblyCategoriesCalculatorStubTest.cs (.../AssemblyCategoriesCalculatorStubTest.cs) (revision bb740f0278e4ce8ea6f6bbeaf02e550609eae576) @@ -215,5 +215,93 @@ Assert.AreEqual("Message", exception.Message); Assert.IsNotNull(exception.InnerException); } + + [Test] + public void CalculateGeoTechnicFailureMechanismSectionCategories_OutputNotSetAndThrowExceptionOnCalculateFalse_ReturnsCategories() + { + // Setup + var calculator = new AssemblyCategoriesCalculatorStub(); + + // Call + FailureMechanismSectionAssemblyCategory[] result = calculator.CalculateGeoTechnicFailureMechanismSectionCategories(0, 0, 0, 0).ToArray(); + + // Assert + Assert.AreEqual(3, result.Length); + 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 CalculateGeoTechnicFailureMechanismSectionCategories_OutputSetAndThrowExceptionOnCalculateFalse_ReturnsCategories() + { + // Setup + var output = new FailureMechanismSectionAssemblyCategory[0]; + var calculator = new AssemblyCategoriesCalculatorStub + { + FailureMechanismSectionCategoriesOutput = output + }; + + // Call + IEnumerable result = calculator.CalculateGeoTechnicFailureMechanismSectionCategories(0 ,0, 0, 0); + + // Assert + Assert.AreSame(output, result); + } + + [Test] + public void CalculateGeoTechnicFailureMechanismSectionCategories_ThrowExceptionOnCalculateFalse_SetsInput() + { + // Setup + var random = new Random(39); + double signalingNorm = random.NextDouble(); + double lowerLimitNorm = random.NextDouble(); + double probabilityDistributionFactor = random.NextDouble(); + double n = random.NextDouble(); + + var calculator = new AssemblyCategoriesCalculatorStub(); + + // Call + calculator.CalculateGeoTechnicFailureMechanismSectionCategories(signalingNorm, lowerLimitNorm, probabilityDistributionFactor, n); + + // Assert + Assert.AreEqual(signalingNorm, calculator.SignalingNorm); + Assert.AreEqual(lowerLimitNorm, calculator.LowerLimitNorm); + Assert.AreEqual(probabilityDistributionFactor, calculator.ProbabilityDistributionFactor); + Assert.AreEqual(n, calculator.N); + } + + [Test] + public void CalculateGeoTechnicFailureMechanismSectionCategories_ThrowExceptionOnCalculateTrue_ThrowsAssemblyCategoriesCalculatorException() + { + // Setup + var calculator = new AssemblyCategoriesCalculatorStub + { + ThrowExceptionOnCalculate = true + }; + + // Call + TestDelegate test = () => calculator.CalculateGeoTechnicFailureMechanismSectionCategories(0, 0, 0, 0); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Message", exception.Message); + Assert.IsNotNull(exception.InnerException); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs =================================================================== diff -u -rf440769c26234dd8ccfeb987d039926a7ce532c7 -rbb740f0278e4ce8ea6f6bbeaf02e550609eae576 --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (.../AssemblyCategoriesCalculatorStub.cs) (revision f440769c26234dd8ccfeb987d039926a7ce532c7) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (.../AssemblyCategoriesCalculatorStub.cs) (revision bb740f0278e4ce8ea6f6bbeaf02e550609eae576) @@ -106,5 +106,27 @@ new FailureMechanismSectionAssemblyCategory(3.01, 4, FailureMechanismSectionAssemblyCategoryGroup.IIIv) }); } + + public IEnumerable CalculateGeoTechnicFailureMechanismSectionCategories(double signalingNorm, double lowerLimitNorm, + double probabilityDistributionFactor, double n) + { + if (ThrowExceptionOnCalculate) + { + throw new AssemblyCategoriesCalculatorException("Message", new Exception()); + } + + SignalingNorm = signalingNorm; + LowerLimitNorm = lowerLimitNorm; + ProbabilityDistributionFactor = probabilityDistributionFactor; + N = n; + + return FailureMechanismSectionCategoriesOutput + ?? (FailureMechanismSectionCategoriesOutput = new[] + { + new FailureMechanismSectionAssemblyCategory(1, 2, FailureMechanismSectionAssemblyCategoryGroup.Iv), + new FailureMechanismSectionAssemblyCategory(2.01, 3, FailureMechanismSectionAssemblyCategoryGroup.IIv), + new FailureMechanismSectionAssemblyCategory(3.01, 4, FailureMechanismSectionAssemblyCategoryGroup.IIIv) + }); + } } } \ No newline at end of file