Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs =================================================================== diff -u -rff45b39f34e7cb97544606bcca43ed01b586a880 -r60bd6e76d31e06ec9c3f70e2193d90cd3ea7c3b5 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (.../MacroStabilityOutwardsSectionResultRow.cs) (revision ff45b39f34e7cb97544606bcca43ed01b586a880) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRow.cs (.../MacroStabilityOutwardsSectionResultRow.cs) (revision 60bd6e76d31e06ec9c3f70e2193d90cd3ea7c3b5) @@ -165,5 +165,37 @@ return MacroStabilityOutwardsFailureMechanismSectionResultAssemblyFactory.AssembleSimpleAssessment(SectionResult).Group; } } + + /// + /// Gets the detailed assembly category group. + /// + /// Thrown when the + /// could not be created. + public FailureMechanismSectionAssemblyCategoryGroup DetailedAssemblyCategoryGroup + { + get + { + return MacroStabilityOutwardsFailureMechanismSectionResultAssemblyFactory.AssembleDetailedAssembly( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + } + + /// + /// Gets the tailor made assembly category group. + /// + /// Thrown when the + /// could not be created. + public FailureMechanismSectionAssemblyCategoryGroup TailorMadeAssemblyCategoryGroup + { + get + { + return MacroStabilityOutwardsFailureMechanismSectionResultAssemblyFactory.AssembleTailorMadeAssembly( + SectionResult, + failureMechanism, + assessmentSection).Group; + } + } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs =================================================================== diff -u -rff45b39f34e7cb97544606bcca43ed01b586a880 -r60bd6e76d31e06ec9c3f70e2193d90cd3ea7c3b5 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision ff45b39f34e7cb97544606bcca43ed01b586a880) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/SectionResultRows/MacroStabilityOutwardsSectionResultRowTest.cs (.../MacroStabilityOutwardsSectionResultRowTest.cs) (revision 60bd6e76d31e06ec9c3f70e2193d90cd3ea7c3b5) @@ -109,6 +109,8 @@ nameof(MacroStabilityOutwardsSectionResultRow.TailorMadeAssessmentProbability)); } + #region Registration + [Test] public void SimpleAssessmentResult_SetNewValue_NotifyObserversAndPropertyChanged() { @@ -302,6 +304,10 @@ mocks.VerifyAll(); } + #endregion + + #region Assembly Results + [Test] public void SimpleAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() { @@ -356,5 +362,121 @@ mocks.VerifyAll(); } } + + [Test] + public void DetailedAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + + // Call + FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup = row.DetailedAssemblyCategoryGroup; + + // Assert + FailureMechanismSectionAssembly calculatorOutput = calculator.DetailedAssessmentAssemblyOutput; + Assert.AreEqual(calculatorOutput.Group, detailedAssemblyCategoryGroup); + mocks.VerifyAll(); + } + } + + [Test] + public void DetailedAssemblyCategoryGroup_AssemblyThrowsException_ThrowsAssemblyException() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + FailureMechanismSectionAssemblyCategoryGroup detailedAssemblyCategoryGroup; + TestDelegate test = () => detailedAssemblyCategoryGroup = row.DetailedAssemblyCategoryGroup; + + // Assert + Assert.Throws(test); + mocks.VerifyAll(); + } + } + + [Test] + public void TailorMadeAssemblyCategoryGroup_AssemblyRan_ReturnCategoryGroup() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + + // Call + FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup = row.TailorMadeAssemblyCategoryGroup; + + // Assert + FailureMechanismSectionAssembly calculatorOutput = calculator.TailorMadeAssessmentAssemblyOutput; + Assert.AreEqual(calculatorOutput.Group, tailorMadeAssemblyCategoryGroup); + mocks.VerifyAll(); + } + } + + [Test] + public void TailorMadeAssemblyCategoryGroup_AssemblyThrowsException_ThrowsAssemblyException() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new MacroStabilityOutwardsFailureMechanismSectionResult(section); + var row = new MacroStabilityOutwardsSectionResultRow(result, failureMechanism, assessmentSection); + + using (new AssemblyToolCalculatorFactoryConfig()) + { + var calculatorfactory = (TestAssemblyToolCalculatorFactory) AssemblyToolCalculatorFactory.Instance; + FailureMechanismSectionAssemblyCalculatorStub calculator = calculatorfactory.LastCreatedFailureMechanismSectionAssemblyCalculator; + calculator.ThrowExceptionOnCalculate = true; + + // Call + FailureMechanismSectionAssemblyCategoryGroup tailorMadeAssemblyCategoryGroup; + TestDelegate test = () => tailorMadeAssemblyCategoryGroup = row.TailorMadeAssemblyCategoryGroup; + + // Assert + Assert.Throws(test); + mocks.VerifyAll(); + } + } + + #endregion } } \ No newline at end of file