Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -47,7 +47,7 @@ var sectionResultEntity = new GrassCoverErosionInwardsSectionResultEntity { LayerOne = Convert.ToByte(result.AssessmentLayerOne), - LayerThree = result.AssessmentLayerThree.ToNaNAsNull() + LayerThree = result.TailorMadeAssessmentProbability.ToNaNAsNull() }; if (result.Calculation != null) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensions.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -54,7 +54,7 @@ } sectionResult.AssessmentLayerOne = (AssessmentLayerOneState) entity.LayerOne; - sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + sectionResult.TailorMadeAssessmentProbability = entity.LayerThree.ToNullAsNaN(); if (entity.GrassCoverErosionInwardsCalculationEntity != null) { sectionResult.Calculation = entity.GrassCoverErosionInwardsCalculationEntity.Read(collector); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u -rbcd1a835c8d39b06f4934b040d6ea45fa44b2ee5 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision bcd1a835c8d39b06f4934b040d6ea45fa44b2ee5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -55,12 +55,12 @@ // Setup var random = new Random(21); var assessmentLayerOneResult = random.NextEnumValue(); - RoundedDouble assessmentLayerThreeResult = random.NextRoundedDouble(); + double tailorMadeAssessmentProbability = random.NextDouble(); var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) { AssessmentLayerOne = assessmentLayerOneResult, - AssessmentLayerThree = assessmentLayerThreeResult + TailorMadeAssessmentProbability = tailorMadeAssessmentProbability }; var registry = new PersistenceRegistry(); @@ -70,7 +70,7 @@ // Assert Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), entity.LayerOne); - Assert.AreEqual(assessmentLayerThreeResult, entity.LayerThree); + Assert.AreEqual(tailorMadeAssessmentProbability, entity.LayerThree); Assert.IsNull(entity.GrassCoverErosionInwardsCalculationEntity); } @@ -80,7 +80,7 @@ // Setup var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) { - AssessmentLayerThree = RoundedDouble.NaN + TailorMadeAssessmentProbability = double.NaN }; var registry = new PersistenceRegistry(); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r59512bde82de1297788119a8cacd067789389d41 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 59512bde82de1297788119a8cacd067789389d41) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -1671,7 +1671,7 @@ (expectedItem, actualItem) => { Assert.AreEqual(expectedItem.AssessmentLayerOne, actualItem.AssessmentLayerOne); - Assert.AreEqual(expectedItem.AssessmentLayerThree, actualItem.AssessmentLayerThree); + Assert.AreEqual(expectedItem.TailorMadeAssessmentProbability, actualItem.TailorMadeAssessmentProbability); if (expectedItem.Calculation == null) { Assert.IsNull(expectedItem.Calculation); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -rb8df616ca911988b921b933bead5f1ef6862d076 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs) (revision b8df616ca911988b921b933bead5f1ef6862d076) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs (.../GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -68,15 +68,15 @@ // Setup var random = new Random(21); var layerOne = random.NextEnumValue(); - double layerThree = random.NextDouble(); + double tailorMadeAssessmentProbability = random.NextDouble(); var collector = new ReadConversionCollector(); var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); var entity = new GrassCoverErosionInwardsSectionResultEntity { - LayerThree = layerThree, + LayerThree = tailorMadeAssessmentProbability, LayerOne = Convert.ToByte(layerOne), FailureMechanismSectionEntity = failureMechanismSectionEntity }; @@ -87,7 +87,7 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + Assert.AreEqual(tailorMadeAssessmentProbability, sectionResult.TailorMadeAssessmentProbability, 1e-6); Assert.IsNull(sectionResult.Calculation); } @@ -116,7 +116,7 @@ // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); - Assert.IsNaN(sectionResult.AssessmentLayerThree); + Assert.IsNaN(sectionResult.TailorMadeAssessmentProbability); Assert.IsNull(sectionResult.Calculation); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -r59512bde82de1297788119a8cacd067789389d41 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision 59512bde82de1297788119a8cacd067789389d41) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -1777,7 +1777,7 @@ foreach (GrassCoverErosionInwardsFailureMechanismSectionResult sectionResult in sectionResults) { sectionResult.AssessmentLayerOne = GetAssessmentLayerOneState(); - sectionResult.AssessmentLayerThree = (RoundedDouble) random.NextDouble(); + sectionResult.TailorMadeAssessmentProbability = random.NextDouble(); if (!firstSectionResultHasCalculation) { sectionResult.Calculation = calculation; Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs =================================================================== diff -u -r19311fc87ea75a0407d8cdc617cc90b8c160429c -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision 19311fc87ea75a0407d8cdc617cc90b8c160429c) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanismSectionResult.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResult.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -22,6 +22,7 @@ using System; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Data.Properties; using Ringtoets.Common.Primitives; namespace Ringtoets.GrassCoverErosionInwards.Data @@ -32,7 +33,7 @@ /// public class GrassCoverErosionInwardsFailureMechanismSectionResult : FailureMechanismSectionResult { - private double assessmentLayerThreeValue; + private double tailorMadeAssessmentProbability; /// /// Creates a new instance of . @@ -42,7 +43,7 @@ public GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSection section) : base(section) { SimpleAssessmentResult = SimpleAssessmentResultValidityOnlyType.None; - assessmentLayerThreeValue = double.NaN; + tailorMadeAssessmentProbability = double.NaN; } /// @@ -57,20 +58,21 @@ public SimpleAssessmentResultValidityOnlyType SimpleAssessmentResult { get; set; } /// - /// Gets or sets the value of the tailored assessment of safety. + /// Gets or sets the value of the tailor made assessment of safety per failure mechanism section as a probability. /// - /// Thrown when - /// is outside of the valid ranges. - public double AssessmentLayerThree + /// Thrown when is not in range [0,1]. + public double TailorMadeAssessmentProbability { get { - return assessmentLayerThreeValue; + return tailorMadeAssessmentProbability; } set { - ProbabilityHelper.ValidateProbability(value, null, true); - assessmentLayerThreeValue = value; + ProbabilityHelper.ValidateProbability(value, null, + Resources.ArbitraryProbabilityFailureMechanismSectionResult_AssessmentProbability_Value_needs_to_be_in_Range_0_, + true); + tailorMadeAssessmentProbability = value; } } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs =================================================================== diff -u -r1c6c2405bf85bf76ffd242478df9a10d4ae3c966 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision 1c6c2405bf85bf76ffd242478df9a10d4ae3c966) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismResultView.cs (.../GrassCoverErosionInwardsFailureMechanismResultView.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -129,7 +129,7 @@ RingtoetsCommonFormsResources.FailureMechanismResultView_DetailedAssessmentResult_DisplayName, true); DataGridViewControl.AddTextBoxColumn( - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.AssessmentLayerThree), + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability), RingtoetsCommonFormsResources.FailureMechanismResultView_TailorMadeAssessmentResult_DisplayName); } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs =================================================================== diff -u -r44420c717ac32101ba0da4739d259c622f47976e -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision 44420c717ac32101ba0da4739d259c622f47976e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRow.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -82,20 +82,21 @@ } /// - /// Gets or sets the value of the tailored assessment of safety. + /// Gets or sets the tailor made assessment probability of the . /// - /// Thrown when - /// is outside of the valid ranges. + /// Thrown when is + /// not in the range [0,1]. [TypeConverter(typeof(NoProbabilityValueDoubleConverter))] - public double AssessmentLayerThree + public double TailorMadeAssessmentProbability { get { - return SectionResult.AssessmentLayerThree; + return SectionResult.TailorMadeAssessmentProbability; } set { - SectionResult.AssessmentLayerThree = value; + SectionResult.TailorMadeAssessmentProbability = value; + SectionResult.NotifyObservers(); } } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs =================================================================== diff -u -rad479a80b6db7879b935aecaca743c39615ec977 -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs) (revision ad479a80b6db7879b935aecaca743c39615ec977) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -44,7 +44,7 @@ Assert.IsInstanceOf(result); Assert.AreEqual(SimpleAssessmentResultValidityOnlyType.None, result.SimpleAssessmentResult); Assert.AreSame(section, result.Section); - Assert.IsNaN(result.AssessmentLayerThree); + Assert.IsNaN(result.TailorMadeAssessmentProbability); } [Test] @@ -64,40 +64,43 @@ [Test] [SetCulture("nl-NL")] - [TestCase(double.NegativeInfinity)] - [TestCase(double.PositiveInfinity)] - [TestCase(1.1)] - [TestCase(-0.1)] - public void AssessmentLayerThree_SetInvalidValue_ThrowsArgumentOutOfRangeException(double invalidValue) + [TestCase(-20)] + [TestCase(-1e-6)] + [TestCase(1 + 1e-6)] + [TestCase(12)] + public void TailorMadeAssessmentProbability_InvalidValue_ThrowsArgumentOutOfRangeException(double newValue) { // Setup - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionInwardsFailureMechanismSectionResult(section); // Call - TestDelegate call = () => sectionResult.AssessmentLayerThree = invalidValue; + TestDelegate test = () => result.TailorMadeAssessmentProbability = newValue; // Assert - const string expectedMessage = "Kans moet in het bereik [0,0, 1,0] liggen."; - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + string message = Assert.Throws(test).Message; + const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen."; + Assert.AreEqual(expectedMessage, message); } [Test] - [TestCase(double.NaN)] [TestCase(0)] - [TestCase(1)] + [TestCase(1e-6)] [TestCase(0.5)] - public void AssessmentLayerThree_SetValidValue_SetsValue(double validValue) + [TestCase(1 - 1e-6)] + [TestCase(1)] + [TestCase(double.NaN)] + public void TailorMadeAssessmentProbability_ValidValue_NewValueSet(double newValue) { // Setup - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionInwardsFailureMechanismSectionResult(section); // Call - sectionResult.AssessmentLayerThree = validValue; + result.TailorMadeAssessmentProbability = newValue; // Assert - Assert.AreEqual(validValue, sectionResult.AssessmentLayerThree); + Assert.AreEqual(newValue, result.TailorMadeAssessmentProbability); } } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs =================================================================== diff -u -r44420c717ac32101ba0da4739d259c622f47976e -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision 44420c717ac32101ba0da4739d259c622f47976e) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismResultViewTest.cs (.../GrassCoverErosionInwardsFailureMechanismResultViewTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -45,8 +45,8 @@ { private const int nameColumnIndex = 0; private const int simpleAssessmentIndex = 1; - private const int detailedAssessmentIndex = 2; - private const int assessmentLayerThreeIndex = 3; + private const int detailedAssessmentProbabilityIndex = 2; + private const int tailorMadeAssessmentProbabilityIndex = 3; private Form testForm; [SetUp] @@ -108,15 +108,15 @@ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; Assert.AreEqual(4, dataGridView.ColumnCount); - Assert.IsTrue(dataGridView.Columns[detailedAssessmentIndex].ReadOnly); + Assert.IsTrue(dataGridView.Columns[detailedAssessmentProbabilityIndex].ReadOnly); Assert.IsInstanceOf(dataGridView.Columns[simpleAssessmentIndex]); - Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentIndex]); - Assert.IsInstanceOf(dataGridView.Columns[assessmentLayerThreeIndex]); + Assert.IsInstanceOf(dataGridView.Columns[detailedAssessmentProbabilityIndex]); + Assert.IsInstanceOf(dataGridView.Columns[tailorMadeAssessmentProbabilityIndex]); Assert.AreEqual("Eenvoudige toets", dataGridView.Columns[simpleAssessmentIndex].HeaderText); - Assert.AreEqual("Gedetailleerde toets per vak", dataGridView.Columns[detailedAssessmentIndex].HeaderText); - Assert.AreEqual("Toets op maat", dataGridView.Columns[assessmentLayerThreeIndex].HeaderText); + Assert.AreEqual("Gedetailleerde toets per vak", dataGridView.Columns[detailedAssessmentProbabilityIndex].HeaderText); + Assert.AreEqual("Toets op maat", dataGridView.Columns[tailorMadeAssessmentProbabilityIndex].HeaderText); Assert.AreEqual(DataGridViewAutoSizeColumnsMode.AllCells, dataGridView.AutoSizeColumnsMode); Assert.AreEqual(DataGridViewContentAlignment.MiddleCenter, dataGridView.ColumnHeadersDefaultCellStyle.Alignment); @@ -139,15 +139,15 @@ Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(SimpleAssessmentResultValidityOnlyType.None, cells[simpleAssessmentIndex].Value); - Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); - Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentProbabilityIndex].FormattedValue); + Assert.AreEqual("-", cells[tailorMadeAssessmentProbabilityIndex].FormattedValue); cells = rows[1].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 2", cells[nameColumnIndex].FormattedValue); Assert.AreEqual(SimpleAssessmentResultValidityOnlyType.None, cells[simpleAssessmentIndex].Value); - Assert.AreEqual("-", cells[detailedAssessmentIndex].FormattedValue); - Assert.AreEqual("-", cells[assessmentLayerThreeIndex].FormattedValue); + Assert.AreEqual("-", cells[detailedAssessmentProbabilityIndex].FormattedValue); + Assert.AreEqual("-", cells[tailorMadeAssessmentProbabilityIndex].FormattedValue); } } @@ -173,35 +173,35 @@ DataGridViewCellCollection cells = rows[0].Cells; Assert.AreEqual(4, cells.Count); Assert.AreEqual("Section 1", cells[nameColumnIndex].FormattedValue); - DataGridViewCell cellDetailedAssessment = cells[detailedAssessmentIndex]; - DataGridViewCell cellAssessmentLayerThree = cells[assessmentLayerThreeIndex]; + DataGridViewCell cellDetailedAssessment = cells[detailedAssessmentProbabilityIndex]; + DataGridViewCell cellTailorMadeAssessment = cells[tailorMadeAssessmentProbabilityIndex]; DataGridViewCell dataGridViewCell = cells[simpleAssessmentIndex]; Assert.AreEqual(simpleAssessmentResult, dataGridViewCell.Value); Assert.AreEqual("-", cellDetailedAssessment.FormattedValue); - Assert.AreEqual("-", cellAssessmentLayerThree.FormattedValue); + Assert.AreEqual("-", cellTailorMadeAssessment.FormattedValue); Assert.IsEmpty(dataGridViewCell.ErrorText); if (simpleAssessmentResult == SimpleAssessmentResultValidityOnlyType.NotApplicable) { DataGridViewTestHelper.AssertCellIsDisabled(cellDetailedAssessment); - DataGridViewTestHelper.AssertCellIsDisabled(cellAssessmentLayerThree); + DataGridViewTestHelper.AssertCellIsDisabled(cellTailorMadeAssessment); - Assert.IsTrue(cellAssessmentLayerThree.ReadOnly); + Assert.IsTrue(cellTailorMadeAssessment.ReadOnly); } else { DataGridViewTestHelper.AssertCellIsEnabled(cellDetailedAssessment, true); - DataGridViewTestHelper.AssertCellIsEnabled(cellAssessmentLayerThree); + DataGridViewTestHelper.AssertCellIsEnabled(cellTailorMadeAssessment); - Assert.IsFalse(cellAssessmentLayerThree.ReadOnly); + Assert.IsFalse(cellTailorMadeAssessment.ReadOnly); } } } [Test] - [TestCase("test", assessmentLayerThreeIndex)] - [TestCase(";/[].,~!@#$%^&*()_-+={}|?", assessmentLayerThreeIndex)] + [TestCase("test", tailorMadeAssessmentProbabilityIndex)] + [TestCase(";/[].,~!@#$%^&*()_-+={}|?", tailorMadeAssessmentProbabilityIndex)] public void FailureMechanismResultView_EditValueInvalid_ShowsErrorTooltip(string newValue, int cellIndex) { // Setup @@ -223,18 +223,18 @@ [TestCase(-0.01)] [TestCase(5)] [TestCase(-10)] - public void FailureMechanismResultView_EditValueAssessmentLayerThreeInvalid_ShowErrorToolTip(double newValue) + public void FailureMechanismResultView_EditValueTailorMadeAssessmentInvalid_ShowErrorToolTip(double newValue) { // Setup using (CreateConfiguredFailureMechanismResultsView()) { var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; // Call - dataGridView.Rows[0].Cells[assessmentLayerThreeIndex].Value = newValue.ToString(CultureInfo.CurrentCulture); + dataGridView.Rows[0].Cells[tailorMadeAssessmentProbabilityIndex].Value = newValue.ToString(CultureInfo.CurrentCulture); // Assert - Assert.AreEqual("Kans moet in het bereik [0,0, 1,0] liggen.", dataGridView.Rows[0].ErrorText); + Assert.AreEqual("De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen.", dataGridView.Rows[0].ErrorText); } } @@ -245,7 +245,7 @@ [TestCase(0.5)] [TestCase(1e-6)] [TestCase(double.NaN)] - public void FailureMechanismResultView_EditValueAssessmentLayerThreeValid_DoNotShowErrorToolTipAndEditValue(double newValue) + public void FailureMechanismResultView_EditValueTailorMadeAssessmentValid_DoNotShowErrorToolTipAndEditValue(double newValue) { // Setup var result = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); @@ -258,11 +258,11 @@ var dataGridView = (DataGridView) new ControlTester("dataGridView").TheObject; // Call - dataGridView.Rows[0].Cells[assessmentLayerThreeIndex].Value = newValue.ToString(CultureInfo.CurrentCulture); + dataGridView.Rows[0].Cells[tailorMadeAssessmentProbabilityIndex].Value = newValue.ToString(CultureInfo.CurrentCulture); // Assert Assert.IsEmpty(dataGridView.Rows[0].ErrorText); - Assert.AreEqual(newValue, result.AssessmentLayerThree); + Assert.AreEqual(newValue, result.TailorMadeAssessmentProbability); } } @@ -286,7 +286,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -319,7 +319,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -358,7 +358,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -394,7 +394,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -420,7 +420,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // When object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. @@ -458,7 +458,7 @@ var gridTester = new ControlTester("dataGridView"); var dataGridView = (DataGridView) gridTester.TheObject; - DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentIndex]; + DataGridViewCell dataGridViewCell = dataGridView.Rows[0].Cells[detailedAssessmentProbabilityIndex]; // Precondition object formattedValue = dataGridViewCell.FormattedValue; // Need to do this to fire the CellFormatting event. Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs =================================================================== diff -u -rc7425b8f799095f2dc812351e14103931c672fba -rb761c34a465fc6d203555b5a52839dd1681aad5a --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision c7425b8f799095f2dc812351e14103931c672fba) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Views/GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs (.../GrassCoverErosionInwardsFailureMechanismSectionResultRowTest.cs) (revision b761c34a465fc6d203555b5a52839dd1681aad5a) @@ -60,12 +60,12 @@ Assert.IsInstanceOf>(row); Assert.AreEqual(result.SimpleAssessmentResult, row.SimpleAssessmentResult); Assert.AreEqual(result.GetDetailedAssessmentProbability(failureMechanism, assessmentSection), row.DetailedAssessmentProbability); - Assert.AreEqual(row.AssessmentLayerThree, result.AssessmentLayerThree); + Assert.AreEqual(row.TailorMadeAssessmentProbability, result.TailorMadeAssessmentProbability); TestHelper.AssertTypeConverter( nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.DetailedAssessmentProbability)); TestHelper.AssertTypeConverter( - nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.AssessmentLayerThree)); + nameof(GrassCoverErosionInwardsFailureMechanismSectionResultRow.TailorMadeAssessmentProbability)); mocks.VerifyAll(); } @@ -285,27 +285,58 @@ } [Test] - public void AssessmentLayerThree_ValueSet_ReturnExpectedValue() + [TestCase(0)] + [TestCase(1)] + [TestCase(0.5)] + [TestCase(1e-6)] + [TestCase(double.NaN)] + public void TailorMadeAssessmentProbability_ValidValue_NotifyObserversAndPropertyChanged(double value) { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); - var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionInwardsFailureMechanismSectionResult(section); + result.Attach(observer); - var random = new Random(21); - double assessmentLayerThree = random.NextDouble(); + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); - var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult( - FailureMechanismSectionTestFactory.CreateFailureMechanismSection()); - var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(sectionResult, failureMechanism, assessmentSection); + // Call + row.TailorMadeAssessmentProbability = value; + // Assert + Assert.AreEqual(value, row.TailorMadeAssessmentProbability); + mocks.VerifyAll(); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-20)] + [TestCase(-1e-6)] + [TestCase(1 + 1e-6)] + [TestCase(12)] + public void TailorMadeAssessmentProbability_InvalidValue_ThrowsArgumentOutOfRangeException(double value) + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + FailureMechanismSection section = FailureMechanismSectionTestFactory.CreateFailureMechanismSection(); + var result = new GrassCoverErosionInwardsFailureMechanismSectionResult(section); + var row = new GrassCoverErosionInwardsFailureMechanismSectionResultRow(result, new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); + // Call - row.AssessmentLayerThree = assessmentLayerThree; + TestDelegate test = () => row.TailorMadeAssessmentProbability = value; // Assert - Assert.AreEqual(assessmentLayerThree, sectionResult.AssessmentLayerThree); + string message = Assert.Throws(test).Message; + const string expectedMessage = "De waarde voor de faalkans moet in het bereik [0,0, 1,0] liggen."; + Assert.AreEqual(expectedMessage, message); mocks.VerifyAll(); } }