Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs =================================================================== diff -u -r773fa9dbb96e3e391ee0abff808550fc2e70d7d0 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision 773fa9dbb96e3e391ee0abff808550fc2e70d7d0) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismResultView.cs (.../ClosingStructuresFailureMechanismResultView.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -27,7 +27,6 @@ using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; @@ -112,16 +111,16 @@ { base.AddDataGridColumns(); - EnumDisplayWrapper[] layerOneDataSource = - Enum.GetValues(typeof(AssessmentLayerOneState)) - .OfType() - .Select(sa => new EnumDisplayWrapper(sa)) + EnumDisplayWrapper[] simpleAssessmentResultDataSource = + Enum.GetValues(typeof(SimpleAssessmentResultType)) + .OfType() + .Select(sa => new EnumDisplayWrapper(sa)) .ToArray(); DataGridViewControl.AddComboBoxColumn( - nameof(ClosingStructuresFailureMechanismSectionResultRow.AssessmentLayerOne), + nameof(ClosingStructuresFailureMechanismSectionResultRow.SimpleAssessmentResult), RingtoetsCommonFormsResources.FailureMechanismResultView_SimpleAssessmentResult_ColumnHeader, - layerOneDataSource, + simpleAssessmentResultDataSource, nameof(EnumDisplayWrapper.Value), nameof(EnumDisplayWrapper.DisplayName)); @@ -133,17 +132,13 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessment_ColumnHeader); } - private bool HasPassedSimpleAssessment(int rowIndex) - { - return (AssessmentLayerOneState) DataGridViewControl.GetCell(rowIndex, SimpleAssessmentColumnIndex).Value - == AssessmentLayerOneState.Sufficient; - } - private void OnCellFormatting(object sender, DataGridViewCellFormattingEventArgs eventArgs) { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) { - if (HasPassedSimpleAssessment(eventArgs.RowIndex)) + var simpleAssessmentResult = (SimpleAssessmentResultType) DataGridViewControl.GetCell(eventArgs.RowIndex, + SimpleAssessmentColumnIndex).Value; + if (FailureMechanismResultViewHelper.HasPassedSimpleAssessment(simpleAssessmentResult)) { DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); } @@ -166,7 +161,7 @@ StructuresCalculation normativeCalculation = resultRow.GetSectionResultCalculation(); FailureMechanismSectionResultRowHelper.SetDetailedAssessmentError(currentDataGridViewCell, - resultRow.AssessmentLayerOne, + resultRow.SimpleAssessmentResult, resultRow.DetailedAssessmentProbability, normativeCalculation); } Index: Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r773fa9dbb96e3e391ee0abff808550fc2e70d7d0 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRow.cs (.../ClosingStructuresFailureMechanismSectionResultRow.cs) (revision 773fa9dbb96e3e391ee0abff808550fc2e70d7d0) +++ Ringtoets/ClosingStructures/src/Ringtoets.ClosingStructures.Forms/Views/ClosingStructuresFailureMechanismSectionResultRow.cs (.../ClosingStructuresFailureMechanismSectionResultRow.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -23,10 +23,10 @@ using System.ComponentModel; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; namespace Ringtoets.ClosingStructures.Forms.Views { @@ -66,17 +66,17 @@ } /// - /// Gets or sets the value representing whether the section passed the layer 1 assessment. + /// Gets or sets the value representing the simple assessment result. /// - public AssessmentLayerOneState AssessmentLayerOne + public SimpleAssessmentResultType SimpleAssessmentResult { get { - return SectionResult.AssessmentLayerOne; + return SectionResult.SimpleAssessmentResult; } set { - SectionResult.AssessmentLayerOne = value; + SectionResult.SimpleAssessmentResult = value; SectionResult.NotifyObservers(); } } Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj =================================================================== diff -u -r7ec3c942280c558bf69d4b92a3610fcdbf29899c -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision 7ec3c942280c558bf69d4b92a3610fcdbf29899c) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Ringtoets.ClosingStructures.Forms.Test.csproj (.../Ringtoets.ClosingStructures.Forms.Test.csproj) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -81,6 +81,10 @@ {4D840673-3812-4338-A352-84854E32B8A0} Ringtoets.Common.Forms + + {78AA56F5-431D-465C-AC50-3173D7E90AC1} + Ringtoets.Common.Primitives + {4843D6E5-066F-4795-94F5-1D53932DD03C} Ringtoets.Common.Data.TestUtil Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -r773fa9dbb96e3e391ee0abff808550fc2e70d7d0 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision 773fa9dbb96e3e391ee0abff808550fc2e70d7d0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismResultViewTest.cs (.../ClosingStructuresFailureMechanismResultViewTest.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -39,6 +39,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; namespace Ringtoets.ClosingStructures.Forms.Test.Views { @@ -115,34 +116,35 @@ DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(AssessmentLayerOneState.NotAssessed, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(SimpleAssessmentResultType.None, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(AssessmentLayerOneState.NotAssessed, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(SimpleAssessmentResultType.None, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } [Test] [SetCulture("nl-NL")] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - [TestCase(AssessmentLayerOneState.Sufficient)] - public void FailureMechanismResultsView_ChangeAssessmentLayerOneState_DataGridViewCorrectlySyncedAndStylingSet( - AssessmentLayerOneState assessmentLayerOneState) + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] + [TestCase(SimpleAssessmentResultType.NotApplicable)] + [TestCase(SimpleAssessmentResultType.ProbabilityNegligible)] + public void FailureMechanismResultsView_ChangeSimpleAssessmentResult_DataGridViewCorrectlySyncedAndStylingSet( + SimpleAssessmentResultType simpleAssessmentResult) { // Setup using (CreateConfiguredFailureMechanismResultsView(new ClosingStructuresFailureMechanism())) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; // Call - dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = assessmentLayerOneState; + dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = simpleAssessmentResult; // Assert DataGridViewRowCollection rows = dataGridView.Rows; @@ -154,12 +156,13 @@ DataGridViewCell cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; DataGridViewCell dataGridViewCell = cells[assessmentLayerOneIndex]; - Assert.AreEqual(assessmentLayerOneState, dataGridViewCell.Value); + Assert.AreEqual(simpleAssessmentResult, dataGridViewCell.Value); Assert.AreEqual("-", cellDetailedAssessment.FormattedValue); Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); Assert.IsEmpty(dataGridViewCell.ErrorText); - if (assessmentLayerOneState == AssessmentLayerOneState.Sufficient) + if (simpleAssessmentResult == SimpleAssessmentResultType.NotApplicable + || simpleAssessmentResult == SimpleAssessmentResultType.ProbabilityNegligible) { DataGridViewTestHelper.AssertCellIsDisabled(cellDetailedAssessment); DataGridViewTestHelper.AssertCellIsDisabled(cellAssessmentLayerThree); @@ -217,41 +220,51 @@ { new Point2D(0, 0) }); + var section4 = new FailureMechanismSection("Section 4", new[] + { + new Point2D(0, 0) + }); var random = new Random(21); var result1 = new ClosingStructuresFailureMechanismSectionResult(section1) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, AssessmentLayerThree = random.NextRoundedDouble() }; var result2 = new ClosingStructuresFailureMechanismSectionResult(section2) { - AssessmentLayerOne = AssessmentLayerOneState.NotAssessed, + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, AssessmentLayerThree = random.NextRoundedDouble() }; var result3 = new ClosingStructuresFailureMechanismSectionResult(section3) { - AssessmentLayerOne = AssessmentLayerOneState.NoVerdict, + SimpleAssessmentResult = SimpleAssessmentResultType.None, AssessmentLayerThree = random.NextRoundedDouble() }; + var result4 = new ClosingStructuresFailureMechanismSectionResult(section4) + { + SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, + AssessmentLayerThree = random.NextRoundedDouble() + }; // Call using (ShowFailureMechanismResultsView(new ObservableList { result1, result2, - result3 + result3, + result4 })) { // Assert var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; DataGridViewRowCollection rows = dataGridView.Rows; - Assert.AreEqual(3, rows.Count); + Assert.AreEqual(4, rows.Count); DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result1.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(result1.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(result1.AssessmentLayerThree), @@ -263,9 +276,10 @@ cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result2.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(result2.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); - Assert.AreEqual(ProbabilityFormattingHelper.Format(result2.AssessmentLayerThree), + Assert.AreEqual(ProbabilityFormattingHelper.Format(result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); DataGridViewTestHelper.AssertCellIsEnabled(cells[detailedAssessmentIndex], true); @@ -274,21 +288,32 @@ cells = rows[2].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 3", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(result3.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(result3.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(result3.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); DataGridViewTestHelper.AssertCellIsEnabled(cells[detailedAssessmentIndex], true); DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); + + cells = rows[3].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("Section 4", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual(result4.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(ProbabilityFormattingHelper.Format(result4.AssessmentLayerThree), + cells[assessmentLayerThreeIndex].FormattedValue); + + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerTwoAIndex], true); + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); } } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed, TestName = "FormWithFailureMechanismResultView_SectionPassesLevel0AndListenersNotified_RowsForSectionDisabled(notAssessed)")] - [TestCase(AssessmentLayerOneState.NoVerdict, TestName = "FormWithFailureMechanismResultView_SectionPassesLevel0AndListenersNotified_RowsForSectionDisabled(noVerdict)")] - public void GivenFormWithFailureMechanismResultView_WhenSectionPassesLevel0AndListenersNotified_ThenRowsForSectionDisabled( - AssessmentLayerOneState assessmentLayerOneState) + [TestCase(SimpleAssessmentResultType.None, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_RowsForSectionDisabled(None)")] + [TestCase(SimpleAssessmentResultType.AssessFurther, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_RowsForSectionDisabled(AssessFurther)")] + public void GivenFormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_ThenRowsForSectionDisabled( + SimpleAssessmentResultType simpleAssessmentResult) { // Given var section = new FailureMechanismSection("Section 1", new[] @@ -298,7 +323,7 @@ var random = new Random(21); var result = new ClosingStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = assessmentLayerOneState, + SimpleAssessmentResult = simpleAssessmentResult, AssessmentLayerThree = random.NextRoundedDouble() }; @@ -308,7 +333,7 @@ })) { // When - result.AssessmentLayerOne = AssessmentLayerOneState.Sufficient; + result.SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable; result.NotifyObservers(); // Then @@ -325,14 +350,54 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) + [TestCase(SimpleAssessmentResultType.None, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_RowsForSectionDisabled(None)")] + [TestCase(SimpleAssessmentResultType.AssessFurther, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_RowsForSectionDisabled(AssessFurther)")] + public void GivenFormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_ThenRowsForSectionDisabled( + SimpleAssessmentResultType simpleAssessmentResult) { // Given + var section = new FailureMechanismSection("Section 1", new[] + { + new Point2D(0, 0) + }); + var random = new Random(21); + var result = new ClosingStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = simpleAssessmentResult, + AssessmentLayerThree = random.NextRoundedDouble() + }; + + using (ShowFailureMechanismResultsView(new ObservableList + { + result + })) + { + // When + result.SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible; + result.NotifyObservers(); + + // Then + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + DataGridViewRowCollection rows = dataGridView.Rows; + Assert.AreEqual(1, rows.Count); + + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(4, cells.Count); + + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); + } + } + + [Test] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] + public void GivenSectionResultWithoutCalculation_ThenLayerTwoAErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) + { + // Given var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( @@ -356,16 +421,16 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] public void GivenSectionResultAndCalculationNotCalculated_ThenDetailedAssessmentErrorTooltip( - AssessmentLayerOneState assessmentLayerOneState) + SimpleAssessmentResultType simpleAssessmentResult) { // Given var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) { Calculation = new StructuresCalculation(), - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView(new ObservableList @@ -388,9 +453,9 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] + public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(SimpleAssessmentResultType simpleAssessmentResult) { // Given var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) @@ -399,7 +464,7 @@ { Output = new TestStructuresOutput(double.NaN) }, - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( @@ -423,9 +488,9 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(AssessmentLayerOneState assessmentLayerOneState) + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] + public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(SimpleAssessmentResultType simpleAssessmentResult) { // Given var sectionResult = new ClosingStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) @@ -434,7 +499,7 @@ { Output = new TestStructuresOutput(0.56789) }, - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView(new ObservableList @@ -588,46 +653,70 @@ } } - private static IEnumerable AssessmentLayerOneStateIsSufficientVariousSections() + private static IEnumerable GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage() { FailureMechanismSection section = CreateSimpleFailureMechanismSection(); yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient - }, "-").SetName("SectionWithoutCalculation"); + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible + }, "-").SetName("SectionWithoutCalculationAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation() - }, "-").SetName("SectionWithCalculationNoOutput"); + }, "-").SetName("SectionWithCalculationNoOutputAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation { Output = new TestStructuresOutput(double.NaN) } - }, "-").SetName("SectionWithInvalidCalculationOutput"); + }, "-").SetName("SectionWithInvalidCalculationOutputAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation { Output = new TestStructuresOutput(0.56789) } - }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutput"); + }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultProbabilityNegligible"); + + yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable + }, "-").SetName("SectionWithoutCalculationAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation() + }, "-").SetName("SectionWithCalculationNoOutputAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation + { + Output = new TestStructuresOutput(double.NaN) + } + }, "-").SetName("SectionWithInvalidCalculationOutputAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new ClosingStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation + { + Output = new TestStructuresOutput(0.56789) + } + }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultNotApplicable"); } private static FailureMechanismSection CreateSimpleFailureMechanismSection() { - var section = new FailureMechanismSection("A", - new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - return section; + return FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }); } private ClosingStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView( Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r773fa9dbb96e3e391ee0abff808550fc2e70d7d0 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision 773fa9dbb96e3e391ee0abff808550fc2e70d7d0) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/Views/ClosingStructuresFailureMechanismSectionResultRowTest.cs (.../ClosingStructuresFailureMechanismSectionResultRowTest.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -33,6 +33,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; namespace Ringtoets.ClosingStructures.Forms.Test.Views { @@ -57,8 +58,13 @@ // Assert Assert.IsInstanceOf>(row); +<<<<<<< HEAD Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability); +======= + Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); + Assert.AreEqual(result.GetAssessmentLayerTwoA(failureMechanism, assessmentSection), row.AssessmentLayerTwoA); +>>>>>>> Implemented SimpleAssessmentResult type for Closing and Height structures: Assert.AreEqual(row.AssessmentLayerThree, result.AssessmentLayerThree); TestHelper.AssertTypeConverter( @@ -104,10 +110,7 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.Sufficient)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - public void AssessmentLayerOne_AlwaysOnChange_NotifyObserversOfResultAndResultPropertyChanged(AssessmentLayerOneState newValue) + public void SimpleAssessmentResult_AlwaysOnChange_NotifyObserversOfResultAndResultPropertyChanged() { // Setup var mocks = new MockRepository(); @@ -120,15 +123,16 @@ var result = new ClosingStructuresFailureMechanismSectionResult(section); result.Attach(observer); + var newValue = new Random(21).NextEnumValue(); var row = new ClosingStructuresFailureMechanismSectionResultRow(result, new ClosingStructuresFailureMechanism(), assessmentSection); // Call - row.AssessmentLayerOne = newValue; + row.SimpleAssessmentResult = newValue; // Assert - Assert.AreEqual(newValue, result.AssessmentLayerOne); + Assert.AreEqual(newValue, result.SimpleAssessmentResult); mocks.VerifyAll(); } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs =================================================================== diff -u -rda4b190b12b76e2fcba0e0cbbba60acab2eb0203 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision da4b190b12b76e2fcba0e0cbbba60acab2eb0203) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/FailureMechanismSectionResultRowHelper.cs (.../FailureMechanismSectionResultRowHelper.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -22,7 +22,6 @@ using System; using System.Windows.Forms; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.Properties; using Ringtoets.Common.Forms.Views; using Ringtoets.Common.Primitives; @@ -38,13 +37,13 @@ /// Sets the when the detailed assessment fails. /// /// The current data grid view cell. - /// The value representing whether the section passed the simple assessment. + /// The value representing the simple assessment result type. /// The value representing the result of the detailed assessment. /// The set for the /// section result. May be null if the section result does not have a calculation set. /// Thrown when is null. public static void SetDetailedAssessmentError(DataGridViewCell dataGridViewCell, - AssessmentLayerOneState passedAssessmentLayerOne, + SimpleAssessmentResultType simpleAssessmentResult, double detailedAssessmentProbability, ICalculation normativeCalculation) { @@ -53,7 +52,8 @@ throw new ArgumentNullException(nameof(dataGridViewCell)); } - if (passedAssessmentLayerOne == AssessmentLayerOneState.Sufficient) + if (simpleAssessmentResult == SimpleAssessmentResultType.NotApplicable + || simpleAssessmentResult == SimpleAssessmentResultType.ProbabilityNegligible) { dataGridViewCell.ErrorText = string.Empty; return; @@ -66,13 +66,13 @@ /// Sets the when the detailed assessment fails. /// /// The current data grid view cell. - /// The value representing whether the simple assessment result. + /// The value representing the simple assessment result. /// The value representing the probability of the detailed assessment. /// The set for the /// section result. May be null if the section result does not have a calculation set. /// Thrown when is null. public static void SetDetailedAssessmentError(DataGridViewCell dataGridViewCell, - SimpleAssessmentResultValidityOnlyType simpleAssessmentResult, + SimpleAssessmentResultValidityOnlyType simpleAssessmentResult, double detailedAssessmentProbability, ICalculation normativeCalculation) { Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs =================================================================== diff -u -rda4b190b12b76e2fcba0e0cbbba60acab2eb0203 -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision da4b190b12b76e2fcba0e0cbbba60acab2eb0203) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -21,11 +21,11 @@ using System; using System.Collections; +using System.Collections.Generic; using System.Windows.Forms; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.Calculation; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Primitives; @@ -45,7 +45,7 @@ // Call TestDelegate call = () => FailureMechanismSectionResultRowHelper.SetDetailedAssessmentError(null, - AssessmentLayerOneState.Sufficient, + SimpleAssessmentResultType.NotApplicable, 0.0, calculation); @@ -56,12 +56,13 @@ } [Test] - [TestCaseSource(nameof(AssessmentLayerOneStateIsSufficient))] - [TestCaseSource(nameof(AssessmentLayerOneStateIsNotSufficientAndCalculationNull))] - [TestCaseSource(nameof(AssessmentLayerOneStateIsNotSufficientAndCalculationWithoutOutput))] - [TestCaseSource(nameof(AssessmentLayerOneStateIsNotSufficientAndCalculationWithOutput))] + [TestCaseSource(nameof(GetSimpleAssessmentResultNotApplicableConfigurations))] + [TestCaseSource(nameof(GetSimpleAssessmentResultProbabilityNegligibleConfigurations))] + [TestCaseSource(nameof(GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationNullConfigurations))] + [TestCaseSource(nameof(GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationWithoutOutputConfigurations))] + [TestCaseSource(nameof(GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationWithOutputConfigurations))] public void SetDetailedAssessmentError_WithAssessmentLayerOne_SetsErrorText(DataGridViewCell dataGridViewCell, - AssessmentLayerOneState passedAssessmentLayerOne, + SimpleAssessmentResultType passedAssessmentLayerOne, double detailedAssessmentProbability, ICalculation normativeCalculation, string expectedErrorText) @@ -121,44 +122,51 @@ #region Test cases assessment layer one - private static IEnumerable AssessmentLayerOneStateIsSufficient() + private static IEnumerable GetSimpleAssessmentResultNotApplicableConfigurations() { var dataGridViewCell = new TestDataGridViewCell { ErrorText = "Default text" }; + string expectedErrorMessage = string.Empty; yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, double.NaN, null, string.Empty) .SetName("SufficientWithInvalidDetailedAssessmentAndNoCalculation"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, 0.0, null, string.Empty) .SetName("SufficientWithValidDetailedAssessmentAndNoCalculation"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, double.NaN, + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.NotApplicable, double.NaN, null, expectedErrorMessage) + .SetName("NotApplicableWithInvalidLayerTwoAAndNoCalculation"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.NotApplicable, 0.0, null, expectedErrorMessage) + .SetName("NotApplicableWithValidLayerTwoAAndNoCalculation"); + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.NotApplicable, double.NaN, CalculationTestDataFactory.CreateCalculationWithOutput(), - string.Empty) + expectedErrorMessage) .SetName("SufficientWithInvalidDetailedAssessmentAndCalculationWithOutput"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, 0.0, CalculationTestDataFactory.CreateCalculationWithOutput(), - string.Empty) + expectedErrorMessage) .SetName("SufficientWithValidDetailedAssessmentAndCalculationWithOutput"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, double.NaN, + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.NotApplicable, double.NaN, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - string.Empty) + expectedErrorMessage) .SetName("SufficientWithInvalidDetailedAssessmentAndCalculationWithoutOutput"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, 0.0, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - string.Empty) + expectedErrorMessage) .SetName("SufficientWithValidDetailedAssessmentAndCalculationWithoutOutput"); } - private static IEnumerable AssessmentLayerOneStateIsNotSufficientAndCalculationNull() + private static IEnumerable GetSimpleAssessmentResultProbabilityNegligibleConfigurations() { var dataGridViewCell = new TestDataGridViewCell { ErrorText = "Default text" }; + string expectedErrorMessage = string.Empty; yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, double.NaN, null, "Er moet een maatgevende berekening voor dit vak worden geselecteerd.") .SetName("NotAssessedWithInvalidDetailedAssessmentAndNoCalculation"); @@ -167,62 +175,108 @@ .SetName("NotAssessedWithValidDetailedAssessmentAndNoCalculation"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, double.NaN, null, - "Er moet een maatgevende berekening voor dit vak worden geselecteerd.") - .SetName("NeedsDetailedAssessmentWithInvalidDetailedAssessmentAndNoCalculation"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, 0.0, null, - "Er moet een maatgevende berekening voor dit vak worden geselecteerd.") - .SetName("NeedsDetailedAssessmentWithValidDetailedAssessmentAndNoCalculation"); + .SetName("ProbabilityNegligibleWithInvalidLayerTwoAAndNoCalculation"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.ProbabilityNegligible, 0.0, null, expectedErrorMessage) + .SetName("ProbabilityNegligibleWithValidLayerTwoAAndNoCalculation"); + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.ProbabilityNegligible, double.NaN, + CalculationTestDataFactory.CreateCalculationWithOutput(), + expectedErrorMessage) + .SetName("ProbabilityNegligibleWithInvalidLayerTwoAAndCalculationWithOutput"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.ProbabilityNegligible, 0.0, + CalculationTestDataFactory.CreateCalculationWithOutput(), + expectedErrorMessage) + .SetName("ProbabilityNegligibleWithValidLayerTwoAAndCalculationWithOutput"); + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.ProbabilityNegligible, double.NaN, + CalculationTestDataFactory.CreateCalculationWithoutOutput(), + expectedErrorMessage) + .SetName("ProbabilityNegligibleWithInvalidLayerTwoAAndCalculationWithoutOutput"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.ProbabilityNegligible, 0.0, + CalculationTestDataFactory.CreateCalculationWithoutOutput(), + expectedErrorMessage) + .SetName("ProbabilityNegligibleWithValidLayerTwoAAndCalculationWithoutOutput"); } - private static IEnumerable AssessmentLayerOneStateIsNotSufficientAndCalculationWithoutOutput() + private static IEnumerable GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationNullConfigurations() { var dataGridViewCell = new TestDataGridViewCell { ErrorText = "Default text" }; - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, double.NaN, + const string expectedErrorMessage = "Er moet een maatgevende berekening voor dit vak worden geselecteerd."; + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.AssessFurther, double.NaN, null, + expectedErrorMessage) + .SetName("AssessFurtherWithInvalidLayerTwoAAndNoCalculation"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.AssessFurther, 0.0, null, + expectedErrorMessage) + .SetName("AssessFurtherWithValidLayerTwoAAndNoCalculation"); + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.None, double.NaN, null, + expectedErrorMessage) + .SetName("NoneWithInvalidLayerTwoAAndNoCalculation"); + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.None, 0.0, null, + expectedErrorMessage) + .SetName("NoneWithValidLayerTwoAAndNoCalculation"); + } + + private static IEnumerable GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationWithoutOutputConfigurations() + { + var dataGridViewCell = new TestDataGridViewCell + { + ErrorText = "Default text" + }; + + const string expectedErrorMessage = "De maatgevende berekening voor dit vak moet nog worden uitgevoerd."; + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.AssessFurther, double.NaN, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - "De maatgevende berekening voor dit vak moet nog worden uitgevoerd.") + expectedErrorMessage) .SetName("NotAssessedWithInvalidDetailedAssessmentAndCalculationWithoutOutput"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - "De maatgevende berekening voor dit vak moet nog worden uitgevoerd.") + expectedErrorMessage) .SetName("NotAssessedWithValidDetailedAssessmentAndCalculationWithoutOutput"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, double.NaN, + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.None, double.NaN, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - "De maatgevende berekening voor dit vak moet nog worden uitgevoerd.") + expectedErrorMessage) .SetName("NeedsDetailedAssessmentWithInvalidDetailedAssessmentAndCalculationWithoutOutput"); yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, 0.0, CalculationTestDataFactory.CreateCalculationWithoutOutput(), - "De maatgevende berekening voor dit vak moet nog worden uitgevoerd.") + expectedErrorMessage) .SetName("NeedsDetailedAssessmentValidDetailedAssessmentAndCalculationWithoutOutput"); } - private static IEnumerable AssessmentLayerOneStateIsNotSufficientAndCalculationWithOutput() + private static IEnumerable GetSimpleAssessmentResultAssessFurtherOrNoneAndCalculationWithOutputConfigurations() { var dataGridViewCell = new TestDataGridViewCell { ErrorText = "Default text" }; - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, double.NaN, + const string expectedErrorMessage = "De maatgevende berekening voor dit vak moet een geldige uitkomst hebben."; + string emptyErrorMessage = string.Empty; + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.AssessFurther, double.NaN, CalculationTestDataFactory.CreateCalculationWithOutput(), - "De maatgevende berekening voor dit vak moet een geldige uitkomst hebben.") + expectedErrorMessage) .SetName("NotAssessedWithInvalidDetailedAssessmentAndCalculationWithOutput"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0, + + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.AssessFurther, 0.0, CalculationTestDataFactory.CreateCalculationWithOutput(), - string.Empty) + emptyErrorMessage) .SetName("NotAssessedWithValidDetailedAssessmentAndCalculationWithOutput"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, double.NaN, + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.None, double.NaN, CalculationTestDataFactory.CreateCalculationWithOutput(), - "De maatgevende berekening voor dit vak moet een geldige uitkomst hebben.") + expectedErrorMessage) .SetName("NeedsDetailedAssessmentWithInvalidDetailedAssessmentAndCalculationWithOutput"); - yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, 0.0, + yield return new TestCaseData(dataGridViewCell, SimpleAssessmentResultType.None, 0.0, CalculationTestDataFactory.CreateCalculationWithOutput(), - string.Empty) + emptyErrorMessage) .SetName("NeedsDetailedAssessmentWithValidDetailedAssessmentAndCalculationWithOutput"); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs =================================================================== diff -u -r91b6773de2fccf52417609b4ed9463f98d6451dd -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision 91b6773de2fccf52417609b4ed9463f98d6451dd) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismResultView.cs (.../HeightStructuresFailureMechanismResultView.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -116,14 +116,14 @@ { base.AddDataGridColumns(); - EnumDisplayWrapper[] layerOneDataSource = - Enum.GetValues(typeof(AssessmentLayerOneState)) - .OfType() - .Select(sa => new EnumDisplayWrapper(sa)) + EnumDisplayWrapper[] layerOneDataSource = + Enum.GetValues(typeof(SimpleAssessmentResultType)) + .OfType() + .Select(sa => new EnumDisplayWrapper(sa)) .ToArray(); DataGridViewControl.AddComboBoxColumn( - nameof(HeightStructuresFailureMechanismSectionResultRow.AssessmentLayerOne), + nameof(HeightStructuresFailureMechanismSectionResultRow.SimpleAssessmentResult), RingtoetsCommonFormsResources.FailureMechanismResultView_SimpleAssessmentResult_ColumnHeader, layerOneDataSource, nameof(EnumDisplayWrapper.Value), @@ -148,7 +148,9 @@ { if (eventArgs.ColumnIndex > SimpleAssessmentColumnIndex) { - if (HasPassedSimpleAssessment(eventArgs.RowIndex)) + var simpleAssessmentResult = (SimpleAssessmentResultType) DataGridViewControl.GetCell(eventArgs.RowIndex, + SimpleAssessmentColumnIndex).Value; + if (FailureMechanismResultViewHelper.HasPassedSimpleAssessment(simpleAssessmentResult)) { DataGridViewControl.DisableCell(eventArgs.RowIndex, eventArgs.ColumnIndex); } @@ -171,7 +173,7 @@ StructuresCalculation normativeCalculation = resultRow.GetSectionResultCalculation(); FailureMechanismSectionResultRowHelper.SetDetailedAssessmentError(currentDataGridViewCell, - resultRow.AssessmentLayerOne, + resultRow.SimpleAssessmentResult, resultRow.DetailedAssessmentProbability, normativeCalculation); } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r91b6773de2fccf52417609b4ed9463f98d6451dd -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision 91b6773de2fccf52417609b4ed9463f98d6451dd) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Views/HeightStructuresFailureMechanismSectionResultRow.cs (.../HeightStructuresFailureMechanismSectionResultRow.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -22,10 +22,10 @@ using System; using System.ComponentModel; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Structures; using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; using Ringtoets.HeightStructures.Data; namespace Ringtoets.HeightStructures.Forms.Views @@ -65,17 +65,17 @@ } /// - /// Gets or sets the value representing whether the section passed the layer 1 assessment. + /// Gets or sets the value representing the simple assessment result. /// - public AssessmentLayerOneState AssessmentLayerOne + public SimpleAssessmentResultType SimpleAssessmentResult { get { - return SectionResult.AssessmentLayerOne; + return SectionResult.SimpleAssessmentResult; } set { - SectionResult.AssessmentLayerOne = value; + SectionResult.SimpleAssessmentResult = value; SectionResult.NotifyObservers(); } } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -r7ec3c942280c558bf69d4b92a3610fcdbf29899c -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision 7ec3c942280c558bf69d4b92a3610fcdbf29899c) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -81,6 +81,10 @@ {4d840673-3812-4338-a352-84854e32b8a0} Ringtoets.Common.Forms + + {78AA56F5-431D-465C-AC50-3173D7E90AC1} + Ringtoets.Common.Primitives + {4843D6E5-066F-4795-94F5-1D53932DD03C} Ringtoets.Common.Data.TestUtil Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -r91b6773de2fccf52417609b4ed9463f98d6451dd -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision 91b6773de2fccf52417609b4ed9463f98d6451dd) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismResultViewTest.cs (.../HeightStructuresFailureMechanismResultViewTest.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -37,6 +37,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.Helpers; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.Views; @@ -140,33 +141,34 @@ DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(AssessmentLayerOneState.NotAssessed, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(SimpleAssessmentResultType.None, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); - Assert.AreEqual(AssessmentLayerOneState.NotAssessed, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(SimpleAssessmentResultType.None, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - [TestCase(AssessmentLayerOneState.Sufficient)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] + [TestCase(SimpleAssessmentResultType.NotApplicable)] + [TestCase(SimpleAssessmentResultType.ProbabilityNegligible)] public void FailureMechanismResultsView_ChangeAssessmentLayerOneState_DataGridViewCorrectlySyncedAndStylingSet( - AssessmentLayerOneState assessmentLayerOneState) + SimpleAssessmentResultType simpleAssessmentResult) { // Setup using (CreateConfiguredFailureMechanismResultsView(new HeightStructuresFailureMechanism())) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; // Call - dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = assessmentLayerOneState; + dataGridView.Rows[0].Cells[assessmentLayerOneIndex].Value = simpleAssessmentResult; // Assert DataGridViewRowCollection rows = dataGridView.Rows; @@ -178,12 +180,13 @@ DataGridViewCell cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; DataGridViewCell dataGridViewCell = cells[assessmentLayerOneIndex]; - Assert.AreEqual(assessmentLayerOneState, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual(simpleAssessmentResult, cells[assessmentLayerOneIndex].Value); Assert.AreEqual("-", detailedAssessmentCell.FormattedValue); Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); Assert.IsEmpty(dataGridViewCell.ErrorText); - if (assessmentLayerOneState == AssessmentLayerOneState.Sufficient) + if (simpleAssessmentResult == SimpleAssessmentResultType.NotApplicable + || simpleAssessmentResult == SimpleAssessmentResultType.ProbabilityNegligible) { DataGridViewTestHelper.AssertCellIsDisabled(detailedAssessmentCell); DataGridViewTestHelper.AssertCellIsDisabled(cellAssessmentLayerThree); @@ -201,6 +204,191 @@ } [Test] + public void FailureMechanismResultView_WithHeightStructuresFailureMechanismSectionResultAssigned_SectionsAddedAsRows() + { + // Setup + var section1 = new FailureMechanismSection("Section 1", new[] + { + new Point2D(0, 0) + }); + var section2 = new FailureMechanismSection("Section 2", new[] + { + new Point2D(0, 0) + }); + var section3 = new FailureMechanismSection("Section 3", new[] + { + new Point2D(0, 0) + }); + var section4 = new FailureMechanismSection("Section 4", new[] + { + new Point2D(0, 0) + }); + + var random = new Random(21); + var result1 = new HeightStructuresFailureMechanismSectionResult(section1) + { + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, + AssessmentLayerThree = random.NextRoundedDouble() + }; + var result2 = new HeightStructuresFailureMechanismSectionResult(section2) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + AssessmentLayerThree = random.NextRoundedDouble() + }; + var result3 = new HeightStructuresFailureMechanismSectionResult(section3) + { + SimpleAssessmentResult = SimpleAssessmentResultType.None, + AssessmentLayerThree = random.NextRoundedDouble() + }; + var result4 = new HeightStructuresFailureMechanismSectionResult(section4) + { + SimpleAssessmentResult = SimpleAssessmentResultType.AssessFurther, + AssessmentLayerThree = random.NextRoundedDouble() + }; + + // Call + using (ShowFailureMechanismResultsView(new ObservableList + { + result1, + result2, + result3, + result4 + })) + { + // Assert + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + DataGridViewRowCollection rows = dataGridView.Rows; + Assert.AreEqual(4, rows.Count); + + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual(result1.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(ProbabilityFormattingHelper.Format(result1.AssessmentLayerThree), + cells[assessmentLayerThreeIndex].FormattedValue); + + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); + + cells = rows[1].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual(result2.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(ProbabilityFormattingHelper.Format(result1.AssessmentLayerThree), + cells[assessmentLayerThreeIndex].FormattedValue); + + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); + + cells = rows[2].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("Section 3", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual(result3.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(ProbabilityFormattingHelper.Format(result3.AssessmentLayerThree), + cells[assessmentLayerThreeIndex].FormattedValue); + + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerTwoAIndex], true); + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); + + cells = rows[3].Cells; + Assert.AreEqual(4, cells.Count); + Assert.AreEqual("Section 4", cells[nameColumnIndex].FormattedValue); + Assert.AreEqual(result4.SimpleAssessmentResult, cells[assessmentLayerOneIndex].Value); + Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual(ProbabilityFormattingHelper.Format(result4.AssessmentLayerThree), + cells[assessmentLayerThreeIndex].FormattedValue); + + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerTwoAIndex], true); + DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); + } + } + + [Test] + [TestCase(SimpleAssessmentResultType.None, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_RowsForSectionDisabled(None)")] + [TestCase(SimpleAssessmentResultType.AssessFurther, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_RowsForSectionDisabled(AssessFurther)")] + public void GivenFormWithFailureMechanismResultView_WhenSectionBecomesNotApplicableAndListenersNotified_ThenRowsForSectionDisabled( + SimpleAssessmentResultType simpleAssessmentResult) + { + // Given + var section = new FailureMechanismSection("Section 1", new[] + { + new Point2D(0, 0) + }); + var random = new Random(21); + var result = new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = simpleAssessmentResult, + AssessmentLayerThree = random.NextRoundedDouble() + }; + + using (ShowFailureMechanismResultsView(new ObservableList + { + result + })) + { + // When + result.SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable; + result.NotifyObservers(); + + // Then + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + DataGridViewRowCollection rows = dataGridView.Rows; + Assert.AreEqual(1, rows.Count); + + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(4, cells.Count); + + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); + } + } + + [Test] + [TestCase(SimpleAssessmentResultType.None, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_RowsForSectionDisabled(None)")] + [TestCase(SimpleAssessmentResultType.AssessFurther, TestName = "FormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_RowsForSectionDisabled(AssessFurther)")] + public void GivenFormWithFailureMechanismResultView_WhenSectionBecomesProbabilityNegligibleAndListenersNotified_ThenRowsForSectionDisabled( + SimpleAssessmentResultType simpleAssessmentResult) + { + // Given + var section = new FailureMechanismSection("Section 1", new[] + { + new Point2D(0, 0) + }); + var random = new Random(21); + var result = new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = simpleAssessmentResult, + AssessmentLayerThree = random.NextRoundedDouble() + }; + + using (ShowFailureMechanismResultsView(new ObservableList + { + result + })) + { + // When + result.SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable; + result.NotifyObservers(); + + // Then + var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; + DataGridViewRowCollection rows = dataGridView.Rows; + Assert.AreEqual(1, rows.Count); + + DataGridViewCellCollection cells = rows[0].Cells; + Assert.AreEqual(4, cells.Count); + + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); + } + } + + [Test] [TestCase("test", assessmentLayerThreeIndex)] [TestCase(";/[].,~!@#$%^&*()_-+={}|?", assessmentLayerThreeIndex)] public void FailureMechanismResultView_EditValueInvalid_ShowsErrorTooltip(string newValue, int cellIndex) @@ -264,14 +452,14 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) { - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( new ObservableList @@ -294,15 +482,15 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] public void GivenSectionResultAndCalculationNotCalculated_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given var sectionResult = new HeightStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) { Calculation = new StructuresCalculation(), - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( @@ -326,8 +514,8 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given @@ -339,7 +527,7 @@ var sectionResult = new HeightStructuresFailureMechanismSectionResult(section) { Calculation = calculation, - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( @@ -363,8 +551,8 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.NoVerdict)] + [TestCase(SimpleAssessmentResultType.None)] + [TestCase(SimpleAssessmentResultType.AssessFurther)] public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError(AssessmentLayerOneState assessmentLayerOneState) { // Given @@ -374,7 +562,7 @@ { Output = new TestStructuresOutput(0.56789) }, - AssessmentLayerOne = assessmentLayerOneState + SimpleAssessmentResult = simpleAssessmentResult }; using (ShowFailureMechanismResultsView( @@ -398,8 +586,8 @@ } [Test] - [TestCaseSource(nameof(AssessmentLayerOneStateIsSufficientVariousSections))] - public void GivenSectionResultAndAssessmentLayerOneStateSufficient_ThenDetailedAssessmentNoError( + [TestCaseSource(nameof(GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage))] + public void GivenVariousSectionResultAndSimpleAssessmentResultConfigurations_ThenDetailedAssessmentNoError( HeightStructuresFailureMechanismSectionResult sectionResult, string expectedValue) { // Given @@ -467,46 +655,70 @@ } } - private static IEnumerable AssessmentLayerOneStateIsSufficientVariousSections() + private static IEnumerable GetVariousSimpleAssessmentResultConfigurationsWithoutErrorMessage() { FailureMechanismSection section = CreateSimpleFailureMechanismSection(); yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient - }, "-").SetName("SectionWithoutCalculation"); + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible + }, "-").SetName("SectionWithoutCalculationAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation() - }, "-").SetName("SectionWithCalculationNoOutput"); + }, "-").SetName("SectionWithCalculationNoOutputAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation { Output = new TestStructuresOutput(double.NaN) } - }, "-").SetName("SectionWithInvalidCalculationOutput"); + }, "-").SetName("SectionWithInvalidCalculationOutputAndSimpleAssessmentResultProbabilityNegligible"); yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) { - AssessmentLayerOne = AssessmentLayerOneState.Sufficient, + SimpleAssessmentResult = SimpleAssessmentResultType.ProbabilityNegligible, Calculation = new StructuresCalculation { Output = new TestStructuresOutput(0.56789) } - }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutput"); + }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultProbabilityNegligible"); + + yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable + }, "-").SetName("SectionWithoutCalculationAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation() + }, "-").SetName("SectionWithCalculationNoOutputAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation + { + Output = new TestStructuresOutput(double.NaN) + } + }, "-").SetName("SectionWithInvalidCalculationOutputAndSimpleAssessmentResultNotApplicable"); + yield return new TestCaseData(new HeightStructuresFailureMechanismSectionResult(section) + { + SimpleAssessmentResult = SimpleAssessmentResultType.NotApplicable, + Calculation = new StructuresCalculation + { + Output = new TestStructuresOutput(0.56789) + } + }, ProbabilityFormattingHelper.Format(0.25)).SetName("SectionWithValidCalculationOutputAndSimpleAssessmentResultNotApplicable"); } private static FailureMechanismSection CreateSimpleFailureMechanismSection() { - var section = new FailureMechanismSection("A", - new[] - { - new Point2D(1, 2), - new Point2D(3, 4) - }); - return section; + return FailureMechanismSectionTestFactory.CreateFailureMechanismSection(new[] + { + new Point2D(1, 2), + new Point2D(3, 4) + }); } private HeightStructuresFailureMechanismResultView CreateConfiguredFailureMechanismResultsView(HeightStructuresFailureMechanism failureMechanism) Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r91b6773de2fccf52417609b4ed9463f98d6451dd -re5d2b62a6626e9d34433859f6dccfcf5a1eff783 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision 91b6773de2fccf52417609b4ed9463f98d6451dd) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Views/HeightStructuresFailureMechanismSectionResultRowTest.cs (.../HeightStructuresFailureMechanismSectionResultRowTest.cs) (revision e5d2b62a6626e9d34433859f6dccfcf5a1eff783) @@ -31,6 +31,7 @@ using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.TypeConverters; using Ringtoets.Common.Forms.Views; +using Ringtoets.Common.Primitives; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.Views; @@ -57,8 +58,13 @@ // Assert Assert.IsInstanceOf>(row); +<<<<<<< HEAD Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability); +======= + Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); + Assert.AreEqual(result.GetAssessmentLayerTwoA(failureMechanism, assessmentSection), row.AssessmentLayerTwoA); +>>>>>>> Implemented SimpleAssessmentResult type for Closing and Height structures: Assert.AreEqual(row.AssessmentLayerThree, result.AssessmentLayerThree); TestHelper.AssertTypeConverter( @@ -104,10 +110,7 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed)] - [TestCase(AssessmentLayerOneState.Sufficient)] - [TestCase(AssessmentLayerOneState.NoVerdict)] - public void AssessmentLayerOne_AlwaysOnChange_NotifyObserversOfResultAndResultPropertyChanged(AssessmentLayerOneState newValue) + public void SimpleAssessmentResult_AlwaysOnChange_NotifyObserversOfResultAndResultPropertyChanged() { // Setup var mocks = new MockRepository(); @@ -120,15 +123,16 @@ var result = new HeightStructuresFailureMechanismSectionResult(section); result.Attach(observer); + var newValue = new Random(21).NextEnumValue(); var row = new HeightStructuresFailureMechanismSectionResultRow(result, new HeightStructuresFailureMechanism(), assessmentSection); // Call - row.AssessmentLayerOne = newValue; + row.SimpleAssessmentResult = newValue; // Assert - Assert.AreEqual(newValue, result.AssessmentLayerOne); + Assert.AreEqual(newValue, result.SimpleAssessmentResult); mocks.VerifyAll(); }