Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6960c6d71475e60772aaaf95b0690793c18f775c -r0bf7bef98d08bd001d4c999443ce5f4e8761c674 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6960c6d71475e60772aaaf95b0690793c18f775c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0bf7bef98d08bd001d4c999443ce5f4e8761c674) @@ -352,6 +352,16 @@ } /// + /// Looks up a localized string similar to De waarde voor de 'Norm' moet in het bereik [100, 1000000] liggen.. + /// + public static string FailureMechanismContributionContextProperties_ReturnPeriod_Value_for_ReturnPeriod_Must_be_in_range_100_to_1000000 { + get { + return ResourceManager.GetString("FailureMechanismContributionContextProperties_ReturnPeriod_Value_for_ReturnPeriod" + + "_Must_be_in_range_100_to_1000000", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Dijk. /// public static string FailureMechanismContributionView_InitializeAssessmentSectionCompositionComboBox_Dike { Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r6960c6d71475e60772aaaf95b0690793c18f775c -r0bf7bef98d08bd001d4c999443ce5f4e8761c674 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6960c6d71475e60772aaaf95b0690793c18f775c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0bf7bef98d08bd001d4c999443ce5f4e8761c674) @@ -297,4 +297,7 @@ Norm [1/jaar] + + De waarde voor de 'Norm' moet in het bereik [100, 1000000] liggen. + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionContextProperties.cs =================================================================== diff -u -r0916bc9808f7c527e16e75a5404b800d2bd223c5 -r0bf7bef98d08bd001d4c999443ce5f4e8761c674 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionContextProperties.cs (.../FailureMechanismContributionContextProperties.cs) (revision 0916bc9808f7c527e16e75a5404b800d2bd223c5) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/FailureMechanismContributionContextProperties.cs (.../FailureMechanismContributionContextProperties.cs) (revision 0bf7bef98d08bd001d4c999443ce5f4e8761c674) @@ -80,6 +80,11 @@ } set { + if (value < 100 || value > 1000000) + { + throw new ArgumentOutOfRangeException("value", Resources.FailureMechanismContributionContextProperties_ReturnPeriod_Value_for_ReturnPeriod_Must_be_in_range_100_to_1000000); + } + if (value != 0 && normChangeHandler.ConfirmNormChange()) { double newNormValue = 1.0/Convert.ToInt32(value); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionContextPropertiesTest.cs =================================================================== diff -u -r04a75d409f31056c8a55a8a97dc3f511c25ff212 -r0bf7bef98d08bd001d4c999443ce5f4e8761c674 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionContextPropertiesTest.cs (.../FailureMechanismContributionContextPropertiesTest.cs) (revision 04a75d409f31056c8a55a8a97dc3f511c25ff212) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/FailureMechanismContributionContextPropertiesTest.cs (.../FailureMechanismContributionContextPropertiesTest.cs) (revision 0bf7bef98d08bd001d4c999443ce5f4e8761c674) @@ -106,16 +106,19 @@ var failureMechanisms = Enumerable.Empty(); var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 1.0/returnPeriod); - // Call var properties = new FailureMechanismContributionContextProperties() { Data = contribution, AssessmentSection = assessmentSection }; + // Call + int returnPeriodPropertyValue = properties.ReturnPeriod; + AssessmentSectionComposition compositionPropertyValue = properties.AssessmentSectionComposition; + // Assert - Assert.AreEqual(returnPeriod, properties.ReturnPeriod); - Assert.AreEqual(assessmentSectionComposition, properties.AssessmentSectionComposition); + Assert.AreEqual(returnPeriod, returnPeriodPropertyValue); + Assert.AreEqual(assessmentSectionComposition, compositionPropertyValue); mocks.VerifyAll(); } @@ -306,6 +309,36 @@ } [Test] + [TestCase(int.MinValue)] + [TestCase(int.MaxValue)] + [TestCase(99)] + [TestCase(1000001)] + public void ReturnPeriod_InvalidValue_ThrowsArgumentOutOfRangeException(int invalidReturnPeriod) + { + // Setup + var assessmentSectionComposition = AssessmentSectionComposition.DikeAndDune; + var assessmentSection = mocks.Stub(); + assessmentSection.Stub(section => section.Composition).Return(assessmentSectionComposition); + mocks.ReplayAll(); + + var failureMechanisms = Enumerable.Empty(); + var contribution = new FailureMechanismContribution(failureMechanisms, 1.1, 1.0/200); + + var properties = new FailureMechanismContributionContextProperties() + { + Data = contribution, + AssessmentSection = assessmentSection + }; + + // Call + TestDelegate call = () => properties.ReturnPeriod = invalidReturnPeriod; + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, + "De waarde voor de 'Norm' moet in het bereik [100, 1000000] liggen."); + } + + [Test] [TestCase(AssessmentSectionComposition.Dike, AssessmentSectionComposition.Dune)] [TestCase(AssessmentSectionComposition.Dike, AssessmentSectionComposition.DikeAndDune)] [TestCase(AssessmentSectionComposition.Dune, AssessmentSectionComposition.Dike)] @@ -327,10 +360,10 @@ .Return(true); compositionChangeHandler.Expect(h => h.ChangeComposition(assessmentSection, newComposition)) .Return(new[] - { - observable1, - observable2 - }); + { + observable1, + observable2 + }); mocks.ReplayAll(); var properties = new FailureMechanismContributionContextProperties()