Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs (.../ClosingStructuresFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Data/ClosingStructuresFailureMechanismAssemblyFactory.cs (.../ClosingStructuresFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -236,6 +236,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Data.Test/ClosingStructuresFailureMechanismAssemblyFactoryTest.cs (.../ClosingStructuresFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -646,6 +646,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new ClosingStructuresFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = ClosingStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismAssemblyFactory.cs (.../DuneErosionFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneErosionFailureMechanismAssemblyFactory.cs (.../DuneErosionFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -26,6 +26,7 @@ using Ringtoets.AssemblyTool.KernelWrapper.Calculators; using Ringtoets.AssemblyTool.KernelWrapper.Calculators.Assembly; using Ringtoets.AssemblyTool.KernelWrapper.Kernels; +using Ringtoets.Common.Data.AssemblyTool; using Ringtoets.Common.Data.Exceptions; namespace Ringtoets.DuneErosion.Data @@ -173,25 +174,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(DuneErosionFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Forms/Views/DuneErosionFailureMechanismResultView.cs (.../DuneErosionFailureMechanismResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -58,7 +58,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override DuneErosionSectionResultRow CreateFailureMechanismSectionResultRow(DuneErosionFailureMechanismSectionResult sectionResult) Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismAssemblyFactoryTest.cs (.../DuneErosionFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneErosionFailureMechanismAssemblyFactoryTest.cs (.../DuneErosionFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -392,63 +392,77 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new DuneErosionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - }; + var failureMechanism = new DuneErosionFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - DuneErosionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + DuneErosionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } [Test] - public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new DuneErosionFailureMechanism { - new DuneErosionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + DuneErosionFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -463,8 +477,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(new DuneErosionFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -482,8 +495,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(new DuneErosionFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -238,6 +238,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverErosionInwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -646,6 +646,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = GrassCoverErosionInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Data/GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -174,25 +174,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/Views/GrassCoverErosionOutwardsFailureMechanismResultView.cs (.../GrassCoverErosionOutwardsFailureMechanismResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -58,7 +58,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override GrassCoverErosionOutwardsFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult) Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverErosionOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Data.Test/GrassCoverErosionOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverErosionOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -392,63 +392,77 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new GrassCoverErosionOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - }; + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } [Test] - public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism { - new GrassCoverErosionOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + GrassCoverErosionOutwardsFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -463,8 +477,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverErosionOutwardsFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -482,8 +495,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverErosionOutwardsFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs (.../HeightStructuresFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresFailureMechanismAssemblyFactory.cs (.../HeightStructuresFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -238,6 +238,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismAssemblyFactoryTest.cs (.../HeightStructuresFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresFailureMechanismAssemblyFactoryTest.cs (.../HeightStructuresFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -646,6 +646,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = HeightStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -173,25 +173,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(GrassCoverSlipOffInwardsFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -173,25 +173,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(GrassCoverSlipOffOutwardsFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactory.cs (.../MacroStabilityOutwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactory.cs (.../MacroStabilityOutwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -198,6 +198,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismSectionAssemblyCategoryGroup.NotApplicable; + } + FailureMechanismSectionAssemblyCategoryGroup simpleAssembly = AssembleSimpleAssessment(failureMechanismSectionResult); FailureMechanismSectionAssemblyCategoryGroup detailedAssembly = AssembleDetailedAssessment( failureMechanismSectionResult, failureMechanism, assessmentSection); @@ -241,6 +246,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup ? sectionResult.ManualAssemblyCategoryGroup Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactory.cs (.../MicrostabilityFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactory.cs (.../MicrostabilityFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -173,25 +173,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(MicrostabilityFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs (.../PipingStructureFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactory.cs (.../PipingStructureFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -173,25 +173,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(PipingStructureFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -139,25 +139,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactory.cs (.../TechnicalInnovationFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactory.cs (.../TechnicalInnovationFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -139,25 +139,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(TechnicalInnovationFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Data/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -139,25 +139,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(WaterPressureAsphaltCoverFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssemblyResultTotalView.cs (.../AssemblyResultTotalView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -223,28 +223,28 @@ { StabilityStoneCoverFailureMechanism stabilityStoneCover = AssessmentSection.StabilityStoneCover; return new FailureMechanismAssemblyCategoryGroupResultRow(stabilityStoneCover, - () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityStoneCover.SectionResults)); + () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(stabilityStoneCover)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateWaveImpactFailureMechanismAssemblyResultRow() { WaveImpactAsphaltCoverFailureMechanism waveImpactAsphaltCover = AssessmentSection.WaveImpactAsphaltCover; return new FailureMechanismAssemblyCategoryGroupResultRow(waveImpactAsphaltCover, - () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waveImpactAsphaltCover.SectionResults)); + () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waveImpactAsphaltCover)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateGrassCoverErosionOutwardsFailureMechanismAssemblyResultRow() { GrassCoverErosionOutwardsFailureMechanism grassCoverErosionOutwards = AssessmentSection.GrassCoverErosionOutwards; return new FailureMechanismAssemblyCategoryGroupResultRow(grassCoverErosionOutwards, - () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverErosionOutwards.SectionResults)); + () => GrassCoverErosionOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverErosionOutwards)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateDuneErosionFailureMechanismAssemblyResultRow() { DuneErosionFailureMechanism duneErosion = AssessmentSection.DuneErosion; return new FailureMechanismAssemblyCategoryGroupResultRow(duneErosion, - () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(duneErosion.SectionResults)); + () => DuneErosionFailureMechanismAssemblyFactory.AssembleFailureMechanism(duneErosion)); } #endregion @@ -263,49 +263,49 @@ { MicrostabilityFailureMechanism microstability = AssessmentSection.Microstability; return new FailureMechanismAssemblyCategoryGroupResultRow(microstability, - () => MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(microstability.SectionResults)); + () => MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(microstability)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateWaterPressureAsphaltCoverFailureMechanismAssemblyResultRow() { WaterPressureAsphaltCoverFailureMechanism waterPressureAsphaltCover = AssessmentSection.WaterPressureAsphaltCover; return new FailureMechanismAssemblyCategoryGroupResultRow(waterPressureAsphaltCover, - () => WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waterPressureAsphaltCover.SectionResults)); + () => WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(waterPressureAsphaltCover)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateGrassCoverSlipOffOutwardsFailureMechanismAssemblyResultRow() { GrassCoverSlipOffOutwardsFailureMechanism grassCoverSlipOffOutwards = AssessmentSection.GrassCoverSlipOffOutwards; return new FailureMechanismAssemblyCategoryGroupResultRow(grassCoverSlipOffOutwards, - () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverSlipOffOutwards.SectionResults)); + () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverSlipOffOutwards)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateGrassCoverSlipOffInwardsFailureMechanismAssemblyResultRow() { GrassCoverSlipOffInwardsFailureMechanism grassCoverSlipOffInwards = AssessmentSection.GrassCoverSlipOffInwards; return new FailureMechanismAssemblyCategoryGroupResultRow(grassCoverSlipOffInwards, - () => GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverSlipOffInwards.SectionResults)); + () => GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(grassCoverSlipOffInwards)); } private FailureMechanismAssemblyCategoryGroupResultRow CreatePipingStructureFailureMechanismAssemblyResultRow() { PipingStructureFailureMechanism pipingStructure = AssessmentSection.PipingStructure; return new FailureMechanismAssemblyCategoryGroupResultRow(pipingStructure, - () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(pipingStructure.SectionResults)); + () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(pipingStructure)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateStrengthStabilityLengthWiseConstructionFailureMechanismAssemblyResultRow() { StrengthStabilityLengthwiseConstructionFailureMechanism strengthStabilityLengthwiseConstruction = AssessmentSection.StrengthStabilityLengthwiseConstruction; return new FailureMechanismAssemblyCategoryGroupResultRow(strengthStabilityLengthwiseConstruction, - () => StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(strengthStabilityLengthwiseConstruction.SectionResults)); + () => StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(strengthStabilityLengthwiseConstruction)); } private FailureMechanismAssemblyCategoryGroupResultRow CreateTechnicalInnovationFailureMechanismAssemblyResultRow() { TechnicalInnovationFailureMechanism technicalInnovation = AssessmentSection.TechnicalInnovation; return new FailureMechanismAssemblyCategoryGroupResultRow(technicalInnovation, - () => TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(technicalInnovation.SectionResults)); + () => TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(technicalInnovation)); } #endregion Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffInwardsResultView.cs (.../GrassCoverSlipOffInwardsResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -56,7 +56,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override GrassCoverSlipOffInwardsSectionResultRow CreateFailureMechanismSectionResultRow( Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/GrassCoverSlipOffOutwardsResultView.cs (.../GrassCoverSlipOffOutwardsResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -57,7 +57,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override GrassCoverSlipOffOutwardsSectionResultRow CreateFailureMechanismSectionResultRow(GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/MicrostabilityResultView.cs (.../MicrostabilityResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -56,7 +56,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override MicrostabilitySectionResultRow CreateFailureMechanismSectionResultRow(MicrostabilityFailureMechanismSectionResult sectionResult) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/PipingStructureResultView.cs (.../PipingStructureResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -56,7 +56,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override PipingStructureSectionResultRow CreateFailureMechanismSectionResultRow(PipingStructureFailureMechanismSectionResult sectionResult) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/StrengthStabilityLengthwiseConstructionResultView.cs (.../StrengthStabilityLengthwiseConstructionResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -57,7 +57,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override StrengthStabilityLengthwiseConstructionSectionResultRow CreateFailureMechanismSectionResultRow( Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/TechnicalInnovationResultView.cs (.../TechnicalInnovationResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -55,7 +55,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override TechnicalInnovationSectionResultRow CreateFailureMechanismSectionResultRow(TechnicalInnovationFailureMechanismSectionResult sectionResult) Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultViews/WaterPressureAsphaltCoverResultView.cs (.../WaterPressureAsphaltCoverResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -55,7 +55,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override WaterPressureAsphaltCoverSectionResultRow CreateFailureMechanismSectionResultRow(WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult) Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffInwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffInwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -371,36 +372,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism { - new GrassCoverSlipOffInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -409,25 +427,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new GrassCoverSlipOffInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + GrassCoverSlipOffInwardsFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -442,8 +457,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverSlipOffInwardsFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -461,8 +475,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => GrassCoverSlipOffInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverSlipOffInwardsFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs (.../GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -370,36 +371,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism { - new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -408,25 +426,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + GrassCoverSlipOffOutwardsFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -441,8 +456,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverSlipOffOutwardsFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -460,8 +474,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => GrassCoverSlipOffOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(new GrassCoverSlipOffOutwardsFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactoryTest.cs (.../MacroStabilityOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MacroStabilityOutwardsFailureMechanismAssemblyFactoryTest.cs (.../MacroStabilityOutwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -645,6 +645,31 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssemblyCategoryGroup assembly = MacroStabilityOutwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism, + assessmentSection); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactoryTest.cs (.../MicrostabilityFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/MicrostabilityFailureMechanismAssemblyFactoryTest.cs (.../MicrostabilityFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -371,36 +372,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new MicrostabilityFailureMechanism { - new MicrostabilityFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - MicrostabilityFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + MicrostabilityFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -409,25 +427,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new MicrostabilityFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new MicrostabilityFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + MicrostabilityFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -442,8 +457,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(new MicrostabilityFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -461,8 +475,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => MicrostabilityFailureMechanismAssemblyFactory.AssembleFailureMechanism(new MicrostabilityFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs (.../PipingStructureFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/PipingStructureFailureMechanismAssemblyFactoryTest.cs (.../PipingStructureFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -371,36 +372,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new PipingStructureFailureMechanism { - new PipingStructureFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - PipingStructureFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + PipingStructureFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -409,25 +427,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new PipingStructureFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + PipingStructureFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -442,8 +457,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(new PipingStructureFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -461,8 +475,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => PipingStructureFailureMechanismAssemblyFactory.AssembleFailureMechanism(new PipingStructureFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactoryTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactoryTest.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -291,36 +292,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism { - new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -329,25 +347,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -362,8 +377,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(new StrengthStabilityLengthwiseConstructionFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -381,8 +395,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => StrengthStabilityLengthwiseConstructionFailureMechanismAssemblyFactory.AssembleFailureMechanism(new StrengthStabilityLengthwiseConstructionFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactoryTest.cs (.../TechnicalInnovationFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/TechnicalInnovationFailureMechanismAssemblyFactoryTest.cs (.../TechnicalInnovationFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -290,36 +291,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new TechnicalInnovationFailureMechanism { - new TechnicalInnovationFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - TechnicalInnovationFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + TechnicalInnovationFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -328,25 +346,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new TechnicalInnovationFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new TechnicalInnovationFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + TechnicalInnovationFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -361,8 +376,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(new TechnicalInnovationFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -380,8 +394,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => TechnicalInnovationFailureMechanismAssemblyFactory.AssembleFailureMechanism(new TechnicalInnovationFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaterPressureAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Data.Test/StandAlone/AssemblyFactories/WaterPressureAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaterPressureAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -32,6 +32,7 @@ using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Primitives; +using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.AssemblyFactories; using Ringtoets.Integration.Data.StandAlone.SectionResults; @@ -290,36 +291,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism { - new WaterPressureAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -328,25 +346,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new WaterPressureAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + WaterPressureAsphaltCoverFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -361,8 +376,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new WaterPressureAsphaltCoverFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -380,8 +394,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => WaterPressureAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new WaterPressureAsphaltCoverFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismAssemblyFactory.cs (.../MacroStabilityInwardsFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsFailureMechanismAssemblyFactory.cs (.../MacroStabilityInwardsFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -256,6 +256,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismAssemblyFactoryTest.cs (.../MacroStabilityInwardsFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/MacroStabilityInwardsFailureMechanismAssemblyFactoryTest.cs (.../MacroStabilityInwardsFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -725,6 +725,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new MacroStabilityInwardsFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = MacroStabilityInwardsFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismAssemblyFactory.cs (.../PipingFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingFailureMechanismAssemblyFactory.cs (.../PipingFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -256,6 +256,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismAssemblyFactoryTest.cs (.../PipingFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingFailureMechanismAssemblyFactoryTest.cs (.../PipingFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -726,6 +726,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new PipingFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = PipingFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismAssemblyFactory.cs (.../StabilityPointStructuresFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismAssemblyFactory.cs (.../StabilityPointStructuresFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -236,6 +236,11 @@ throw new ArgumentNullException(nameof(assessmentSection)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(); + } + IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; AssemblyCategoriesInput assemblyCategoriesInput = CreateAssemblyCategoriesInput(failureMechanism, assessmentSection); IEnumerable sectionAssemblies = AssembleSections(failureMechanism, Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismAssemblyFactoryTest.cs (.../StabilityPointStructuresFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismAssemblyFactoryTest.cs (.../StabilityPointStructuresFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -646,6 +646,32 @@ } [Test] + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism + { + IsRelevant = false + }; + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + // Call + FailureMechanismAssembly assembly = StabilityPointStructuresFailureMechanismAssemblyFactory.AssembleFailureMechanism( + failureMechanism, + assessmentSection); + + // Assert + AssemblyToolTestHelper.AssertAreEqual(FailureMechanismAssemblyFactory.CreateNotApplicableAssembly(), assembly); + mocks.VerifyAll(); + } + } + + [Test] public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() { // Setup Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismAssemblyFactory.cs (.../StabilityStoneCoverFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Data/StabilityStoneCoverFailureMechanismAssemblyFactory.cs (.../StabilityStoneCoverFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -174,25 +174,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(StabilityStoneCoverFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/Views/StabilityStoneCoverResultView.cs (.../StabilityStoneCoverResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -57,7 +57,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override StabilityStoneCoverSectionResultRow CreateFailureMechanismSectionResultRow(StabilityStoneCoverFailureMechanismSectionResult sectionResult) Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismAssemblyFactoryTest.cs (.../StabilityStoneCoverFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Data.Test/StabilityStoneCoverFailureMechanismAssemblyFactoryTest.cs (.../StabilityStoneCoverFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -392,36 +392,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new StabilityStoneCoverFailureMechanism { - new StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -430,25 +447,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new StabilityStoneCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + StabilityStoneCoverFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -463,8 +477,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new StabilityStoneCoverFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -482,8 +495,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => StabilityStoneCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new StabilityStoneCoverFailureMechanism()); // Assert var exception = Assert.Throws(call); Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Data/WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -174,25 +174,28 @@ /// /// Assembles the failure mechanism assembly. /// - /// The failure mechanism section results to - /// get the assembly for. + /// The failure mechanism to assemble for. /// A . - /// Thrown when + /// Thrown when /// is null. /// Thrown when the /// could not be created. - public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism( - IEnumerable failureMechanismSectionResults) + public static FailureMechanismAssemblyCategoryGroup AssembleFailureMechanism(WaveImpactAsphaltCoverFailureMechanism failureMechanism) { - if (failureMechanismSectionResults == null) + if (failureMechanism == null) { - throw new ArgumentNullException(nameof(failureMechanismSectionResults)); + throw new ArgumentNullException(nameof(failureMechanism)); } + if (!failureMechanism.IsRelevant) + { + return FailureMechanismAssemblyCategoryGroup.NotApplicable; + } + IEnumerable sectionAssemblies = - failureMechanismSectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup - ? sectionResult.ManualAssemblyCategoryGroup - : AssembleCombinedAssessment(sectionResult))).ToArray(); + failureMechanism.SectionResults.Select(sectionResult => (sectionResult.UseManualAssemblyCategoryGroup + ? sectionResult.ManualAssemblyCategoryGroup + : AssembleCombinedAssessment(sectionResult))).ToArray(); IAssemblyToolCalculatorFactory calculatorFactory = AssemblyToolCalculatorFactory.Instance; IFailureMechanismAssemblyCalculator calculator = Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs =================================================================== diff -u -rbbbfacd9e38cf43c98dba73e39694850fb932a66 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision bbbfacd9e38cf43c98dba73e39694850fb932a66) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/Views/WaveImpactAsphaltCoverFailureMechanismResultView.cs (.../WaveImpactAsphaltCoverFailureMechanismResultView.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -57,7 +57,7 @@ var failureMechanismAssemblyResultWithProbabilityControl = new FailureMechanismAssemblyResultControl(); SetFailureMechanismAssemblyResultControl( failureMechanismAssemblyResultWithProbabilityControl, - () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism.SectionResults))); + () => failureMechanismAssemblyResultWithProbabilityControl.SetAssemblyResult(WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(FailureMechanism))); } protected override WaveImpactAsphaltCoverFailureMechanismSectionResultRow CreateFailureMechanismSectionResultRow( Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs =================================================================== diff -u -r76d5e546e8087c3cd169dd2e6bb04556d88eec87 -rae1937fe2fcb175b4a0f9fa5f1aaed132431f66c --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision 76d5e546e8087c3cd169dd2e6bb04556d88eec87) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Data.Test/WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs (.../WaveImpactAsphaltCoverFailureMechanismAssemblyFactoryTest.cs) (revision ae1937fe2fcb175b4a0f9fa5f1aaed132431f66c) @@ -392,36 +392,53 @@ #region Failure Mechanism Assembly [Test] - public void AssembleFailureMechanism_FailureMechanismSectionResultsNull_ThrowsArgumentNullException() + public void AssembleFailureMechanism_FailureMechanismNull_ThrowsArgumentNullException() { // Call TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(null); // Assert var exception = Assert.Throws(call); - Assert.AreEqual("failureMechanismSectionResults", exception.ParamName); + Assert.AreEqual("failureMechanism", exception.ParamName); } [Test] - public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + public void AssembleFailureMechanism_FailureMechanismIsNotRelevant_ReturnsNotApplicableAssembly() { // Setup - var sectionResults = new[] + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism { - new WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) + IsRelevant = false }; using (new AssemblyToolCalculatorFactoryConfig()) { + // Call + FailureMechanismAssemblyCategoryGroup assembly = WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); + + // Assert + Assert.AreEqual(FailureMechanismAssemblyCategoryGroup.NotApplicable, assembly); + } + } + + [Test] + public void AssembleFailureMechanism_WithoutManualInput_SetsInputOnCalculator() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + + using (new AssemblyToolCalculatorFactoryConfig()) + { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert FailureMechanismSectionAssemblyCategoryGroup assemblyCategory = - WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(sectionResults.Single()); + WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleCombinedAssessment(failureMechanism.SectionResults.Single()); Assert.AreEqual(assemblyCategory, calculator.FailureMechanismSectionCategories.Single()); } } @@ -430,25 +447,22 @@ public void AssembleFailureMechanism_WithManualInput_SetsInputOnCalculator() { // Setup - var sectionResults = new[] - { - new WaveImpactAsphaltCoverFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()) - { - UseManualAssemblyCategoryGroup = true, - ManualAssemblyCategoryGroup = new Random(39).NextEnumValue() - } - }; + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + WaveImpactAsphaltCoverFailureMechanismSectionResult sectionResult = failureMechanism.SectionResults.Single(); + sectionResult.UseManualAssemblyCategoryGroup = true; + sectionResult.ManualAssemblyCategoryGroup = new Random(39).NextEnumValue(); using (new AssemblyToolCalculatorFactoryConfig()) { var calculatorFactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; FailureMechanismAssemblyCalculatorStub calculator = calculatorFactory.LastCreatedFailureMechanismAssemblyCalculator; // Call - WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(sectionResults); + WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(failureMechanism); // Assert - Assert.AreEqual(sectionResults.Single().ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); + Assert.AreEqual(sectionResult.ManualAssemblyCategoryGroup, calculator.FailureMechanismSectionCategories.Single()); } } @@ -463,8 +477,7 @@ // Call FailureMechanismAssemblyCategoryGroup actualOutput = - WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new WaveImpactAsphaltCoverFailureMechanism()); // Assert Assert.AreEqual(calculator.FailureMechanismAssemblyCategoryGroupOutput, actualOutput); @@ -482,8 +495,7 @@ calculator.ThrowExceptionOnCalculate = true; // Call - TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism( - Enumerable.Empty()); + TestDelegate call = () => WaveImpactAsphaltCoverFailureMechanismAssemblyFactory.AssembleFailureMechanism(new WaveImpactAsphaltCoverFailureMechanism()); // Assert var exception = Assert.Throws(call);