Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs =================================================================== diff -u -r2215bb99034f0bbc06a62ca5be160aab0129419c -ra073f90798f50ba8c37b59664beddebf61db30b9 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs) (revision 2215bb99034f0bbc06a62ca5be160aab0129419c) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Forms/PropertyClasses/GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextProperties.cs) (revision a073f90798f50ba8c37b59664beddebf61db30b9) @@ -46,7 +46,7 @@ public GrassCoverErosionOutwardsWaveConditionsInputContextProperties(GrassCoverErosionOutwardsWaveConditionsInputContext context, Func getNormativeAssessmentLevelFunc, IObservablePropertyChangeHandler propertyChangeHandler) - : base(context, getNormativeAssessmentLevelFunc, propertyChangeHandler) {} + : base(context, getNormativeAssessmentLevelFunc(), propertyChangeHandler) {} [ResourcesDisplayName(typeof(Resources), nameof(Resources.GrassCoverErosionOutwardsHydraulicBoundaryLocation_DesignWaterLevel_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.GrassCoverErosionOutwardsWaveConditionsInputContextProperties_DesignWaterLevel_Description))] Index: Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs =================================================================== diff -u -r54d81da9b5622275aef0c85397d3c7f23e08c67b -ra073f90798f50ba8c37b59664beddebf61db30b9 --- Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision 54d81da9b5622275aef0c85397d3c7f23e08c67b) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.Forms/PropertyClasses/WaveConditionsInputContextProperties.cs (.../WaveConditionsInputContextProperties.cs) (revision a073f90798f50ba8c37b59664beddebf61db30b9) @@ -69,38 +69,33 @@ private const int foreshoreGeometryPropertyIndex = 13; private const int revetmentTypePropertyIndex = 14; - private readonly Func getNormativeAssessmentLevelFunc; private readonly IObservablePropertyChangeHandler propertyChangeHandler; /// /// Creates a new instance of . /// /// The for which the properties are shown. - /// for obtaining the normative assessment level. + /// The normative assessment level. /// The handler responsible for handling effects of a property change. - /// Thrown when any parameter is null. + /// Thrown when or + /// is null. protected WaveConditionsInputContextProperties(T context, - Func getNormativeAssessmentLevelFunc, + RoundedDouble normativeAssessmentLevel, IObservablePropertyChangeHandler propertyChangeHandler) { if (context == null) { throw new ArgumentNullException(nameof(context)); } - if (getNormativeAssessmentLevelFunc == null) - { - throw new ArgumentNullException(nameof(getNormativeAssessmentLevelFunc)); - } - if (propertyChangeHandler == null) { throw new ArgumentNullException(nameof(propertyChangeHandler)); } Data = context; - this.getNormativeAssessmentLevelFunc = getNormativeAssessmentLevelFunc; + AssessmentLevel = normativeAssessmentLevel; this.propertyChangeHandler = propertyChangeHandler; } @@ -110,10 +105,7 @@ [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.AssessmentLevel_Description))] public virtual RoundedDouble AssessmentLevel { - get - { - return getNormativeAssessmentLevelFunc(); - } + get; } [PropertyOrder(upperBoundaryDesignWaterLevelPropertyIndex)] @@ -218,7 +210,7 @@ { get { - return data.WrappedData.GetWaterLevels(getNormativeAssessmentLevelFunc()).ToArray(); + return data.WrappedData.GetWaterLevels(AssessmentLevel).ToArray(); } } Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs =================================================================== diff -u -re444a84b4fbf8411cd3237eb2e836df68790652b -ra073f90798f50ba8c37b59664beddebf61db30b9 --- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision e444a84b4fbf8411cd3237eb2e836df68790652b) +++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision a073f90798f50ba8c37b59664beddebf61db30b9) @@ -91,31 +91,14 @@ public void Constructor_DataNull_ThrowsArgumentNullException() { // Call - TestDelegate test = () => new TestWaveConditionsInputContextProperties(null, GetTestNormativeAssessmentLevel, handler); + TestDelegate test = () => new TestWaveConditionsInputContextProperties(null, GetTestNormativeAssessmentLevel(), handler); // Assert string paramName = Assert.Throws(test).ParamName; Assert.AreEqual("context", paramName); } [Test] - public void Constructor_GetNormativeAssessmentLevelFuncNull_ThrowsArgumentNullException() - { - // Setup - var context = new TestWaveConditionsInputContext( - new WaveConditionsInput(), - Enumerable.Empty(), - Enumerable.Empty()); - - // Call - TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, null, handler); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("getNormativeAssessmentLevelFunc", exception.ParamName); - } - - [Test] public void Constructor_PropertyChangeHandlerNull_ThrowsArgumentNullException() { // Setup @@ -125,7 +108,7 @@ Enumerable.Empty()); // Call - TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel, null); + TestDelegate test = () => new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel(), null); // Assert var exception = Assert.Throws(test); @@ -174,7 +157,7 @@ var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); // Call - var properties = new TestWaveConditionsInputContextProperties(inputContext, () => assessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, assessmentLevel, handler); // Assert Assert.IsInstanceOf>(properties); @@ -227,7 +210,7 @@ }, new HydraulicBoundaryLocation[0]); // Call - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); @@ -368,7 +351,7 @@ var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); // Call - var properties = new TestWaveConditionsInputContextProperties(inputContext, () => assessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, assessmentLevel, handler); // Assert Assert.IsNotEmpty(properties.WaterLevels); @@ -462,7 +445,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = null; @@ -490,7 +473,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable availableHydraulicBoundaryLocations = @@ -520,7 +503,7 @@ ForeshoreProfile = new TestForeshoreProfile(new Point2D(200620.173572981, 503401.652985217)) }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Call SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = properties.SelectedHydraulicBoundaryLocation; @@ -554,7 +537,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // When IEnumerable availableHydraulicBoundaryLocations = @@ -582,7 +565,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable availableHydraulicBoundaryLocations = properties.GetSelectableHydraulicBoundaryLocations(); @@ -614,7 +597,7 @@ }; var inputContext = new TestWaveConditionsInputContext(input, new ForeshoreProfile[0], locations); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable availableHydraulicBoundaryLocations = properties.GetSelectableHydraulicBoundaryLocations(); @@ -651,7 +634,7 @@ var otherProfile = new TestForeshoreProfile(new Point2D(0, 190)); var customHandler = new SetPropertyValueAfterConfirmationParameterTester(Enumerable.Empty()); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, customHandler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), customHandler); IEnumerable originalList = properties.GetSelectableHydraulicBoundaryLocations() .ToList(); @@ -685,7 +668,7 @@ var input = new WaveConditionsInput(); var inputContext = new TestWaveConditionsInputContext(input, locations, new HydraulicBoundaryLocation[0]); - var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new TestWaveConditionsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable availableForeshoreProfiles = properties.GetAvailableForeshoreProfiles(); @@ -703,8 +686,10 @@ mocks.ReplayAll(); var calculation = new TestWaveConditionsCalculation(); - var input = new WaveConditionsInput(); - input.ForeshoreProfile = new TestForeshoreProfile(); + var input = new WaveConditionsInput + { + ForeshoreProfile = new TestForeshoreProfile() + }; var context = new TestWaveConditionsInputContext(input, calculation, @@ -717,7 +702,7 @@ observable }); - var properties = new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel, customHandler); + var properties = new TestWaveConditionsInputContextProperties(context, GetTestNormativeAssessmentLevel(), customHandler); // Call setProperty(properties); @@ -735,9 +720,9 @@ private class TestWaveConditionsInputContextProperties : WaveConditionsInputContextProperties { public TestWaveConditionsInputContextProperties(WaveConditionsInputContext context, - Func getNormativeAssessmentLevelFunc, + RoundedDouble normativeAssessmentLevel, IObservablePropertyChangeHandler handler) - : base(context, getNormativeAssessmentLevelFunc, handler) {} + : base(context, normativeAssessmentLevel, handler) {} public override string RevetmentType { Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs =================================================================== diff -u -r2215bb99034f0bbc06a62ca5be160aab0129419c -ra073f90798f50ba8c37b59664beddebf61db30b9 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs (.../StabilityStoneCoverWaveConditionsInputContextProperties.cs) (revision 2215bb99034f0bbc06a62ca5be160aab0129419c) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Forms/PropertyClasses/StabilityStoneCoverWaveConditionsInputContextProperties.cs (.../StabilityStoneCoverWaveConditionsInputContextProperties.cs) (revision a073f90798f50ba8c37b59664beddebf61db30b9) @@ -45,7 +45,7 @@ public StabilityStoneCoverWaveConditionsInputContextProperties(StabilityStoneCoverWaveConditionsInputContext context, Func getNormativeAssessmentLevelFunc, IObservablePropertyChangeHandler propertyChangeHandler) - : base(context, getNormativeAssessmentLevelFunc, propertyChangeHandler) {} + : base(context, getNormativeAssessmentLevelFunc(), propertyChangeHandler) {} public override string RevetmentType { Index: Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs =================================================================== diff -u -r2215bb99034f0bbc06a62ca5be160aab0129419c -ra073f90798f50ba8c37b59664beddebf61db30b9 --- Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs) (revision 2215bb99034f0bbc06a62ca5be160aab0129419c) +++ Ringtoets/WaveImpactAsphaltCover/src/Ringtoets.WaveImpactAsphaltCover.Forms/PropertyClasses/WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextProperties.cs) (revision a073f90798f50ba8c37b59664beddebf61db30b9) @@ -45,7 +45,7 @@ public WaveImpactAsphaltCoverWaveConditionsInputContextProperties(WaveImpactAsphaltCoverWaveConditionsInputContext context, Func getNormativeAssessmentLevelFunc, IObservablePropertyChangeHandler propertyChangeHandler) - : base(context, getNormativeAssessmentLevelFunc, propertyChangeHandler) {} + : base(context, getNormativeAssessmentLevelFunc(), propertyChangeHandler) {} public override string RevetmentType {