Index: Ringtoets.sln
===================================================================
diff -u -ra25fee8308d0825ee0bc7e287304a78cad473fc6 -rc46bf659404f3caea7f90b053a9af10d28f7da94
--- Ringtoets.sln (.../Ringtoets.sln) (revision a25fee8308d0825ee0bc7e287304a78cad473fc6)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -1780,7 +1780,7 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.KernelWrapper.TestUtil", "Ringtoets\AssemblyTool\test\Ringtoets.AssemblyTool.KernelWrapper.TestUtil\Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj", "{0AB432BB-E2CC-42EA-A72C-7AFEF7536B38}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.KernelWrapper.TestUtil", "Ringtoets\AssemblyTool\test\Riskeer.AssemblyTool.KernelWrapper.TestUtil\Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj", "{0AB432BB-E2CC-42EA-A72C-7AFEF7536B38}"
ProjectSection(ProjectDependencies) = postProject
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/AssemblyCategoryAssert.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismAssemblyCalculatorStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/AssemblyToolCalculatorFactoryConfig.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/CategoriesListTestFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionAssemblyAssert.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionsInputAssert.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/AssessmentSectionAssemblyKernelStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismAssemblyKernelStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/AssemblyToolKernelFactoryConfig.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag c46bf659404f3caea7f90b053a9af10d28f7da94 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.KernelWrapper.TestUtil/packages.config'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssemblyCategoryAssert.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssemblyCategoryAssert.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssemblyCategoryAssert.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,179 @@
+// 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.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil
+{
+ ///
+ /// Class for asserting categories result.
+ ///
+ public static class AssemblyCategoryAssert
+ {
+ ///
+ /// Asserts whether is equal to .
+ ///
+ /// The original with
+ /// .
+ /// The actual collection of .
+ /// Thrown when
+ /// is not equal to .
+ public static void AssertAssessmentSectionAssemblyCategories(CategoriesList original,
+ IEnumerable actual)
+ {
+ Assert.AreEqual(original.Categories.Length, actual.Count());
+
+ CollectionAssert.AreEqual(original.Categories.Select(o => GetAssessmentSectionCategoryGroup(o.Category)), actual.Select(r => r.Group));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.LowerLimit), actual.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.UpperLimit), actual.Select(r => r.UpperBoundary));
+ }
+
+ ///
+ /// Asserts whether is equal to .
+ ///
+ /// The original with
+ /// .
+ /// The actual collection of .
+ /// Thrown when
+ /// is not equal to .
+ public static void AssertFailureMechanismAssemblyCategories(CategoriesList original,
+ IEnumerable actual)
+ {
+ Assert.AreEqual(original.Categories.Length, actual.Count());
+
+ CollectionAssert.AreEqual(original.Categories.Select(o => GetFailureMechanismCategoryGroup(o.Category)), actual.Select(r => r.Group));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.LowerLimit), actual.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.UpperLimit), actual.Select(r => r.UpperBoundary));
+ }
+
+ ///
+ /// Asserts whether is equal to .
+ ///
+ /// The original
+ /// with .
+ /// The actual collection of .
+ /// Thrown when
+ /// is not equal to .
+ public static void AssertFailureMechanismSectionAssemblyCategories(CategoriesList original,
+ IEnumerable actual)
+ {
+ Assert.AreEqual(original.Categories.Length, actual.Count());
+
+ CollectionAssert.AreEqual(original.Categories.Select(o => GetFailureMechanismSectionCategoryGroup(o.Category)), actual.Select(r => r.Group));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.LowerLimit), actual.Select(r => r.LowerBoundary));
+ CollectionAssert.AreEqual(original.Categories.Select(o => o.UpperLimit), actual.Select(r => r.UpperBoundary));
+ }
+
+ ///
+ /// Gets the based
+ /// on the given .
+ ///
+ /// The to convert.
+ /// A .
+ /// Thrown when
+ /// is not valid.
+ public static FailureMechanismSectionAssemblyCategoryGroup GetFailureMechanismSectionCategoryGroup(EFmSectionCategory category)
+ {
+ switch (category)
+ {
+ case EFmSectionCategory.Iv:
+ return FailureMechanismSectionAssemblyCategoryGroup.Iv;
+ case EFmSectionCategory.IIv:
+ return FailureMechanismSectionAssemblyCategoryGroup.IIv;
+ case EFmSectionCategory.IIIv:
+ return FailureMechanismSectionAssemblyCategoryGroup.IIIv;
+ case EFmSectionCategory.IVv:
+ return FailureMechanismSectionAssemblyCategoryGroup.IVv;
+ case EFmSectionCategory.Vv:
+ return FailureMechanismSectionAssemblyCategoryGroup.Vv;
+ case EFmSectionCategory.VIv:
+ return FailureMechanismSectionAssemblyCategoryGroup.VIv;
+ case EFmSectionCategory.VIIv:
+ return FailureMechanismSectionAssemblyCategoryGroup.VIIv;
+ case EFmSectionCategory.NotApplicable:
+ return FailureMechanismSectionAssemblyCategoryGroup.NotApplicable;
+ case EFmSectionCategory.Gr:
+ return FailureMechanismSectionAssemblyCategoryGroup.None;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+
+ private static AssessmentSectionAssemblyCategoryGroup GetAssessmentSectionCategoryGroup(EAssessmentGrade category)
+ {
+ switch (category)
+ {
+ case EAssessmentGrade.APlus:
+ return AssessmentSectionAssemblyCategoryGroup.APlus;
+ case EAssessmentGrade.A:
+ return AssessmentSectionAssemblyCategoryGroup.A;
+ case EAssessmentGrade.B:
+ return AssessmentSectionAssemblyCategoryGroup.B;
+ case EAssessmentGrade.C:
+ return AssessmentSectionAssemblyCategoryGroup.C;
+ case EAssessmentGrade.D:
+ return AssessmentSectionAssemblyCategoryGroup.D;
+ case EAssessmentGrade.Gr:
+ return AssessmentSectionAssemblyCategoryGroup.None;
+ case EAssessmentGrade.Ngo:
+ return AssessmentSectionAssemblyCategoryGroup.NotAssessed;
+ case EAssessmentGrade.Nvt:
+ return AssessmentSectionAssemblyCategoryGroup.NotApplicable;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+
+ private static FailureMechanismAssemblyCategoryGroup GetFailureMechanismCategoryGroup(EFailureMechanismCategory category)
+ {
+ switch (category)
+ {
+ case EFailureMechanismCategory.It:
+ return FailureMechanismAssemblyCategoryGroup.It;
+ case EFailureMechanismCategory.IIt:
+ return FailureMechanismAssemblyCategoryGroup.IIt;
+ case EFailureMechanismCategory.IIIt:
+ return FailureMechanismAssemblyCategoryGroup.IIIt;
+ case EFailureMechanismCategory.IVt:
+ return FailureMechanismAssemblyCategoryGroup.IVt;
+ case EFailureMechanismCategory.Vt:
+ return FailureMechanismAssemblyCategoryGroup.Vt;
+ case EFailureMechanismCategory.VIt:
+ return FailureMechanismAssemblyCategoryGroup.VIt;
+ case EFailureMechanismCategory.VIIt:
+ return FailureMechanismAssemblyCategoryGroup.VIIt;
+ case EFailureMechanismCategory.Nvt:
+ return FailureMechanismAssemblyCategoryGroup.NotApplicable;
+ case EFailureMechanismCategory.Gr:
+ return FailureMechanismAssemblyCategoryGroup.None;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/AssessmentGradeConversionTestHelper.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,53 @@
+// 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 Assembly.Kernel.Model;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil
+{
+ ///
+ /// Class that can be used to assert the conversions of .
+ ///
+ public static class AssessmentGradeConversionTestHelper
+ {
+ ///
+ /// Gets a collection of test cases to test the conversion between
+ /// and .
+ ///
+ public static IEnumerable AsssementGradeConversionCases
+ {
+ get
+ {
+ yield return new TestCaseData(EAssessmentGrade.APlus, AssessmentSectionAssemblyCategoryGroup.APlus);
+ yield return new TestCaseData(EAssessmentGrade.A, AssessmentSectionAssemblyCategoryGroup.A);
+ yield return new TestCaseData(EAssessmentGrade.B, AssessmentSectionAssemblyCategoryGroup.B);
+ yield return new TestCaseData(EAssessmentGrade.C, AssessmentSectionAssemblyCategoryGroup.C);
+ yield return new TestCaseData(EAssessmentGrade.D, AssessmentSectionAssemblyCategoryGroup.D);
+ yield return new TestCaseData(EAssessmentGrade.Gr, AssessmentSectionAssemblyCategoryGroup.None);
+ yield return new TestCaseData(EAssessmentGrade.Nvt, AssessmentSectionAssemblyCategoryGroup.NotApplicable);
+ yield return new TestCaseData(EAssessmentGrade.Ngo, AssessmentSectionAssemblyCategoryGroup.NotAssessed);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/AssessmentSectionAssemblyCalculatorStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,187 @@
+// 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 Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly
+{
+ ///
+ /// Assessment section assembly calculator stub for testing purposes.
+ ///
+ public class AssessmentSectionAssemblyCalculatorStub : IAssessmentSectionAssemblyCalculator
+ {
+ ///
+ /// Gets the lower norm input when assembling the assessment section with failure mechanisms
+ /// with probability.
+ ///
+ public double LowerLimitNormInput { get; private set; }
+
+ ///
+ /// Gets the lower norm input when assembling the assessment section with failure mechanisms
+ /// with probability.
+ ///
+ public double SignalingNormInput { get; private set; }
+
+ ///
+ /// Gets the failure probability margin factory input when assembling the assessment section
+ /// with failure mechanisms with probability.
+ ///
+ public double FailureProbabilityMarginFactorInput { get; private set; }
+
+ ///
+ /// Gets the collection of failure mechanism assembly input when assembling the
+ /// assessment section with failure mechanisms with probability.
+ ///
+ public IEnumerable FailureMechanismAssemblyInput { get; private set; }
+
+ ///
+ /// Gets the collection of failure mechanism assembly category group input when assembling the
+ /// assessment section with failure mechanisms without probability.
+ ///
+ public IEnumerable FailureMechanismAssemblyCategoryGroupInput { get; private set; }
+
+ ///
+ /// Gets the failure mechanisms without probability input when assembling the assessment section.
+ ///
+ public FailureMechanismAssemblyCategoryGroup FailureMechanismsWithoutProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the failure mechanisms with probability input when assembling the assessment section.
+ ///
+ public FailureMechanismAssembly FailureMechanismsWithProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the combined failure mechanism sections input.
+ ///
+ public IEnumerable> CombinedFailureMechanismSectionsInput { get; private set; }
+
+ ///
+ /// Gets the assessment section length input.
+ ///
+ public double AssessmentSectionLength { get; private set; }
+
+ ///
+ /// Gets or sets the output of the assessment section assembly for failure
+ /// mechanisms with probability.
+ ///
+ public FailureMechanismAssembly AssembleFailureMechanismsAssemblyOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the assessment section assembly category group when assembling failure
+ /// mechanisms without probability.
+ ///
+ public FailureMechanismAssemblyCategoryGroup? AssembleFailureMechanismsAssemblyCategoryGroupOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the assessment section assembly category group
+ /// when assembling an assessment section.
+ ///
+ public AssessmentSectionAssemblyCategoryGroup? AssembleAssessmentSectionCategoryGroupOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the combined failure mechanism section assembly.
+ ///
+ public IEnumerable CombinedFailureMechanismSectionAssemblyOutput { get; set; }
+
+ ///
+ /// Sets an indicator whether an exception must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ public FailureMechanismAssembly AssembleFailureMechanisms(IEnumerable input,
+ double signalingNorm,
+ double lowerLimitNorm,
+ double failureProbabilityMarginFactor)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssessmentSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ FailureMechanismAssemblyInput = input;
+ LowerLimitNormInput = lowerLimitNorm;
+ SignalingNormInput = signalingNorm;
+ FailureProbabilityMarginFactorInput = failureProbabilityMarginFactor;
+
+ return AssembleFailureMechanismsAssemblyOutput ??
+ (AssembleFailureMechanismsAssemblyOutput = new FailureMechanismAssembly(0.75, FailureMechanismAssemblyCategoryGroup.IIIt));
+ }
+
+ public FailureMechanismAssemblyCategoryGroup AssembleFailureMechanisms(IEnumerable input)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssessmentSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ FailureMechanismAssemblyCategoryGroupInput = input;
+
+ if (AssembleFailureMechanismsAssemblyCategoryGroupOutput == null)
+ {
+ AssembleFailureMechanismsAssemblyCategoryGroupOutput = FailureMechanismAssemblyCategoryGroup.IIIt;
+ }
+
+ return AssembleFailureMechanismsAssemblyCategoryGroupOutput.Value;
+ }
+
+ public AssessmentSectionAssemblyCategoryGroup AssembleAssessmentSection(FailureMechanismAssemblyCategoryGroup failureMechanismsWithoutProbability,
+ FailureMechanismAssembly failureMechanismsWithProbability)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssessmentSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ FailureMechanismsWithoutProbabilityInput = failureMechanismsWithoutProbability;
+ FailureMechanismsWithProbabilityInput = failureMechanismsWithProbability;
+
+ if (AssembleAssessmentSectionCategoryGroupOutput == null)
+ {
+ AssembleAssessmentSectionCategoryGroupOutput = AssessmentSectionAssemblyCategoryGroup.C;
+ }
+
+ return AssembleAssessmentSectionCategoryGroupOutput.Value;
+ }
+
+ public IEnumerable AssembleCombinedFailureMechanismSections(IEnumerable> input,
+ double assessmentSectionLength)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssessmentSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedFailureMechanismSectionsInput = input;
+ AssessmentSectionLength = assessmentSectionLength;
+
+ return CombinedFailureMechanismSectionAssemblyOutput ?? (CombinedFailureMechanismSectionAssemblyOutput = new[]
+ {
+ new CombinedFailureMechanismSectionAssembly(
+ new CombinedAssemblyFailureMechanismSection(0, 1, FailureMechanismSectionAssemblyCategoryGroup.IIIv),
+ input.Select(failureMechanism => FailureMechanismSectionAssemblyCategoryGroup.VIv).ToArray())
+ });
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismAssemblyCalculatorStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismAssemblyCalculatorStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismAssemblyCalculatorStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,96 @@
+// 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 Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly
+{
+ ///
+ /// Failure mechanism assembly calculator stub for testing purposes.
+ ///
+ public class FailureMechanismAssemblyCalculatorStub : IFailureMechanismAssemblyCalculator
+ {
+ ///
+ /// Gets the collection of .
+ ///
+ public IEnumerable FailureMechanismSectionAssemblies { get; private set; }
+
+ ///
+ /// Gets the collection of .
+ ///
+ public IEnumerable FailureMechanismSectionCategories { get; private set; }
+
+ ///
+ /// Gets or sets the output of the failure mechanism assembly without probabilities.
+ ///
+ public FailureMechanismAssemblyCategoryGroup? FailureMechanismAssemblyCategoryGroupOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the failure mechanism assembly with probabilities.
+ ///
+ public FailureMechanismAssembly FailureMechanismAssemblyOutput { get; set; }
+
+ ///
+ /// Gets the assembly categories input used in the assembly calculation methods.
+ ///
+ public AssemblyCategoriesInput AssemblyCategoriesInput { get; private set; }
+
+ ///
+ /// Sets an indicator whether an exception must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ public FailureMechanismAssemblyCategoryGroup Assemble(IEnumerable sectionCategories)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismAssemblyCalculatorException("Message", new Exception());
+ }
+
+ FailureMechanismSectionCategories = sectionCategories;
+
+ if (FailureMechanismAssemblyCategoryGroupOutput == null)
+ {
+ FailureMechanismAssemblyCategoryGroupOutput = FailureMechanismAssemblyCategoryGroup.IIt;
+ }
+
+ return FailureMechanismAssemblyCategoryGroupOutput.Value;
+ }
+
+ public FailureMechanismAssembly Assemble(IEnumerable sectionAssemblies,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismAssemblyCalculatorException("Message", new Exception());
+ }
+
+ FailureMechanismSectionAssemblies = sectionAssemblies;
+ AssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return FailureMechanismAssemblyOutput ??
+ (FailureMechanismAssemblyOutput = new FailureMechanismAssembly(1.0, FailureMechanismAssemblyCategoryGroup.IIIt));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Assembly/FailureMechanismSectionAssemblyCalculatorStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,585 @@
+// 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 Ringtoets.Common.Primitives;
+using Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly
+{
+ ///
+ /// Failure mechanism section assembly calculator stub for testing purposes.
+ ///
+ public class FailureMechanismSectionAssemblyCalculatorStub : IFailureMechanismSectionAssemblyCalculator
+ {
+ ///
+ /// Gets or sets the output of the simple assessment calculation.
+ ///
+ public FailureMechanismSectionAssembly SimpleAssessmentAssemblyOutput { get; set; }
+
+ ///
+ /// Gets the input of the simple assessment calculation.
+ ///
+ public SimpleAssessmentResultType SimpleAssessmentInput { get; private set; }
+
+ ///
+ /// Gets the input of the simple assessment validity only calculation.
+ ///
+ public SimpleAssessmentValidityOnlyResultType SimpleAssessmentValidityOnlyInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the detailed assessment calculation.
+ ///
+ public FailureMechanismSectionAssembly DetailedAssessmentAssemblyOutput { get; set; }
+
+ ///
+ /// Gets or sets the group output of the detailed assessment calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup? DetailedAssessmentAssemblyGroupOutput { get; set; }
+
+ ///
+ /// Gets the result type of the detailed assessment calculation.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultInput { get; private set; }
+
+ ///
+ /// Gets the result type of the detailed assessment calculation.
+ ///
+ public DetailedAssessmentProbabilityOnlyResultType DetailedAssessmentProbabilityOnlyResultInput { get; private set; }
+
+ ///
+ /// Gets the probability input of the detailed assessment calculation.
+ ///
+ public double DetailedAssessmentProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the normative norm input of the detailed assessment calculation.
+ ///
+ public double DetailedAssessmentNormativeNormInput { get; private set; }
+
+ ///
+ /// Gets the failure mechanism 'N' parameter input of the detailed assessment calculation.
+ ///
+ public double DetailedAssessmentFailureMechanismNInput { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter failure mechanism section input of the detailed assessment calculation.
+ ///
+ public double DetailedAssessmentFailureMechanismSectionNInput { get; private set; }
+
+ ///
+ /// Gets the failure mechanism contribution input of the detailed assessment calculation.
+ ///
+ public double DetailedAssessmentFailureMechanismContribution { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result input for category boundary Iv.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedSignalingNormInput { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result input for category boundary IIv.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForSignalingNormInput { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result input for category boundary IIIv.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result input for category boundary IVv.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForLowerLimitNormInput { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result input for category boundary Vv.
+ ///
+ public DetailedAssessmentResultType DetailedAssessmentResultForFactorizedLowerLimitNormInput { get; private set; }
+
+ ///
+ /// Gets the assembly categories input used in the detailed assessment calculation.
+ ///
+ public AssemblyCategoriesInput DetailedAssessmentAssemblyCategoriesInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the tailor made assessment calculation.
+ ///
+ public FailureMechanismSectionAssembly TailorMadeAssessmentAssemblyOutput { get; set; }
+
+ ///
+ /// Gets the result type of the tailor made assessment calculation.
+ ///
+ public TailorMadeAssessmentResultType TailorMadeAssessmentResultInput { get; private set; }
+
+ ///
+ /// Gets the result type of the tailor made assessment calculation with probability or detailed calculation result.
+ ///
+ public TailorMadeAssessmentProbabilityAndDetailedCalculationResultType TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput { get; private set; }
+
+ ///
+ /// Gets the result type of the tailor made assessment calculation with a probability calculation.
+ ///
+ public TailorMadeAssessmentProbabilityCalculationResultType TailorMadeAssessmentProbabilityCalculationResultInput { get; private set; }
+
+ ///
+ /// Gets the probability input of the tailor made assessment calculation.
+ ///
+ public double TailorMadeAssessmentProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter of a failure mechanism section input of the tailor made assessment calculation.
+ ///
+ public double TailorMadeAssessmentFailureMechanismSectionNInput { get; private set; }
+
+ ///
+ /// Gets the normative norm input of the tailor made assessment calculation.
+ ///
+ public double TailorMadeAssessmentNormativeNormInput { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter of a failure mechanism input of the tailor made assessment calculation.
+ ///
+ public double TailorMadeAssessmentFailureMechanismNInput { get; private set; }
+
+ ///
+ /// Gets the failure mechanism contribution input of the tailor made assessment calculation.
+ ///
+ public double TailorMadeAssessmentFailureMechanismContributionInput { get; private set; }
+
+ ///
+ /// Gets the result type of the tailor made assessment calculation with a category group.
+ ///
+ public TailorMadeAssessmentCategoryGroupResultType TailorMadeAssessmentCategoryGroupResultInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the tailor made assembly calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup? TailorMadeAssemblyCategoryOutput { get; set; }
+
+ ///
+ /// Gets the assembly categories input used in the tailor made assessment calculation.
+ ///
+ public AssemblyCategoriesInput TailorMadeAssessmentAssemblyCategoriesInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssembly CombinedAssemblyOutput { get; set; }
+
+ ///
+ /// Gets the simple assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssembly CombinedSimpleAssemblyInput { get; private set; }
+
+ ///
+ /// Gets the detailed assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssembly CombinedDetailedAssemblyInput { get; private set; }
+
+ ///
+ /// Gets the tailor made assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssembly CombinedTailorMadeAssemblyInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup? CombinedAssemblyCategoryOutput { get; set; }
+
+ ///
+ /// Gets the simple assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup CombinedSimpleAssemblyGroupInput { get; private set; }
+
+ ///
+ /// Gets the detailed assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup CombinedDetailedAssemblyGroupInput { get; private set; }
+
+ ///
+ /// Gets the tailor made assembly input of the combined assembly calculation.
+ ///
+ public FailureMechanismSectionAssemblyCategoryGroup CombinedTailorMadeAssemblyGroupInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the manual assembly calculation.
+ ///
+ public FailureMechanismSectionAssembly ManualAssemblyAssemblyOutput { get; set; }
+
+ ///
+ /// Gets the probability input of the manual assembly calculation.
+ ///
+ public double ManualAssemblyProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter input of the manual assembly calculation.
+ ///
+ public double ManualAssemblyNInput { get; private set; }
+
+ ///
+ /// Gets the assembly categories input of the manual assembly calculation.
+ ///
+ public AssemblyCategoriesInput ManualAssemblyCategoriesInput { get; private set; }
+
+ ///
+ /// Sets an indicator whether an exception must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an exception must be thrown while performing a combined assembly calculation.
+ ///
+ public bool ThrowExceptionOnCalculateCombinedAssembly { private get; set; }
+
+ public FailureMechanismSectionAssembly AssembleSimpleAssessment(SimpleAssessmentResultType input)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ SimpleAssessmentInput = input;
+
+ return SimpleAssessmentAssemblyOutput ??
+ (SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, FailureMechanismSectionAssemblyCategoryGroup.Iv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleSimpleAssessment(SimpleAssessmentValidityOnlyResultType input)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ SimpleAssessmentValidityOnlyInput = input;
+
+ return SimpleAssessmentAssemblyOutput ??
+ (SimpleAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIIv));
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleDetailedAssessment(DetailedAssessmentResultType detailedAssessmentResult)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ DetailedAssessmentResultInput = detailedAssessmentResult;
+
+ if (DetailedAssessmentAssemblyGroupOutput == null)
+ {
+ DetailedAssessmentAssemblyGroupOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv;
+ }
+
+ return DetailedAssessmentAssemblyGroupOutput.Value;
+ }
+
+ public FailureMechanismSectionAssembly AssembleDetailedAssessment(DetailedAssessmentProbabilityOnlyResultType detailedAssessmentResult,
+ double probability,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ DetailedAssessmentProbabilityOnlyResultInput = detailedAssessmentResult;
+ DetailedAssessmentProbabilityInput = probability;
+ DetailedAssessmentAssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return DetailedAssessmentAssemblyOutput ??
+ (DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleDetailedAssessment(DetailedAssessmentProbabilityOnlyResultType detailedAssessmentResult,
+ double probability,
+ double failureMechanismSectionN,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ DetailedAssessmentProbabilityOnlyResultInput = detailedAssessmentResult;
+ DetailedAssessmentProbabilityInput = probability;
+ DetailedAssessmentAssemblyCategoriesInput = assemblyCategoriesInput;
+ DetailedAssessmentFailureMechanismSectionNInput = failureMechanismSectionN;
+
+ return DetailedAssessmentAssemblyOutput ??
+ (DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0, FailureMechanismSectionAssemblyCategoryGroup.VIv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleDetailedAssessment(DetailedAssessmentProbabilityOnlyResultType detailedAssessmentResult,
+ double probability,
+ double normativeNorm,
+ double failureMechanismN,
+ double failureMechanismContribution)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ DetailedAssessmentProbabilityOnlyResultInput = detailedAssessmentResult;
+ DetailedAssessmentProbabilityInput = probability;
+ DetailedAssessmentNormativeNormInput = normativeNorm;
+ DetailedAssessmentFailureMechanismNInput = failureMechanismN;
+ DetailedAssessmentFailureMechanismContribution = failureMechanismContribution;
+
+ return DetailedAssessmentAssemblyOutput ??
+ (DetailedAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(0.25, FailureMechanismSectionAssemblyCategoryGroup.IVv));
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleDetailedAssessment(
+ DetailedAssessmentResultType detailedAssessmentResultForFactorizedSignalingNorm,
+ DetailedAssessmentResultType detailedAssessmentResultForSignalingNorm,
+ DetailedAssessmentResultType detailedAssessmentResultForMechanismSpecificLowerLimitNorm,
+ DetailedAssessmentResultType detailedAssessmentResultForLowerLimitNorm,
+ DetailedAssessmentResultType detailedAssessmentResultForFactorizedLowerLimitNorm)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ DetailedAssessmentResultForFactorizedSignalingNormInput = detailedAssessmentResultForFactorizedSignalingNorm;
+ DetailedAssessmentResultForSignalingNormInput = detailedAssessmentResultForSignalingNorm;
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNormInput = detailedAssessmentResultForMechanismSpecificLowerLimitNorm;
+ DetailedAssessmentResultForLowerLimitNormInput = detailedAssessmentResultForLowerLimitNorm;
+ DetailedAssessmentResultForFactorizedLowerLimitNormInput = detailedAssessmentResultForFactorizedLowerLimitNorm;
+
+ if (DetailedAssessmentAssemblyGroupOutput == null)
+ {
+ DetailedAssessmentAssemblyGroupOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv;
+ }
+
+ return DetailedAssessmentAssemblyGroupOutput.Value;
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleTailorMadeAssessment(TailorMadeAssessmentResultType tailorMadeAssessmentResult)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ TailorMadeAssessmentResultInput = tailorMadeAssessmentResult;
+
+ if (TailorMadeAssemblyCategoryOutput == null)
+ {
+ TailorMadeAssemblyCategoryOutput = FailureMechanismSectionAssemblyCategoryGroup.IIv;
+ }
+
+ return TailorMadeAssemblyCategoryOutput.Value;
+ }
+
+ public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityAndDetailedCalculationResultType tailorMadeAssessmentResult,
+ double probability,
+ double normativeNorm,
+ double failureMechanismN,
+ double failureMechanismContribution)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ TailorMadeAssessmentProbabilityAndDetailedCalculationResultInput = tailorMadeAssessmentResult;
+ TailorMadeAssessmentProbabilityInput = probability;
+ TailorMadeAssessmentNormativeNormInput = normativeNorm;
+ TailorMadeAssessmentFailureMechanismNInput = failureMechanismN;
+ TailorMadeAssessmentFailureMechanismContributionInput = failureMechanismContribution;
+
+ return TailorMadeAssessmentAssemblyOutput ??
+ (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityCalculationResultType tailorMadeAssessmentResult,
+ double probability,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ TailorMadeAssessmentProbabilityCalculationResultInput = tailorMadeAssessmentResult;
+ TailorMadeAssessmentProbabilityInput = probability;
+ TailorMadeAssessmentAssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return TailorMadeAssessmentAssemblyOutput ??
+ (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleTailorMadeAssessment(TailorMadeAssessmentProbabilityCalculationResultType tailorMadeAssessmentResult,
+ double probability,
+ double failureMechanismSectionN,
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ TailorMadeAssessmentProbabilityCalculationResultInput = tailorMadeAssessmentResult;
+ TailorMadeAssessmentProbabilityInput = probability;
+ TailorMadeAssessmentAssemblyCategoriesInput = assemblyCategoriesInput;
+ TailorMadeAssessmentFailureMechanismSectionNInput = failureMechanismSectionN;
+
+ return TailorMadeAssessmentAssemblyOutput ??
+ (TailorMadeAssessmentAssemblyOutput = new FailureMechanismSectionAssembly(1, FailureMechanismSectionAssemblyCategoryGroup.VIv));
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleTailorMadeAssessment(TailorMadeAssessmentCategoryGroupResultType tailorMadeAssessmentResult)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ TailorMadeAssessmentCategoryGroupResultInput = tailorMadeAssessmentResult;
+
+ if (TailorMadeAssemblyCategoryOutput == null)
+ {
+ TailorMadeAssemblyCategoryOutput = FailureMechanismSectionAssemblyCategoryGroup.Iv;
+ }
+
+ return TailorMadeAssemblyCategoryOutput.Value;
+ }
+
+ public FailureMechanismSectionAssembly AssembleCombined(FailureMechanismSectionAssembly simpleAssembly)
+ {
+ if (ThrowExceptionOnCalculateCombinedAssembly)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedSimpleAssemblyInput = simpleAssembly;
+
+ return CombinedAssemblyOutput ?? (CombinedAssemblyOutput = simpleAssembly);
+ }
+
+ public FailureMechanismSectionAssembly AssembleCombined(FailureMechanismSectionAssembly simpleAssembly,
+ FailureMechanismSectionAssembly detailedAssembly,
+ FailureMechanismSectionAssembly tailorMadeAssembly)
+ {
+ if (ThrowExceptionOnCalculateCombinedAssembly)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedSimpleAssemblyInput = simpleAssembly;
+ CombinedDetailedAssemblyInput = detailedAssembly;
+ CombinedTailorMadeAssemblyInput = tailorMadeAssembly;
+
+ return CombinedAssemblyOutput ?? (CombinedAssemblyOutput = tailorMadeAssembly);
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleCombined(FailureMechanismSectionAssemblyCategoryGroup simpleAssembly)
+ {
+ if (ThrowExceptionOnCalculateCombinedAssembly)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedSimpleAssemblyGroupInput = simpleAssembly;
+
+ if (CombinedAssemblyCategoryOutput == null)
+ {
+ CombinedAssemblyCategoryOutput = simpleAssembly;
+ }
+
+ return CombinedAssemblyCategoryOutput.Value;
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleCombined(FailureMechanismSectionAssemblyCategoryGroup simpleAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssembly)
+ {
+ if (ThrowExceptionOnCalculateCombinedAssembly)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedSimpleAssemblyGroupInput = simpleAssembly;
+ CombinedTailorMadeAssemblyGroupInput = tailorMadeAssembly;
+
+ if (CombinedAssemblyCategoryOutput == null)
+ {
+ CombinedAssemblyCategoryOutput = tailorMadeAssembly;
+ }
+
+ return CombinedAssemblyCategoryOutput.Value;
+ }
+
+ public FailureMechanismSectionAssemblyCategoryGroup AssembleCombined(FailureMechanismSectionAssemblyCategoryGroup simpleAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup detailedAssembly,
+ FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssembly)
+ {
+ if (ThrowExceptionOnCalculateCombinedAssembly)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ CombinedSimpleAssemblyGroupInput = simpleAssembly;
+ CombinedDetailedAssemblyGroupInput = detailedAssembly;
+ CombinedTailorMadeAssemblyGroupInput = tailorMadeAssembly;
+
+ if (CombinedAssemblyCategoryOutput == null)
+ {
+ CombinedAssemblyCategoryOutput = tailorMadeAssembly;
+ }
+
+ return CombinedAssemblyCategoryOutput.Value;
+ }
+
+ public FailureMechanismSectionAssembly AssembleManual(double probability, AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ ManualAssemblyProbabilityInput = probability;
+ ManualAssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return ManualAssemblyAssemblyOutput ??
+ (ManualAssemblyAssemblyOutput = new FailureMechanismSectionAssembly(0, FailureMechanismSectionAssemblyCategoryGroup.IIv));
+ }
+
+ public FailureMechanismSectionAssembly AssembleManual(double probability, double failureMechanismSectionN, AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new FailureMechanismSectionAssemblyCalculatorException("Message", new Exception());
+ }
+
+ ManualAssemblyProbabilityInput = probability;
+ ManualAssemblyCategoriesInput = assemblyCategoriesInput;
+ ManualAssemblyNInput = failureMechanismSectionN;
+
+ return ManualAssemblyAssemblyOutput ??
+ (ManualAssemblyAssemblyOutput = new FailureMechanismSectionAssembly(1.0, FailureMechanismSectionAssemblyCategoryGroup.VIIv));
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/AssemblyToolCalculatorFactoryConfig.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/AssemblyToolCalculatorFactoryConfig.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/AssemblyToolCalculatorFactoryConfig.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,76 @@
+// 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 Riskeer.AssemblyTool.KernelWrapper.Calculators;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators
+{
+ ///
+ /// This class can be used to set a temporary
+ /// for while testing.
+ /// Disposing an instance of this class will revert the .
+ ///
+ ///
+ /// The following is an example for how to use this class:
+ ///
+ /// using(new AssemblyToolCalculatorFactoryConfig())
+ /// {
+ /// var testFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance;
+ ///
+ /// // Perform tests with testFactory
+ /// }
+ ///
+ ///
+ public class AssemblyToolCalculatorFactoryConfig : IDisposable
+ {
+ private readonly IAssemblyToolCalculatorFactory previousFactory;
+
+ ///
+ /// Creates a new instance of .
+ /// Sets a to
+ ///
+ ///
+ public AssemblyToolCalculatorFactoryConfig()
+ {
+ previousFactory = AssemblyToolCalculatorFactory.Instance;
+ AssemblyToolCalculatorFactory.Instance = new TestAssemblyToolCalculatorFactory();
+ }
+
+ ///
+ /// Reverts the to the value
+ /// it had at time of construction of the .
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ AssemblyToolCalculatorFactory.Instance = previousFactory;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/Categories/AssemblyCategoriesCalculatorStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,169 @@
+// 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 Riskeer.AssemblyTool.Data;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Categories;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories
+{
+ ///
+ /// Assembly categories calculator stub for testing purposes.
+ ///
+ public class AssemblyCategoriesCalculatorStub : IAssemblyCategoriesCalculator
+ {
+ ///
+ /// Gets the signaling norm that is used in the calculation.
+ ///
+ public double SignalingNorm { get; private set; }
+
+ ///
+ /// Gets the lower limit norm that is used in the calculation.
+ ///
+ public double LowerLimitNorm { get; private set; }
+
+ ///
+ /// Gets the normative norm that is used in the calculation.
+ ///
+ public double NormativeNorm { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter used to factor in the 'length effect'
+ /// that is used in the calculation.
+ ///
+ public double FailureMechanismN { get; private set; }
+
+ ///
+ /// Gets the failure mechanism contribution that is used in the calculation.
+ ///
+ public double FailureMechanismContribution { get; private set; }
+
+ ///
+ /// Gets the assembly categories input used in the assembly calculation methods.
+ ///
+ public AssemblyCategoriesInput AssemblyCategoriesInput { get; private set; }
+
+ ///
+ /// Gets or sets the output of the calculation.
+ ///
+ public IEnumerable AssessmentSectionCategoriesOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the calculation.
+ ///
+ public IEnumerable FailureMechanismCategoriesOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the calculation.
+ ///
+ public IEnumerable FailureMechanismSectionCategoriesOutput { get; set; }
+
+ ///
+ /// Gets or sets the output of the calculation.
+ ///
+ public IEnumerable GeotechnicalFailureMechanismSectionCategoriesOutput { get; set; }
+
+ ///
+ /// Sets an indicator whether an exception must be thrown while performing the calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ public IEnumerable CalculateAssessmentSectionCategories(double signalingNorm, double lowerLimitNorm)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssemblyCategoriesCalculatorException("Message", new Exception());
+ }
+
+ SignalingNorm = signalingNorm;
+ LowerLimitNorm = lowerLimitNorm;
+
+ return AssessmentSectionCategoriesOutput
+ ?? (AssessmentSectionCategoriesOutput = new[]
+ {
+ new AssessmentSectionAssemblyCategory(1, 2, AssessmentSectionAssemblyCategoryGroup.A),
+ new AssessmentSectionAssemblyCategory(2.01, 3, AssessmentSectionAssemblyCategoryGroup.B),
+ new AssessmentSectionAssemblyCategory(3.01, 4, AssessmentSectionAssemblyCategoryGroup.C)
+ });
+ }
+
+ public IEnumerable CalculateFailureMechanismCategories(AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssemblyCategoriesCalculatorException("Message", new Exception());
+ }
+
+ AssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return FailureMechanismCategoriesOutput
+ ?? (FailureMechanismCategoriesOutput = new[]
+ {
+ new FailureMechanismAssemblyCategory(1, 2, FailureMechanismAssemblyCategoryGroup.It),
+ new FailureMechanismAssemblyCategory(2.01, 3, FailureMechanismAssemblyCategoryGroup.IIt),
+ new FailureMechanismAssemblyCategory(3.01, 4, FailureMechanismAssemblyCategoryGroup.IIIt)
+ });
+ }
+
+ public IEnumerable CalculateFailureMechanismSectionCategories(
+ AssemblyCategoriesInput assemblyCategoriesInput)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssemblyCategoriesCalculatorException("Message", new Exception());
+ }
+
+ AssemblyCategoriesInput = assemblyCategoriesInput;
+
+ return FailureMechanismSectionCategoriesOutput
+ ?? (FailureMechanismSectionCategoriesOutput = new[]
+ {
+ new FailureMechanismSectionAssemblyCategory(1, 2, FailureMechanismSectionAssemblyCategoryGroup.Iv),
+ new FailureMechanismSectionAssemblyCategory(2.01, 3, FailureMechanismSectionAssemblyCategoryGroup.IIv),
+ new FailureMechanismSectionAssemblyCategory(3.01, 4, FailureMechanismSectionAssemblyCategoryGroup.IIIv)
+ });
+ }
+
+ public IEnumerable CalculateGeotechnicalFailureMechanismSectionCategories(
+ double normativeNorm,
+ double failureMechanismN,
+ double failureMechanismContribution)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new AssemblyCategoriesCalculatorException("Message", new Exception());
+ }
+
+ NormativeNorm = normativeNorm;
+ FailureMechanismN = failureMechanismN;
+ FailureMechanismContribution = failureMechanismContribution;
+
+ return GeotechnicalFailureMechanismSectionCategoriesOutput
+ ?? (GeotechnicalFailureMechanismSectionCategoriesOutput = new[]
+ {
+ new FailureMechanismSectionAssemblyCategory(1, 2.1, FailureMechanismSectionAssemblyCategoryGroup.IIIv),
+ new FailureMechanismSectionAssemblyCategory(2.2, 3.1, FailureMechanismSectionAssemblyCategoryGroup.IVv),
+ new FailureMechanismSectionAssemblyCategory(3.2, 4, FailureMechanismSectionAssemblyCategoryGroup.Vv)
+ });
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Calculators/TestAssemblyToolCalculatorFactory.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,87 @@
+// 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 Riskeer.AssemblyTool.KernelWrapper.Calculators;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.Calculators.Categories;
+using Riskeer.AssemblyTool.KernelWrapper.Kernels;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators.Categories;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Calculators
+{
+ ///
+ /// Factory which creates assembly tool calculator stubs for testing purposes.
+ ///
+ public class TestAssemblyToolCalculatorFactory : IAssemblyToolCalculatorFactory
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public TestAssemblyToolCalculatorFactory()
+ {
+ LastCreatedAssemblyCategoriesCalculator = new AssemblyCategoriesCalculatorStub();
+ LastCreatedFailureMechanismSectionAssemblyCalculator = new FailureMechanismSectionAssemblyCalculatorStub();
+ LastCreatedFailureMechanismAssemblyCalculator = new FailureMechanismAssemblyCalculatorStub();
+ LastCreatedAssessmentSectionAssemblyCalculator = new AssessmentSectionAssemblyCalculatorStub();
+ }
+
+ ///
+ /// Gets the last created .
+ ///
+ public AssemblyCategoriesCalculatorStub LastCreatedAssemblyCategoriesCalculator { get; }
+
+ ///
+ /// Gets the last created .
+ ///
+ public FailureMechanismSectionAssemblyCalculatorStub LastCreatedFailureMechanismSectionAssemblyCalculator { get; }
+
+ ///
+ /// Gets the last created .
+ ///
+ public FailureMechanismAssemblyCalculatorStub LastCreatedFailureMechanismAssemblyCalculator { get; }
+
+ ///
+ /// Gets the last created .
+ ///
+ public AssessmentSectionAssemblyCalculatorStub LastCreatedAssessmentSectionAssemblyCalculator { get; }
+
+ public IAssemblyCategoriesCalculator CreateAssemblyCategoriesCalculator(IAssemblyToolKernelFactory factory)
+ {
+ return LastCreatedAssemblyCategoriesCalculator;
+ }
+
+ public IFailureMechanismSectionAssemblyCalculator CreateFailureMechanismSectionAssemblyCalculator(IAssemblyToolKernelFactory factory)
+ {
+ return LastCreatedFailureMechanismSectionAssemblyCalculator;
+ }
+
+ public IFailureMechanismAssemblyCalculator CreateFailureMechanismAssemblyCalculator(IAssemblyToolKernelFactory factory)
+ {
+ return LastCreatedFailureMechanismAssemblyCalculator;
+ }
+
+ public IAssessmentSectionAssemblyCalculator CreateAssessmentSectionAssemblyCalculator(IAssemblyToolKernelFactory factory)
+ {
+ return LastCreatedAssessmentSectionAssemblyCalculator;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CategoriesListTestFactory.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CategoriesListTestFactory.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CategoriesListTestFactory.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,89 @@
+// 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 Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+using Core.Common.TestUtil;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil
+{
+ ///
+ /// Class that creates valid instances of
+ /// which can be used for testing.
+ ///
+ public static class CategoriesListTestFactory
+ {
+ private static readonly Random random = new Random(21);
+
+ ///
+ /// Creates a valid instance of
+ /// containing .
+ ///
+ /// An instance of
+ /// containing .
+ public static CategoriesList CreateFailureMechanismSectionCategories()
+ {
+ return new CategoriesList(new[]
+ {
+ new FmSectionCategory(random.NextEnumValue(), 0, 0.25),
+ new FmSectionCategory(random.NextEnumValue(), 0.25, 0.5),
+ new FmSectionCategory(random.NextEnumValue(), 0.5, 0.75),
+ new FmSectionCategory(random.NextEnumValue(), 0.75, 1.0)
+ });
+ }
+
+ ///
+ /// Creates a valid instance of
+ /// containing .
+ ///
+ /// An instance of
+ /// containing .
+ public static CategoriesList CreateFailureMechanismCategories()
+ {
+ return new CategoriesList(new[]
+ {
+ new FailureMechanismCategory(random.NextEnumValue(), 0, 0.25),
+ new FailureMechanismCategory(random.NextEnumValue(), 0.25, 0.5),
+ new FailureMechanismCategory(random.NextEnumValue(), 0.5, 0.75),
+ new FailureMechanismCategory(random.NextEnumValue(), 0.75, 1.0)
+ });
+ }
+
+ ///
+ /// Creates a valid instance of
+ /// containing .
+ ///
+ /// An instance of
+ /// containing .
+ public static CategoriesList CreateAssessmentSectionCategories()
+ {
+ return new CategoriesList(new[]
+ {
+ new AssessmentSectionCategory(random.NextEnumValue(), 0, 0.25),
+ new AssessmentSectionCategory(random.NextEnumValue(), 0.25, 0.5),
+ new AssessmentSectionCategory(random.NextEnumValue(), 0.5, 0.75),
+ new AssessmentSectionCategory(random.NextEnumValue(), 0.75, 1.0)
+ });
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionAssemblyAssert.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionAssemblyAssert.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionAssemblyAssert.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,64 @@
+// 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
+{
+ ///
+ /// Class that asserts combined failure mechanism section assemblies.
+ ///
+ public static class CombinedFailureMechanismSectionAssemblyAssert
+ {
+ ///
+ /// Asserts whether is equal to .
+ ///
+ /// The original .
+ /// The actual collection of .
+ /// Thrown when
+ /// is not equal to .
+ public static void AssertAssembly(AssemblyResult original, IEnumerable actual)
+ {
+ FmSectionWithDirectCategory[] combinedResults = original.CombinedSectionResult.ToArray();
+ Assert.AreEqual(combinedResults.Length, actual.Count());
+ for (var i = 0; i < combinedResults.Length; i++)
+ {
+ Assert.AreEqual(combinedResults[i].SectionStart, actual.ElementAt(i).Section.SectionStart);
+ Assert.AreEqual(combinedResults[i].SectionEnd, actual.ElementAt(i).Section.SectionEnd);
+ Assert.AreEqual(AssemblyCategoryAssert.GetFailureMechanismSectionCategoryGroup(combinedResults[i].Category), actual.ElementAt(i).Section.CategoryGroup);
+
+ FailureMechanismSectionList[] failureMechanismResults = original.ResultPerFailureMechanism.ToArray();
+ Assert.AreEqual(failureMechanismResults.Length, actual.ElementAt(i).FailureMechanismResults.Count());
+
+ for (var j = 0; j < failureMechanismResults.Length; j++)
+ {
+ FailureMechanismSectionAssemblyCategoryGroup expectedGroup = AssemblyCategoryAssert.GetFailureMechanismSectionCategoryGroup(
+ ((FmSectionWithDirectCategory) failureMechanismResults[j].Sections.ElementAt(i)).Category);
+ Assert.AreEqual(expectedGroup, actual.ElementAt(i).FailureMechanismResults.ElementAt(j));
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionsInputAssert.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionsInputAssert.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/CombinedFailureMechanismSectionsInputAssert.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,96 @@
+// 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.Model;
+using Assembly.Kernel.Model.FmSectionTypes;
+using NUnit.Framework;
+using Riskeer.AssemblyTool.Data;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil
+{
+ ///
+ /// Class for asserting combined failure mechanism input.
+ ///
+ public static class CombinedFailureMechanismSectionsInputAssert
+ {
+ ///
+ /// Asserts whether is equal to .
+ ///
+ /// The original collection of
+ /// collections.
+ /// The actual collection of .
+ /// Thrown when
+ /// is not equal to .
+ public static void AssertCombinedFailureMechanismInput(IEnumerable original, IEnumerable actual)
+ {
+ Assert.AreEqual(original.Count(), actual.Count());
+
+ for (var i = 0; i < original.Count(); i++)
+ {
+ CombinedAssemblyFailureMechanismSection[] sections = original.ElementAt(i);
+ FailureMechanismSectionList sectionList = actual.ElementAt(i);
+ Assert.IsEmpty(sectionList.FailureMechanismId);
+ AssertSections(sections, sectionList.Sections);
+ }
+ }
+
+ private static void AssertSections(IEnumerable originalSections, IEnumerable failureMechanismSections)
+ {
+ Assert.AreEqual(originalSections.Count(), failureMechanismSections.Count());
+ Assert.IsTrue(failureMechanismSections.All(r => r.GetType() == typeof(FmSectionWithDirectCategory)));
+ CollectionAssert.AreEqual(originalSections.Select(s => s.SectionStart), failureMechanismSections.Select(r => r.SectionStart));
+ CollectionAssert.AreEqual(originalSections.Select(s => s.SectionEnd), failureMechanismSections.Select(r => r.SectionEnd));
+ CollectionAssert.AreEqual(originalSections.Select(s => ConvertCategoryGroup(s.CategoryGroup)),
+ failureMechanismSections.Select(r => (FmSectionWithDirectCategory) r)
+ .Select(category => category.Category));
+ }
+
+ private static EFmSectionCategory ConvertCategoryGroup(FailureMechanismSectionAssemblyCategoryGroup categoryGroup)
+ {
+ switch (categoryGroup)
+ {
+ case FailureMechanismSectionAssemblyCategoryGroup.None:
+ return EFmSectionCategory.Gr;
+ case FailureMechanismSectionAssemblyCategoryGroup.NotApplicable:
+ return EFmSectionCategory.NotApplicable;
+ case FailureMechanismSectionAssemblyCategoryGroup.Iv:
+ return EFmSectionCategory.Iv;
+ case FailureMechanismSectionAssemblyCategoryGroup.IIv:
+ return EFmSectionCategory.IIv;
+ case FailureMechanismSectionAssemblyCategoryGroup.IIIv:
+ return EFmSectionCategory.IIIv;
+ case FailureMechanismSectionAssemblyCategoryGroup.IVv:
+ return EFmSectionCategory.IVv;
+ case FailureMechanismSectionAssemblyCategoryGroup.Vv:
+ return EFmSectionCategory.Vv;
+ case FailureMechanismSectionAssemblyCategoryGroup.VIv:
+ return EFmSectionCategory.VIv;
+ case FailureMechanismSectionAssemblyCategoryGroup.VIIv:
+ return EFmSectionCategory.VIIv;
+ default:
+ throw new NotSupportedException();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/AssessmentSectionAssemblyKernelStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/AssessmentSectionAssemblyKernelStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/AssessmentSectionAssemblyKernelStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,145 @@
+// 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly
+{
+ ///
+ /// Assessment section assembly kernel stub for testing purposes.
+ ///
+ public class AssessmentSectionAssemblyKernelStub : IAssessmentGradeAssembler
+ {
+ ///
+ /// Gets a value indicating whether an assembly is partial.
+ ///
+ public bool? PartialAssembly { get; private set; }
+
+ ///
+ /// Gets or sets the failure mechanism category result
+ ///
+ public EFailureMechanismCategory FailureMechanismCategoryResult { get; set; }
+
+ ///
+ /// Gets or sets the failure mechanism assembly result.
+ ///
+ public FailureMechanismAssemblyResult FailureMechanismAssemblyResult { get; set; }
+
+ ///
+ /// Gets or sets the assessment section assembly result.
+ ///
+ public EAssessmentGrade AssessmentSectionAssemblyResult { get; set; }
+
+ ///
+ /// Gets the collection of used as an input parameter for assembly methods.
+ ///
+ public IEnumerable FailureMechanismAssemblyResults { get; private set; }
+
+ ///
+ /// Gets the used as an input parameter for assembly methods.
+ ///
+ public EFailureMechanismCategory? AssemblyResultNoFailureProbability { get; private set; }
+
+ ///
+ /// Gets the used as an input parameter for assembly methods.
+ ///
+ public FailureMechanismAssemblyResult AssemblyResultWithFailureProbability { get; private set; }
+
+ ///
+ /// Gets the used as an input parameter for assembly methods.
+ ///
+ public CategoriesList FailureMechanismCategories { get; private set; }
+
+ ///
+ /// Gets a value indicating whether a calculation was called or not.
+ ///
+ public bool Calculated { get; private set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowAssemblyExceptionOnCalculate { private get; set; }
+
+ public EFailureMechanismCategory AssembleAssessmentSectionWbi2A1(IEnumerable failureMechanismAssemblyResults,
+ bool partialAssembly)
+ {
+ ThrowException();
+
+ PartialAssembly = partialAssembly;
+ FailureMechanismAssemblyResults = failureMechanismAssemblyResults;
+
+ Calculated = true;
+
+ return FailureMechanismCategoryResult;
+ }
+
+ public FailureMechanismAssemblyResult AssembleAssessmentSectionWbi2B1(IEnumerable failureMechanismAssemblyResults,
+ CategoriesList categories,
+ bool partialAssembly)
+ {
+ ThrowException();
+
+ PartialAssembly = partialAssembly;
+ FailureMechanismCategories = categories;
+ FailureMechanismAssemblyResults = failureMechanismAssemblyResults;
+
+ Calculated = true;
+
+ return FailureMechanismAssemblyResult;
+ }
+
+ public EAssessmentGrade AssembleAssessmentSectionWbi2C1(EFailureMechanismCategory assemblyResultNoFailureProbability,
+ FailureMechanismAssemblyResult assemblyResultWithFailureProbability)
+ {
+ ThrowException();
+
+ AssemblyResultNoFailureProbability = assemblyResultNoFailureProbability;
+ AssemblyResultWithFailureProbability = assemblyResultWithFailureProbability;
+
+ Calculated = true;
+
+ return AssessmentSectionAssemblyResult;
+ }
+
+ private void ThrowException()
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new Exception("Message", new Exception());
+ }
+
+ if (ThrowAssemblyExceptionOnCalculate)
+ {
+ throw new AssemblyException("entity", EAssemblyErrors.CategoryLowerLimitOutOfRange);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/CombinedFailureMechanismSectionAssemblyKernelStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,110 @@
+// 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly
+{
+ ///
+ /// Combined failure mechanism section assembly kernel stub for testing purposes.
+ ///
+ public class CombinedFailureMechanismSectionAssemblyKernelStub : ICommonFailureMechanismSectionAssembler
+ {
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowAssemblyExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Gets a value indicating whether a calculation was called or not.
+ ///
+ public bool Calculated { get; private set; }
+
+ ///
+ /// Gets a value indicating whether an assembly is partial.
+ ///
+ public bool? PartialAssembly { get; private set; }
+
+ ///
+ /// Gets the assessment section length used as an input parameter for assembly method.
+ ///
+ public double? AssessmentSectionLengthInput { get; private set; }
+
+ ///
+ /// Gets the collection of used as an input parameter for assembly method.
+ ///
+ public IEnumerable FailureMechanismSectionListsInput { get; private set; }
+
+ ///
+ /// Gets or sets the assembly result.
+ ///
+ public AssemblyResult AssemblyResult { get; set; }
+
+ public AssemblyResult AssembleCommonFailureMechanismSections(IEnumerable failureMechanismSectionLists,
+ double assessmentSectionLength, bool partialAssembly)
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new Exception("Message", new Exception());
+ }
+
+ if (ThrowAssemblyExceptionOnCalculate)
+ {
+ throw new AssemblyException("entity", EAssemblyErrors.CategoryLowerLimitOutOfRange);
+ }
+
+ FailureMechanismSectionListsInput = failureMechanismSectionLists;
+ AssessmentSectionLengthInput = assessmentSectionLength;
+ PartialAssembly = partialAssembly;
+
+ Calculated = true;
+
+ return AssemblyResult;
+ }
+
+ public FailureMechanismSectionList FindGreatestCommonDenominatorSectionsWbi3A1(IEnumerable failureMechanismSectionLists,
+ double assessmentSectionLength)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FailureMechanismSectionList TranslateFailureMechanismResultsToCommonSectionsWbi3B1(FailureMechanismSectionList failureMechanismSectionList,
+ FailureMechanismSectionList commonSections)
+ {
+ throw new NotImplementedException();
+ }
+
+ public IEnumerable DeterminCombinedResultPerCommonSectionWbi3C1(IEnumerable failureMechanismResults,
+ bool partialAssembly)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismAssemblyKernelStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismAssemblyKernelStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismAssemblyKernelStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,135 @@
+// 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly
+{
+ ///
+ /// Failure mechanism assembly kernel stub for testing purposes.
+ ///
+ public class FailureMechanismAssemblyKernelStub : IFailureMechanismResultAssembler
+ {
+ ///
+ /// Gets the collection of used as input parameter for assembly methods.
+ ///
+ public IEnumerable FmSectionAssemblyResultsInput { get; private set; }
+
+ ///
+ /// Gets the collection of used as input parameter for assembly methods.
+ ///
+ public IEnumerable FmSectionAssemblyResultsWithProbabilityInput { get; private set; }
+
+ ///
+ /// Gets a value indicating whether an assembly is partial.
+ ///
+ public bool? PartialAssembly { get; private set; }
+
+ ///
+ /// Gets the used as input parameter for assembly methods.
+ ///
+ public FailureMechanism FailureMechanismInput { get; private set; }
+
+ ///
+ /// Gets the with
+ /// used as input parameter for assembly methods.
+ ///
+ public CategoriesList Categories { get; private set; }
+
+ ///
+ /// Gets or sets the failure mechanism category result.
+ ///
+ public EFailureMechanismCategory FailureMechanismCategoryResult { get; set; }
+
+ ///
+ /// Gets or sets the failure mechanism assembly result.
+ ///
+ public FailureMechanismAssemblyResult FailureMechanismAssemblyResult { get; set; }
+
+ ///
+ /// Gets a value indicating whether a calculation was called or not.
+ ///
+ public bool Calculated { get; private set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowAssemblyExceptionOnCalculate { private get; set; }
+
+ public EFailureMechanismCategory AssembleFailureMechanismWbi1A1(IEnumerable fmSectionAssemblyResults,
+ bool partialAssembly)
+ {
+ ThrowException();
+
+ FmSectionAssemblyResultsInput = fmSectionAssemblyResults;
+ PartialAssembly = partialAssembly;
+
+ Calculated = true;
+ return FailureMechanismCategoryResult;
+ }
+
+ public EIndirectAssessmentResult AssembleFailureMechanismWbi1A2(IEnumerable fmSectionAssemblyResults,
+ bool partialAssembly)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FailureMechanismAssemblyResult AssembleFailureMechanismWbi1B1(FailureMechanism failureMechanism,
+ IEnumerable fmSectionAssemblyResults,
+ CategoriesList categoryLimits,
+ bool partialAssembly)
+ {
+ ThrowException();
+
+ Categories = categoryLimits;
+ FailureMechanismInput = failureMechanism;
+ FmSectionAssemblyResultsWithProbabilityInput = fmSectionAssemblyResults;
+ PartialAssembly = partialAssembly;
+
+ Calculated = true;
+ return FailureMechanismAssemblyResult;
+ }
+
+ private void ThrowException()
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new Exception("Message", new Exception());
+ }
+
+ if (ThrowAssemblyExceptionOnCalculate)
+ {
+ throw new AssemblyException("entity", EAssemblyErrors.CategoryLowerLimitOutOfRange);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Assembly/FailureMechanismSectionAssemblyKernelStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,386 @@
+// 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.AssessmentResultTypes;
+using Assembly.Kernel.Model.CategoryLimits;
+using Assembly.Kernel.Model.FmSectionTypes;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly
+{
+ ///
+ /// Failure mechanism section assembly kernel stub for testing purposes.
+ ///
+ public class FailureMechanismSectionAssemblyKernelStub : IAssessmentResultsTranslator
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public FailureMechanismSectionAssemblyKernelStub()
+ {
+ FailureProbabilityInput = double.NaN;
+ LengthEffectFactorInput = double.NaN;
+ }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeE1? AssessmentResultTypeE1Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeE2? AssessmentResultTypeE2Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeG1? AssessmentResultTypeG1Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeG2? AssessmentResultTypeG2Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeT1? AssessmentResultTypeT1Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeT3? AssessmentResultTypeT3Input { get; private set; }
+
+ ///
+ /// Gets the input used in .
+ ///
+ public EAssessmentResultTypeT4? AssessmentResultTypeT4Input { get; private set; }
+
+ ///
+ /// Gets the section category input used as input parameter for assembly methods.
+ ///
+ public EFmSectionCategory? SectionCategoryInput { get; private set; }
+
+ ///
+ /// Gets the simple assessment result used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResult SimpleAssessmentResultInput { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResult DetailedAssessmentResultInput { get; private set; }
+
+ ///
+ /// Gets the tailor made assessment result used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResult TailorMadeAssessmentResultInput { get; private set; }
+
+ ///
+ /// Gets the simple assessment result with probability used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResultWithProbability SimpleAssessmentResultInputWithProbability { get; private set; }
+
+ ///
+ /// Gets the detailed assessment result with probability used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResultWithProbability DetailedAssessmentResultInputWithProbability { get; private set; }
+
+ ///
+ /// Gets the tailor made assessment result with probability used as input parameter for the combined assembly methods.
+ ///
+ public FmSectionAssemblyDirectResultWithProbability TailorMadeAssessmentResultInputWithProbability { get; private set; }
+
+ ///
+ /// Gets the used as input parameter for assembly methods.
+ ///
+ public AssessmentSection AssessmentSectionInput { get; private set; }
+
+ ///
+ /// Gets the used as input parameter for assembly methods.
+ ///
+ public FailureMechanism FailureMechanismInput { get; private set; }
+
+ ///
+ /// Gets the probability of failure used as input parameter for assembly methods.
+ ///
+ public double FailureProbabilityInput { get; private set; }
+
+ ///
+ /// Gets the 'N' parameter used to factor in the 'length effect' which is
+ /// used as input parameter for assembly methods.
+ ///
+ public double LengthEffectFactorInput { get; private set; }
+
+ ///
+ /// Gets the used as input parameter for assembly methods.
+ ///
+ public FmSectionCategoryCompliancyResults CategoryCompliancyResultsInput { get; private set; }
+
+ ///
+ /// Gets the with used
+ /// as input for assembly methods.
+ ///
+ public CategoriesList FailureMechanismSectionCategories { get; private set; }
+
+ ///
+ /// Gets or sets the failure mechanism section assembly result.
+ ///
+ public FmSectionAssemblyDirectResult FailureMechanismSectionDirectResult { get; set; }
+
+ ///
+ /// Gets or sets the failure mechanism section assembly result with probability.
+ ///
+ public FmSectionAssemblyDirectResultWithProbability FailureMechanismSectionDirectResultWithProbability { get; set; }
+
+ ///
+ /// Gets a value indicating whether a calculation was called or not.
+ ///
+ public bool Calculated { get; private set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowAssemblyExceptionOnCalculate { private get; set; }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0E1(EAssessmentResultTypeE1 assessment)
+ {
+ ThrowException();
+
+ AssessmentResultTypeE1Input = assessment;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyIndirectResult TranslateAssessmentResultWbi0E2(EAssessmentResultTypeE1 assessment)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0E3(EAssessmentResultTypeE2 assessment)
+ {
+ ThrowException();
+
+ AssessmentResultTypeE2Input = assessment;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyIndirectResult TranslateAssessmentResultWbi0E4(EAssessmentResultTypeE2 assessment)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0G1(EAssessmentResultTypeG1 assessment)
+ {
+ ThrowException();
+
+ AssessmentResultTypeG1Input = assessment;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyIndirectResult TranslateAssessmentResultWbi0G2(EAssessmentResultTypeG1 assessment)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0G3(EAssessmentResultTypeG2 assessment,
+ double failureProbability,
+ CategoriesList categories)
+ {
+ ThrowException();
+
+ AssessmentResultTypeG2Input = assessment;
+ FailureProbabilityInput = failureProbability;
+ FailureMechanismSectionCategories = categories;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0G4(EAssessmentResultTypeG2 assessment, EFmSectionCategory? category)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0G5(double fmSectionLengthEffectFactor,
+ EAssessmentResultTypeG2 assessment,
+ double failureProbability,
+ CategoriesList categories)
+ {
+ ThrowException();
+
+ AssessmentResultTypeG2Input = assessment;
+ FailureProbabilityInput = failureProbability;
+ LengthEffectFactorInput = fmSectionLengthEffectFactor;
+ FailureMechanismSectionCategories = categories;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0G6(FmSectionCategoryCompliancyResults compliancyResults)
+ {
+ ThrowException();
+
+ CategoryCompliancyResultsInput = compliancyResults;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0T1(EAssessmentResultTypeT1 assessment)
+ {
+ ThrowException();
+
+ AssessmentResultTypeT1Input = assessment;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyIndirectResult TranslateAssessmentResultWbi0T2(EAssessmentResultTypeT2 assessment)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0T3(EAssessmentResultTypeT3 assessment,
+ double failureProbability,
+ CategoriesList categories)
+ {
+ ThrowException();
+
+ AssessmentResultTypeT3Input = assessment;
+ FailureProbabilityInput = failureProbability;
+ FailureMechanismSectionCategories = categories;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0T4(EAssessmentResultTypeT3 assessment, EFmSectionCategory? category)
+ {
+ ThrowException();
+
+ AssessmentResultTypeT3Input = assessment;
+ SectionCategoryInput = category;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0T5(double fmSectionLengthEffectFactor,
+ EAssessmentResultTypeT3 assessment,
+ double failureProbability,
+ CategoriesList categories)
+ {
+ ThrowException();
+
+ AssessmentResultTypeT3Input = assessment;
+ FailureProbabilityInput = failureProbability;
+ LengthEffectFactorInput = fmSectionLengthEffectFactor;
+ FailureMechanismSectionCategories = categories;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0T6(FmSectionCategoryCompliancyResults compliancyResults, EAssessmentResultTypeT3 assessment)
+ {
+ throw new NotImplementedException();
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0T7(EAssessmentResultTypeT4 assessment,
+ double failureProbability,
+ CategoriesList categories)
+ {
+ ThrowException();
+
+ AssessmentResultTypeT4Input = assessment;
+ FailureProbabilityInput = failureProbability;
+ FailureMechanismSectionCategories = categories;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyDirectResult TranslateAssessmentResultWbi0A1(FmSectionAssemblyDirectResult simpleAssessmentResult,
+ FmSectionAssemblyDirectResult detailedAssessmentResult,
+ FmSectionAssemblyDirectResult customAssessmentResult)
+ {
+ ThrowException();
+
+ SimpleAssessmentResultInput = simpleAssessmentResult;
+ DetailedAssessmentResultInput = detailedAssessmentResult;
+ TailorMadeAssessmentResultInput = customAssessmentResult;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResult;
+ }
+
+ public FmSectionAssemblyDirectResultWithProbability TranslateAssessmentResultWbi0A1(FmSectionAssemblyDirectResultWithProbability simpleAssessmentResult,
+ FmSectionAssemblyDirectResultWithProbability detailedAssessmentResult,
+ FmSectionAssemblyDirectResultWithProbability customAssessmentResult)
+ {
+ ThrowException();
+
+ SimpleAssessmentResultInputWithProbability = simpleAssessmentResult;
+ DetailedAssessmentResultInputWithProbability = detailedAssessmentResult;
+ TailorMadeAssessmentResultInputWithProbability = customAssessmentResult;
+
+ Calculated = true;
+ return FailureMechanismSectionDirectResultWithProbability;
+ }
+
+ public FmSectionAssemblyIndirectResult TranslateAssessmentResultWbi0A1(FmSectionAssemblyIndirectResult simpleAssessmentResult,
+ FmSectionAssemblyIndirectResult detailedAssessmentResult,
+ FmSectionAssemblyIndirectResult customAssessmentResult)
+ {
+ throw new NotImplementedException();
+ }
+
+ private void ThrowException()
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new Exception("Message", new Exception());
+ }
+
+ if (ThrowAssemblyExceptionOnCalculate)
+ {
+ throw new AssemblyException("entity", EAssemblyErrors.CategoryLowerLimitOutOfRange);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/AssemblyToolKernelFactoryConfig.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/AssemblyToolKernelFactoryConfig.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/AssemblyToolKernelFactoryConfig.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,76 @@
+// 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 Riskeer.AssemblyTool.KernelWrapper.Kernels;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels
+{
+ ///
+ /// This class can be used to set a temporary
+ /// for while testing.
+ /// Disposing an instance of this class will revert the .
+ ///
+ ///
+ /// The following is an example for how to use this class:
+ ///
+ /// using(new AssemblyToolKernelFactoryConfig())
+ /// {
+ /// var testFactory = (TestAssemblyToolKernelFactory) AssemblyToolKernelFactory.Instance;
+ ///
+ /// // Perform tests with testFactory
+ /// }
+ ///
+ ///
+ public class AssemblyToolKernelFactoryConfig : IDisposable
+ {
+ private readonly IAssemblyToolKernelFactory previousFactory;
+
+ ///
+ /// Creates a new instance of .
+ /// Sets a to
+ ///
+ ///
+ public AssemblyToolKernelFactoryConfig()
+ {
+ previousFactory = AssemblyToolKernelFactory.Instance;
+ AssemblyToolKernelFactory.Instance = new TestAssemblyToolKernelFactory();
+ }
+
+ ///
+ /// Reverts the to the value
+ /// it had at time of construction of the .
+ ///
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ AssemblyToolKernelFactory.Instance = previousFactory;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/Categories/AssemblyCategoriesKernelStub.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,156 @@
+// 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 Assembly.Kernel.Exceptions;
+using Assembly.Kernel.Interfaces;
+using Assembly.Kernel.Model;
+using Assembly.Kernel.Model.CategoryLimits;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories
+{
+ ///
+ /// Assembly categories kernel stub for testing purposes.
+ ///
+ public class AssemblyCategoriesKernelStub : ICategoryLimitsCalculator
+ {
+ ///
+ /// Gets a value indicating whether a calculation was called or not.
+ ///
+ public bool Calculated { get; private set; }
+
+ ///
+ /// Gets the assessment section norm.
+ ///
+ public double AssessmentSectionNorm { get; private set; }
+
+ ///
+ /// Gets the lower limit norm.
+ ///
+ public double LowerLimitNorm { get; private set; }
+
+ ///
+ /// Gets the upper boundary norm.
+ ///
+ public double SignalingNorm { get; private set; }
+
+ ///
+ /// Gets the failure mechanism contribution.
+ ///
+ public double FailureMechanismContribution { get; private set; }
+
+ ///
+ /// Gets the n.
+ ///
+ public double N { get; private set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Sets an indicator whether an must be thrown while performing a calculation.
+ ///
+ public bool ThrowAssemblyExceptionOnCalculate { private get; set; }
+
+ ///
+ /// Gets or sets the assessment section categories output.
+ ///
+ public CategoriesList AssessmentSectionCategoriesOutput { get; set; }
+
+ ///
+ /// Gets or sets the failure mechanism categories output.
+ ///
+ public CategoriesList FailureMechanismCategoriesOutput { get; set; }
+
+ ///
+ /// Gets or sets the failure mechanism section categories output.
+ ///
+ public CategoriesList FailureMechanismSectionCategoriesOutput { get; set; }
+
+ public CategoriesList CalculateAssessmentSectionCategoryLimitsWbi21(AssessmentSection section)
+ {
+ ThrowException();
+
+ SignalingNorm = section.FailureProbabilitySignallingLimit;
+ LowerLimitNorm = section.FailureProbabilityLowerLimit;
+
+ Calculated = true;
+
+ return AssessmentSectionCategoriesOutput;
+ }
+
+ public CategoriesList CalculateFailureMechanismCategoryLimitsWbi11(AssessmentSection section, FailureMechanism failureMechanism)
+ {
+ ThrowException();
+
+ SignalingNorm = section.FailureProbabilitySignallingLimit;
+ LowerLimitNorm = section.FailureProbabilityLowerLimit;
+ FailureMechanismContribution = failureMechanism.FailureProbabilityMarginFactor;
+ N = failureMechanism.LengthEffectFactor;
+
+ Calculated = true;
+
+ return FailureMechanismCategoriesOutput;
+ }
+
+ public CategoriesList CalculateFmSectionCategoryLimitsWbi01(AssessmentSection section, FailureMechanism failureMechanism)
+ {
+ ThrowException();
+
+ SignalingNorm = section.FailureProbabilitySignallingLimit;
+ LowerLimitNorm = section.FailureProbabilityLowerLimit;
+ FailureMechanismContribution = failureMechanism.FailureProbabilityMarginFactor;
+ N = failureMechanism.LengthEffectFactor;
+
+ Calculated = true;
+
+ return FailureMechanismSectionCategoriesOutput;
+ }
+
+ public CategoriesList CalculateFmSectionCategoryLimitsWbi02(double assessmentSectionNorm, FailureMechanism failureMechanism)
+ {
+ ThrowException();
+
+ AssessmentSectionNorm = assessmentSectionNorm;
+ FailureMechanismContribution = failureMechanism.FailureProbabilityMarginFactor;
+ N = failureMechanism.LengthEffectFactor;
+
+ Calculated = true;
+
+ return FailureMechanismSectionCategoriesOutput;
+ }
+
+ private void ThrowException()
+ {
+ if (ThrowExceptionOnCalculate)
+ {
+ throw new Exception("Message", new Exception());
+ }
+
+ if (ThrowAssemblyExceptionOnCalculate)
+ {
+ throw new AssemblyException("entity", EAssemblyErrors.CategoryLowerLimitOutOfRange);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Kernels/TestAssemblyToolKernelFactory.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,96 @@
+// 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.Interfaces;
+using Riskeer.AssemblyTool.KernelWrapper.Kernels;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Assembly;
+using Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels.Categories;
+
+namespace Riskeer.AssemblyTool.KernelWrapper.TestUtil.Kernels
+{
+ ///
+ /// Factory that creates assembly tool kernel stubs for testing purposes.
+ ///
+ public class TestAssemblyToolKernelFactory : IAssemblyToolKernelFactory
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public TestAssemblyToolKernelFactory()
+ {
+ LastCreatedAssemblyCategoriesKernel = new AssemblyCategoriesKernelStub();
+ LastCreatedFailureMechanismSectionAssemblyKernel = new FailureMechanismSectionAssemblyKernelStub();
+ LastCreatedFailureMechanismAssemblyKernel = new FailureMechanismAssemblyKernelStub();
+ LastCreatedAssessmentSectionAssemblyKernel = new AssessmentSectionAssemblyKernelStub();
+ LastCreatedCombinedFailureMechanismSectionAssemblyKernel = new CombinedFailureMechanismSectionAssemblyKernelStub();
+ }
+
+ ///
+ /// Gets the last created assembly categories kernel.
+ ///
+ public AssemblyCategoriesKernelStub LastCreatedAssemblyCategoriesKernel { get; }
+
+ ///
+ /// Gets the last created failure mechanism section assembly kernel.
+ ///
+ public FailureMechanismSectionAssemblyKernelStub LastCreatedFailureMechanismSectionAssemblyKernel { get; }
+
+ ///
+ /// Gets the last created failure mechanism assembly kernel.
+ ///
+ public FailureMechanismAssemblyKernelStub LastCreatedFailureMechanismAssemblyKernel { get; }
+
+ ///
+ /// Gets the last created assessment section assembly kernel.
+ ///
+ public AssessmentSectionAssemblyKernelStub LastCreatedAssessmentSectionAssemblyKernel { get; }
+
+ ///
+ /// Gets the last created combined failure mechanism section assembly kernel.
+ ///
+ public CombinedFailureMechanismSectionAssemblyKernelStub LastCreatedCombinedFailureMechanismSectionAssemblyKernel { get; }
+
+ public ICategoryLimitsCalculator CreateAssemblyCategoriesKernel()
+ {
+ return LastCreatedAssemblyCategoriesKernel;
+ }
+
+ public IAssessmentResultsTranslator CreateFailureMechanismSectionAssemblyKernel()
+ {
+ return LastCreatedFailureMechanismSectionAssemblyKernel;
+ }
+
+ public IFailureMechanismResultAssembler CreateFailureMechanismAssemblyKernel()
+ {
+ return LastCreatedFailureMechanismAssemblyKernel;
+ }
+
+ public IAssessmentGradeAssembler CreateAssessmentSectionAssemblyKernel()
+ {
+ return LastCreatedAssessmentSectionAssemblyKernel;
+ }
+
+ public ICommonFailureMechanismSectionAssembler CreateCombinedFailureMechanismSectionAssemblyKernel()
+ {
+ return LastCreatedCombinedFailureMechanismSectionAssemblyKernel;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Properties/AssemblyInfo.cs
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Properties/AssemblyInfo.cs (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Properties/AssemblyInfo.cs (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,25 @@
+// 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.Reflection;
+
+[assembly: AssemblyTitle("Riskeer.AssemblyTool.KernelWrapper.TestUtil")]
+[assembly: AssemblyProduct("Riskeer.AssemblyTool.KernelWrapper.TestUtil")]
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/Riskeer.AssemblyTool.KernelWrapper.TestUtil.csproj (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,64 @@
+
+
+
+ {0AB432BB-E2CC-42EA-A72C-7AFEF7536B38}
+ Riskeer.AssemblyTool.KernelWrapper.TestUtil
+ Riskeer.AssemblyTool.KernelWrapper.TestUtil
+
+
+
+
+ ..\..\..\..\lib\Plugins\AssemblyTool\Assembly.Kernel.dll
+
+
+ ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Copying.licenseheader
+
+
+
+
+
+ {D749EE4C-CE50-4C17-BF01-9A953028C126}
+ Core.Common.TestUtil
+
+
+ {78AA56F5-431D-465C-AC50-3173D7E90AC1}
+ Ringtoets.Common.Primitives
+
+
+ {420ED9C3-0C33-47EA-B893-121A9C0DB4F1}
+ Riskeer.AssemblyTool.Data
+
+
+ {358B6DA2-A1DF-477F-B6AC-C30204265CB0}
+ Riskeer.AssemblyTool.KernelWrapper
+
+
+
\ No newline at end of file
Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/packages.config
===================================================================
diff -u
--- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/packages.config (revision 0)
+++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.KernelWrapper.TestUtil/packages.config (revision c46bf659404f3caea7f90b053a9af10d28f7da94)
@@ -0,0 +1,25 @@
+
+
+
+
\ No newline at end of file