Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Ringtoets.StabilityPointStructures.Data.csproj =================================================================== diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Ringtoets.StabilityPointStructures.Data.csproj (.../Ringtoets.StabilityPointStructures.Data.csproj) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/Ringtoets.StabilityPointStructures.Data.csproj (.../Ringtoets.StabilityPointStructures.Data.csproj) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -21,7 +21,7 @@ - + Fisheye: Tag a0a6258257c414bfebdab21480a2278aa9748c35 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensions.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensions.cs (revision 0) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Data/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensions.cs (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -0,0 +1,73 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Probability; + +namespace Ringtoets.StabilityPointStructures.Data +{ + /// + /// Extension methods for obtaining detailed assessment probabilities from output for an assessment of the + /// stability point structures failure mechanism. + /// + public static class StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensions + { + /// + /// Gets the value for the detailed assessment of safety per failure mechanism section as a probability. + /// + /// The section result to get the detailed assessment probability for. + /// The failure mechanism the calculations belong to. + /// The assessment section the calculations belong to. + /// The calculated detailed assessment probability; or when there is no + /// calculation assigned to the section result or the calculation is not performed. + /// Thrown when any parameter is null. + public static double GetDetailedAssessmentProbability(this StabilityPointStructuresFailureMechanismSectionResult sectionResult, + StabilityPointStructuresFailureMechanism failureMechanism, + IAssessmentSection assessmentSection) + { + if (sectionResult == null) + { + throw new ArgumentNullException(nameof(sectionResult)); + } + + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + if (assessmentSection == null) + { + throw new ArgumentNullException(nameof(assessmentSection)); + } + + if (sectionResult.Calculation == null || !sectionResult.Calculation.HasOutput) + { + return double.NaN; + } + + ProbabilityAssessmentOutput derivedOutput = StabilityPointStructuresProbabilityAssessmentOutputFactory.Create(sectionResult.Calculation.Output, + failureMechanism, assessmentSection); + + return derivedOutput.Probability; + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs =================================================================== diff -u -rc7425b8f799095f2dc812351e14103931c672fba -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision c7425b8f799095f2dc812351e14103931c672fba) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismResultView.cs (.../StabilityPointStructuresFailureMechanismResultView.cs) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -44,7 +44,7 @@ : FailureMechanismResultView { - private const int assessmentLayerTwoAIndex = 2; + private const int detailedAssessmentIndex = 2; private readonly IAssessmentSection assessmentSection; private readonly RecursiveObserver calculationInputObserver; private readonly RecursiveObserver calculationOutputObserver; @@ -131,7 +131,7 @@ nameof(EnumDisplayWrapper.DisplayName)); DataGridViewControl.AddTextBoxColumn( - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.AssessmentLayerTwoA), + nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability), RingtoetsCommonFormsResources.FailureMechanismResultView_DetailedAssessment_ColumnHeader); DataGridViewControl.AddTextBoxColumn( nameof(StabilityPointStructuresFailureMechanismSectionResultRow.AssessmentLayerThree), @@ -161,7 +161,7 @@ private void ShowAssessmentLayerErrors(object sender, DataGridViewCellFormattingEventArgs e) { - if (e.ColumnIndex != assessmentLayerTwoAIndex) + if (e.ColumnIndex != detailedAssessmentIndex) { return; } @@ -172,7 +172,7 @@ FailureMechanismSectionResultRowHelper.SetDetailedAssessmentError(currentDataGridViewCell, resultRow.AssessmentLayerOne, - resultRow.AssessmentLayerTwoA, + resultRow.DetailedAssessmentProbability, normativeCalculation); } } Index: Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs =================================================================== diff -u -r19ca2288de4540bb03df71fc86cca6b456e8fc37 -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision 19ca2288de4540bb03df71fc86cca6b456e8fc37) +++ Ringtoets/StabilityPointStructures/src/Ringtoets.StabilityPointStructures.Forms/Views/StabilityPointStructuresFailureMechanismSectionResultRow.cs (.../StabilityPointStructuresFailureMechanismSectionResultRow.cs) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -83,14 +83,14 @@ } /// - /// Gets the value representing the result of the layer 2a assessment. + /// Gets the value representing the detailed assessment probability. /// [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] - public double AssessmentLayerTwoA + public double DetailedAssessmentProbability { get { - return SectionResult.GetAssessmentLayerTwoA(failureMechanism, assessmentSection); + return SectionResult.GetDetailedAssessmentProbability(failureMechanism, assessmentSection); } } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/Ringtoets.StabilityPointStructures.Data.Test.csproj =================================================================== diff -u -rd7696913d8f9239cb80eb2c3bac6cc0ccf23d479 -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/Ringtoets.StabilityPointStructures.Data.Test.csproj (.../Ringtoets.StabilityPointStructures.Data.Test.csproj) (revision d7696913d8f9239cb80eb2c3bac6cc0ccf23d479) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/Ringtoets.StabilityPointStructures.Data.Test.csproj (.../Ringtoets.StabilityPointStructures.Data.Test.csproj) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -21,7 +21,7 @@ - + Fisheye: Tag a0a6258257c414bfebdab21480a2278aa9748c35 refers to a dead (removed) revision in file `Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSection2aAssessmentResultExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensionsTest.cs =================================================================== diff -u --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensionsTest.cs (revision 0) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Data.Test/StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensionsTest.cs (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -0,0 +1,161 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.StabilityPointStructures.Data.TestUtil; + +namespace Ringtoets.StabilityPointStructures.Data.Test +{ + [TestFixture] + public class StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensionsTest + { + [Test] + public void GetDetailedAssessmentProbability_SectionResultNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + // Call + TestDelegate call = () => StabilityPointStructuresFailureMechanismSectionDetailedAssessmentResultExtensions.GetDetailedAssessmentProbability( + null, + new StabilityPointStructuresFailureMechanism(), + assessmentSection); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("sectionResult", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void GetDetailedAssessmentProbability_FailureMechanismNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var failureMechanismSectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section); + + // Call + TestDelegate call = () => failureMechanismSectionResult.GetDetailedAssessmentProbability(null, assessmentSection); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("failureMechanism", exception.ParamName); + mocks.VerifyAll(); + } + + [Test] + public void GetDetailedAssessmentProbability_AssessmentSectionNull_ThrowsArgumentNullException() + { + // Setup + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var failureMechanismSectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section); + + // Call + TestDelegate call = () => failureMechanismSectionResult.GetDetailedAssessmentProbability(new StabilityPointStructuresFailureMechanism(), null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("assessmentSection", exception.ParamName); + } + + [Test] + public void GetDetailedAssessmentProbability_SectionResultWithoutCalculation_ReturnsNaN() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var failureMechanismSectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section); + + // Call + double detailedAssessmentProbability = failureMechanismSectionResult.GetDetailedAssessmentProbability(new StabilityPointStructuresFailureMechanism(), + assessmentSection); + + // Assert + Assert.IsNaN(detailedAssessmentProbability); + mocks.VerifyAll(); + } + + [Test] + public void GetDetailedAssessmentProbability_CalculationWithoutOutput_ReturnsNaN() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var failureMechanismSectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section) + { + Calculation = new TestStabilityPointStructuresCalculation() + }; + + // Call + double detailedAssessmentProbability = failureMechanismSectionResult.GetDetailedAssessmentProbability(new StabilityPointStructuresFailureMechanism(), + assessmentSection); + + // Assert + Assert.IsNaN(detailedAssessmentProbability); + mocks.VerifyAll(); + } + + [Test] + public void GetDetailedAssessmentProbability_CalculationWithOutput_ReturnsDerivedProbability() + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var failureMechanismSectionResult = new StabilityPointStructuresFailureMechanismSectionResult(section) + { + Calculation = new TestStabilityPointStructuresCalculation + { + Output = new TestStructuresOutput(0.75) + } + }; + + // Call + double detailedAssessmentProbability = failureMechanismSectionResult.GetDetailedAssessmentProbability(new StabilityPointStructuresFailureMechanism(), + assessmentSection); + + // Assert + Assert.AreEqual(0.22662735237686821, detailedAssessmentProbability); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs =================================================================== diff -u -r30f69be7d009744f9d2422bc69b5aefc50db5d38 -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision 30f69be7d009744f9d2422bc69b5aefc50db5d38) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismResultViewTest.cs (.../StabilityPointStructuresFailureMechanismResultViewTest.cs) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -47,7 +47,7 @@ { private const int nameColumnIndex = 0; private const int assessmentLayerOneIndex = 1; - private const int assessmentLayerTwoAIndex = 2; + private const int detailedAssessmentIndex = 2; private const int assessmentLayerThreeIndex = 3; private Form testForm; @@ -119,14 +119,14 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(AssessmentLayerOneState.NotAssessed, cells[assessmentLayerOneIndex].Value); - Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + 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("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); } } @@ -153,25 +153,25 @@ DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - DataGridViewCell cellAssessmentLayerTwoA = cells[assessmentLayerTwoAIndex]; + DataGridViewCell cellDetailedAssessment = cells[detailedAssessmentIndex]; DataGridViewCell cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; DataGridViewCell dataGridViewCell = cells[assessmentLayerOneIndex]; Assert.AreEqual(assessmentLayerOneState, dataGridViewCell.Value); - Assert.AreEqual("-", cellAssessmentLayerTwoA.FormattedValue); + Assert.AreEqual("-", cellDetailedAssessment.FormattedValue); Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); Assert.IsEmpty(dataGridViewCell.ErrorText); if (assessmentLayerOneState == AssessmentLayerOneState.Sufficient) { - DataGridViewTestHelper.AssertCellIsDisabled(cellAssessmentLayerTwoA); + DataGridViewTestHelper.AssertCellIsDisabled(cellDetailedAssessment); DataGridViewTestHelper.AssertCellIsDisabled(cellAssessmentLayerThree); Assert.IsTrue(cellAssessmentLayerThree.ReadOnly); } else { - DataGridViewTestHelper.AssertCellIsEnabled(cellAssessmentLayerTwoA, true); + DataGridViewTestHelper.AssertCellIsEnabled(cellDetailedAssessment, true); DataGridViewTestHelper.AssertCellIsEnabled(cellAssessmentLayerThree); Assert.IsFalse(cellAssessmentLayerThree.ReadOnly); @@ -191,11 +191,11 @@ Assert.AreEqual(4, dataGridView.ColumnCount); Assert.IsInstanceOf(dataGridView.Columns[assessmentLayerOneIndex]); - Assert.IsInstanceOf(dataGridView.Columns[assessmentLayerTwoAIndex]); + Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentIndex]); Assert.IsInstanceOf(dataGridView.Columns[assessmentLayerThreeIndex]); Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[assessmentLayerOneIndex].HeaderText); - Assert.AreEqual("Gedetailleerde toets per vak", dataGridView.Columns[assessmentLayerTwoAIndex].HeaderText); + Assert.AreEqual("Gedetailleerde toets per vak", dataGridView.Columns[detailedAssessmentIndex].HeaderText); Assert.AreEqual("Toets op maat", dataGridView.Columns[assessmentLayerThreeIndex].HeaderText); Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode); @@ -256,33 +256,33 @@ Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(result1.AssessmentLayerOne, cells[assessmentLayerOneIndex].Value); - Assert.AreEqual("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(result1.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); - DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[detailedAssessmentIndex]); DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); 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("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(result2.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); - DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerTwoAIndex], true); + DataGridViewTestHelper.AssertCellIsEnabled(cells[detailedAssessmentIndex], true); DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); 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("-", cells[assessmentLayerTwoAIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); Assert.AreEqual(ProbabilityFormattingHelper.Format(result3.AssessmentLayerThree), cells[assessmentLayerThreeIndex].FormattedValue); - DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerTwoAIndex], true); + DataGridViewTestHelper.AssertCellIsEnabled(cells[detailedAssessmentIndex], true); DataGridViewTestHelper.AssertCellIsEnabled(cells[assessmentLayerThreeIndex]); } } @@ -322,15 +322,15 @@ DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); - DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerTwoAIndex]); + DataGridViewTestHelper.AssertCellIsDisabled(cells[detailedAssessmentIndex]); DataGridViewTestHelper.AssertCellIsDisabled(cells[assessmentLayerThreeIndex]); } } [Test] [TestCase(AssessmentLayerOneState.NotAssessed)] [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultWithoutCalculation_ThenLayerTwoAErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) + public void GivenSectionResultWithoutCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) @@ -347,7 +347,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -361,7 +361,7 @@ [Test] [TestCase(AssessmentLayerOneState.NotAssessed)] [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultAndCalculationNotCalculated_ThenLayerTwoAErrorTooltip( + public void GivenSectionResultAndCalculationNotCalculated_ThenDetailedAssessmentErrorTooltip( AssessmentLayerOneState assessmentLayerOneState) { // Given @@ -380,7 +380,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -394,7 +394,7 @@ [Test] [TestCase(AssessmentLayerOneState.NotAssessed)] [TestCase(AssessmentLayerOneState.NoVerdict)] - public void GivenSectionResultAndFailedCalculation_ThenLayerTwoAErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) + public void GivenSectionResultAndFailedCalculation_ThenDetailedAssessmentErrorTooltip(AssessmentLayerOneState assessmentLayerOneState) { // Given var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) @@ -415,7 +415,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -427,7 +427,7 @@ } [Test] - public void GivenSectionResultAndSuccessfulCalculation_ThenLayerTwoANoError() + public void GivenSectionResultAndSuccessfulCalculation_ThenDetailedAssessmentNoError() { // Given var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(CreateSimpleFailureMechanismSection()) @@ -447,7 +447,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -460,7 +460,7 @@ [Test] [TestCaseSource(nameof(AssessmentLayerOneStateIsSufficientVariousSections))] - public void GivenSectionResultAndAssessmentLayerOneStateSufficient_ThenLayerTwoANoError( + public void GivenSectionResultAndAssessmentLayerOneStateSufficient_ThenDetailedAssessmentNoError( StabilityPointStructuresFailureMechanismSectionResult sectionResult, string expectedValue) { // Given @@ -473,7 +473,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -485,9 +485,9 @@ } [Test] - [TestCase(AssessmentLayerOneState.NotAssessed, TestName = "SectionResultSuccessfulCalculation_CalculationToFailed_LayerTwoAHasError(notAssessed)")] - [TestCase(AssessmentLayerOneState.NoVerdict, TestName = "SectionResultSuccessfulCalculation_CalculationToFailed_LayerTwoAHasError(noVerdict)")] - public void GivenSectionResultAndSuccessfulCalculation_WhenChangingCalculationToFailed_ThenLayerTwoAHasError( + [TestCase(AssessmentLayerOneState.NotAssessed, TestName = "SectionResultSuccessfulCalculation_CalculationToFailed_DetailedAssessmentHasError(notAssessed)")] + [TestCase(AssessmentLayerOneState.NoVerdict, TestName = "SectionResultSuccessfulCalculation_CalculationToFailed_DetailedAssessmentHasError(noVerdict)")] + public void GivenSectionResultAndSuccessfulCalculation_WhenChangingCalculationToFailed_ThenDetailedAssessmentHasError( AssessmentLayerOneState assessmentLayerOneState) { // Given @@ -509,7 +509,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[assessmentLayerTwoAIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; // Precondition object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -r6e59a4f91d0acc68c0dc768b8f740a610d4fbde3 -ra0a6258257c414bfebdab21480a2278aa9748c35 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision 6e59a4f91d0acc68c0dc768b8f740a610d4fbde3) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/Views/StabilityPointStructuresFailureMechanismSectionResultRowTest.cs (.../StabilityPointStructuresFailureMechanismSectionResultRowTest.cs) (revision a0a6258257c414bfebdab21480a2278aa9748c35) @@ -58,11 +58,11 @@ // Assert Assert.IsInstanceOf>(row); Assert.AreEqual(result.AssessmentLayerOne, row.AssessmentLayerOne); - Assert.AreEqual(result.GetAssessmentLayerTwoA(failureMechanism, assessmentSection), row.AssessmentLayerTwoA); + Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability); Assert.AreEqual(row.AssessmentLayerThree, result.AssessmentLayerThree); TestHelper.AssertTypeConverter( - nameof(StabilityPointStructuresFailureMechanismSectionResultRow.AssessmentLayerTwoA)); + nameof(StabilityPointStructuresFailureMechanismSectionResultRow.DetailedAssessmentProbability)); TestHelper.AssertTypeConverter( nameof(StabilityPointStructuresFailureMechanismSectionResultRow.AssessmentLayerThree)); mocks.VerifyAll(); @@ -134,7 +134,7 @@ } [Test] - public void AssessmentLayerTwoA_NoCalculationSet_ReturnNaN() + public void DetailedAssessmentProbability_NoCalculationSet_ReturnNaN() { // Setup var mocks = new MockRepository(); @@ -152,17 +152,17 @@ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); // Call - double assessmentLayerTwoA = resultRow.AssessmentLayerTwoA; + double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; // Assert - Assert.IsNaN(assessmentLayerTwoA); + Assert.IsNaN(detailedAssessmentProbability); mocks.VerifyAll(); } [Test] [TestCase(CalculationScenarioStatus.Failed)] [TestCase(CalculationScenarioStatus.NotCalculated)] - public void AssessmentLayerTwoA_CalculationNotDone_ReturnNaN(CalculationScenarioStatus status) + public void DetailedAssessmentProbability_CalculationNotDone_ReturnNaN(CalculationScenarioStatus status) { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -186,15 +186,15 @@ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); // Call - double assessmentLayerTwoA = resultRow.AssessmentLayerTwoA; + double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; // Assert - Assert.IsNaN(assessmentLayerTwoA); + Assert.IsNaN(detailedAssessmentProbability); mocks.VerifyAll(); } [Test] - public void AssessmentLayerTwoA_CalculationSuccessful_ReturnAssessmentLayerTwoA() + public void DetailedAssessmentProbability_CalculationSuccessful_ReturnDetailedAssessmentProbability() { // Setup var failureMechanism = new StabilityPointStructuresFailureMechanism(); @@ -217,10 +217,10 @@ var resultRow = new StabilityPointStructuresFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); // Call - double assessmentLayerTwoA = resultRow.AssessmentLayerTwoA; + double detailedAssessmentProbability = resultRow.DetailedAssessmentProbability; // Assert - Assert.AreEqual(0.17105612630848185, assessmentLayerTwoA); + Assert.AreEqual(0.17105612630848185, detailedAssessmentProbability); mocks.VerifyAll(); }