Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs (.../AssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/AssemblyToolCalculatorFactory.cs (.../AssemblyToolCalculatorFactory.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assessments; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; @@ -53,5 +54,10 @@ { return new AssemblyCategoriesCalculator(factory); } + + public IFailureMechanismSectionAssessmentAssemblyCalculator CreateFailureMechanismSectionAssessmentAssemblyCalculator(IAssemblyToolKernelFactory factory) + { + return new FailureMechanismSectionAssessmentAssemblyCalculator(factory); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculator.cs =================================================================== diff -u -r61230a2dbf617e3571d855e7271ba8de0e7aa29d -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculator.cs (.../FailureMechanismSectionAssessmentAssemblyCalculator.cs) (revision 61230a2dbf617e3571d855e7271ba8de0e7aa29d) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculator.cs (.../FailureMechanismSectionAssessmentAssemblyCalculator.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.Common.Data.AssemblyTool; using Ringtoets.Common.Data.FailureMechanism; @@ -29,6 +31,22 @@ /// public class FailureMechanismSectionAssessmentAssemblyCalculator : IFailureMechanismSectionAssessmentAssemblyCalculator { + private IAssemblyToolKernelFactory factory; + + /// + /// Creates a new instance of . + /// + /// The factory responsible for creating the assembly kernel. + /// Thrown when any parameter is null. + public FailureMechanismSectionAssessmentAssemblyCalculator(IAssemblyToolKernelFactory factory) + { + if (factory == null) + { + throw new ArgumentNullException(nameof(factory)); + } + this.factory = factory; + } + public FailureMechanismSectionAssessment AssembleSimpleAssessment(SimpleAssessmentResultType input) { throw new System.NotImplementedException(); Index: Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs (.../IAssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/src/Ringtoets.AssemblyTool.KernelWrapper/Calculators/IAssemblyToolCalculatorFactory.cs (.../IAssemblyToolCalculatorFactory.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assessments; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; @@ -37,5 +38,13 @@ /// The assembly categories calculator. /// Thrown when is null. IAssemblyCategoriesCalculator CreateAssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory); + + /// + /// Creates a failure mechanism section assessment assembly calculator. + /// + /// The factory responsible for creating the assembly kernel. + /// The failure mechanism section assessment assembly calculator. + /// Thrown when is null. + IFailureMechanismSectionAssessmentAssemblyCalculator CreateFailureMechanismSectionAssessmentAssemblyCalculator(IAssemblyToolKernelFactory factory); } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs =================================================================== diff -u -rccc77eb1d25d2f6e73e7b6547f2cc87b4d077713 -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs (.../AssemblyToolCalculatorFactoryTest.cs) (revision ccc77eb1d25d2f6e73e7b6547f2cc87b4d077713) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/AssemblyToolCalculatorFactoryTest.cs (.../AssemblyToolCalculatorFactoryTest.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -21,6 +21,7 @@ using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assessments; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators; @@ -85,5 +86,22 @@ Assert.IsInstanceOf(calculator); } } + + [Test] + public void CreateFailureMechanismSectionAssessmentAssemblyCalculator_WithKernelWrapperFactory_ReturnsFailureMechanismSectionAssessmentAssemblyCalculator() + { + // Setup + IAssemblyToolCalculatorFactory factory = AssemblyToolCalculatorFactory.Instance; + + using (new AssemblyToolKernelFactoryConfig()) + { + // Call + IFailureMechanismSectionAssessmentAssemblyCalculator calculator = factory.CreateFailureMechanismSectionAssessmentAssemblyCalculator( + AssemblyToolKernelWrapperFactory.Instance); + + // Assert + Assert.IsInstanceOf(calculator); + } + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculatorTest.cs =================================================================== diff -u -r61230a2dbf617e3571d855e7271ba8de0e7aa29d -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculatorTest.cs (.../FailureMechanismSectionAssessmentAssemblyCalculatorTest.cs) (revision 61230a2dbf617e3571d855e7271ba8de0e7aa29d) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.Test/Calculators/Assessments/FailureMechanismSectionAssessmentAssemblyCalculatorTest.cs (.../FailureMechanismSectionAssessmentAssemblyCalculatorTest.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -19,8 +19,11 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using NUnit.Framework; +using Rhino.Mocks; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assessments; +using Ringtoets.AssemblyTool.KernelWrapper.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.Test.Calculators.Assessments { @@ -30,11 +33,28 @@ [Test] public void Constructor_ExpectedValues() { + // Setup + var mocks = new MockRepository(); + var kernelFactory = mocks.Stub(); + mocks.ReplayAll(); + // Call - var calculator = new FailureMechanismSectionAssessmentAssemblyCalculator(); + var calculator = new FailureMechanismSectionAssessmentAssemblyCalculator(kernelFactory); // Assert Assert.IsInstanceOf(calculator); + mocks.VerifyAll(); } + + [Test] + public void Constructor_FactoryNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new FailureMechanismSectionAssessmentAssemblyCalculator(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("factory", exception.ParamName); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs =================================================================== diff -u -r9cdd93062dad3c0ade2809346b2eb0033befdf55 -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision 9cdd93062dad3c0ade2809346b2eb0033befdf55) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Test/Calculators/TestAssemblyToolCalculatorFactoryTest.cs (.../TestAssemblyToolCalculatorFactoryTest.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using NUnit.Framework; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; @@ -56,5 +57,19 @@ Assert.IsInstanceOf(calculator); Assert.AreSame(factory.LastCreatedAssemblyCategoriesCalculator, calculator); } + + [Test] + public void CreateFailureMechanismSectionAssessmentAssemblyCalculator_Always_ThrowsInvalidOperationException() + { + // Setup + var factory = new TestAssemblyToolCalculatorFactory(); + + // Call + TestDelegate test = () => factory.CreateFailureMechanismSectionAssessmentAssemblyCalculator(null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual($"Use the { nameof(TestAssemblyToolKernelFactory)}", exception.Message); + } } } \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs =================================================================== diff -u -r4160a30705d657946461b76a5c443119cb78d437 -r9c274457523062aad7b755fa88b20277c5d86bcb --- Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (.../TestAssemblyToolCalculatorFactory.cs) (revision 4160a30705d657946461b76a5c443119cb78d437) +++ Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (.../TestAssemblyToolCalculatorFactory.cs) (revision 9c274457523062aad7b755fa88b20277c5d86bcb) @@ -19,10 +19,13 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using Ringtoets.AssemblyTool.KernelWrapper.Calculators; +using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assessments; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Categories; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories; +using Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Kernels; namespace Ringtoets.AssemblyTool.KernelWrapper.TestUtil.Calculators { @@ -48,5 +51,11 @@ { return LastCreatedAssemblyCategoriesCalculator; } + + [Obsolete("Stub the kernel instead of the calculator.", false)] + public IFailureMechanismSectionAssessmentAssemblyCalculator CreateFailureMechanismSectionAssessmentAssemblyCalculator(IAssemblyToolKernelFactory factory) + { + throw new InvalidOperationException($"Use the {nameof(TestAssemblyToolKernelFactory)}"); + } } } \ No newline at end of file