Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsInputContextProperties.cs =================================================================== diff -u -rb116b56a97e5a4aee668e9dda089e8a2e2d45e57 -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsInputContextProperties.cs (.../MacroStabilityInwardsInputContextProperties.cs) (revision b116b56a97e5a4aee668e9dda089e8a2e2d45e57) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Forms/PropertyClasses/MacroStabilityInwardsInputContextProperties.cs (.../MacroStabilityInwardsInputContextProperties.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -69,38 +69,34 @@ private const int settingsCategoryIndex = 3; private const int totalCategoryCount = 3; - private readonly Func getNormativeAssessmentLevelFunc; + private readonly RoundedDouble normativeAssessmentLevel; private readonly IObservablePropertyChangeHandler propertyChangeHandler; /// /// Creates a new instance of . /// /// The instance to show the properties for. - /// 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. public MacroStabilityInwardsInputContextProperties(MacroStabilityInwardsInputContext data, - Func getNormativeAssessmentLevelFunc, + RoundedDouble normativeAssessmentLevel, IObservablePropertyChangeHandler propertyChangeHandler) { if (data == null) { throw new ArgumentNullException(nameof(data)); } - if (getNormativeAssessmentLevelFunc == null) - { - throw new ArgumentNullException(nameof(getNormativeAssessmentLevelFunc)); - } - if (propertyChangeHandler == null) { throw new ArgumentNullException(nameof(this.propertyChangeHandler)); } Data = data; - this.getNormativeAssessmentLevelFunc = getNormativeAssessmentLevelFunc; + this.normativeAssessmentLevel = normativeAssessmentLevel; this.propertyChangeHandler = propertyChangeHandler; } @@ -201,7 +197,7 @@ { return data.WrappedData.UseAssessmentLevelManualInput ? data.WrappedData.AssessmentLevel - : getNormativeAssessmentLevelFunc(); + : normativeAssessmentLevel; } set { Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs =================================================================== diff -u -refaa2edd50840c91789e601b19d523377641c824 -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision efaa2edd50840c91789e601b19d523377641c824) +++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Plugin/MacroStabilityInwardsPlugin.cs (.../MacroStabilityInwardsPlugin.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -75,7 +75,7 @@ yield return new PropertyInfo { CreateInstance = context => new MacroStabilityInwardsInputContextProperties(context, - () => GetNormativeAssessmentLevel(context.AssessmentSection, context.MacroStabilityInwardsCalculation), + GetNormativeAssessmentLevel(context.AssessmentSection, context.MacroStabilityInwardsCalculation), new ObservablePropertyChangeHandler(context.MacroStabilityInwardsCalculation, context.WrappedData)) }; yield return new PropertyInfo Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsInputContextPropertiesTest.cs (.../MacroStabilityInwardsInputContextPropertiesTest.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -75,7 +75,7 @@ mocks.ReplayAll(); // Call - TestDelegate test = () => new MacroStabilityInwardsInputContextProperties(null, GetTestNormativeAssessmentLevel, handler); + TestDelegate test = () => new MacroStabilityInwardsInputContextProperties(null, GetTestNormativeAssessmentLevel(), handler); // Assert var exception = Assert.Throws(test); @@ -84,34 +84,6 @@ } [Test] - public void Constructor_GetAssessmentLevelFuncNull_ThrowArgumentNullException() - { - // Setup - var mocks = new MockRepository(); - var assessmentSection = mocks.Stub(); - var handler = mocks.Stub(); - mocks.ReplayAll(); - - var calculationItem = new MacroStabilityInwardsCalculationScenario(); - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - - var context = new MacroStabilityInwardsInputContext(calculationItem.InputParameters, - calculationItem, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - // Call - TestDelegate test = () => new MacroStabilityInwardsInputContextProperties(context, null, handler); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("getNormativeAssessmentLevelFunc", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] public void Constructor_PropertyChangeHandlerNull_ThrowArgumentNullException() { // Setup @@ -130,7 +102,7 @@ assessmentSection); // Call - TestDelegate test = () => new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, null); + TestDelegate test = () => new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), null); // Assert var exception = Assert.Throws(test); @@ -157,7 +129,7 @@ assessmentSection); // Call - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Assert Assert.IsInstanceOf>(properties); @@ -187,7 +159,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { UseAssessmentLevelManualInput = false }; @@ -330,7 +302,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { UseAssessmentLevelManualInput = useManualAssessmentLevelInput }; @@ -428,7 +400,7 @@ assessmentSection); // Call - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Assert RoundedDouble expectedAssessmentLevel = useManualAssessmentLevelInput @@ -477,7 +449,7 @@ assessmentSection); var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); var random = new Random(21); const double assessmentLevel = 0.36; @@ -652,7 +624,7 @@ var handler = new SetPropertyValueAfterConfirmationParameterTester(new IObservable[0]); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(); inputParameters.StochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.0, soilProfile); @@ -706,7 +678,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call properties.SurfaceLine = testSurfaceLine; @@ -760,7 +732,7 @@ var handler = new SetPropertyValueAfterConfirmationParameterTester(new IObservable[0]); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call properties.SurfaceLine = newSurfaceLine; @@ -825,7 +797,7 @@ observable }); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call properties.StochasticSoilModel = stochasticSoilModel2; @@ -849,7 +821,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable surfaceLines = properties.GetAvailableSurfaceLines(); @@ -873,7 +845,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition: Assert.IsNull(calculation.InputParameters.SurfaceLine); @@ -943,7 +915,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition: Assert.IsNotNull(calculation.InputParameters.SurfaceLine); @@ -974,7 +946,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition Assert.IsNull(calculation.InputParameters.StochasticSoilModel); @@ -1013,7 +985,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition Assert.IsNotNull(calculation.InputParameters.StochasticSoilModel); @@ -1040,7 +1012,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = null; @@ -1090,7 +1062,7 @@ failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // When IEnumerable availableHydraulicBoundaryLocations = @@ -1132,7 +1104,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable selectableHydraulicBoundaryLocations = @@ -1184,7 +1156,7 @@ var context = new MacroStabilityInwardsInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable selectableHydraulicBoundaryLocations = @@ -1249,7 +1221,7 @@ observable }); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); IEnumerable originalList = properties.GetSelectableHydraulicBoundaryLocations() .ToList(); @@ -1299,7 +1271,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicReadOnlyValidationMethod("AssessmentLevel"); @@ -1326,7 +1298,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicReadOnlyValidationMethod("prop"); @@ -1362,7 +1334,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicVisibleValidationMethod("SelectedHydraulicBoundaryLocation"); @@ -1389,7 +1361,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicVisibleValidationMethod("prop"); @@ -1425,7 +1397,7 @@ observable }); - var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call setProperty(properties); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditorTest.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -72,7 +72,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditor(); var someValue = new object(); @@ -141,7 +141,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextStochasticSoilModelSelectionEditor(); var someValue = new object(); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditorTest.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -73,7 +73,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditor(); var someValue = new object(); @@ -142,7 +142,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextStochasticSoilProfileSelectionEditor(); var someValue = new object(); Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextSurfaceLineSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rf00ef179f4b76ecd6fcfe67b1e6ea797e8525509 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextSurfaceLineSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextSurfaceLineSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/UITypeEditors/MacroStabilityInwardsInputContextSurfaceLineSelectionEditorTest.cs (.../MacroStabilityInwardsInputContextSurfaceLineSelectionEditorTest.cs) (revision f00ef179f4b76ecd6fcfe67b1e6ea797e8525509) @@ -70,7 +70,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextSurfaceLineSelectionEditor(); var someValue = new object(); @@ -125,7 +125,7 @@ failureMechanism, assessmentSection); - var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new MacroStabilityInwardsInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new MacroStabilityInwardsInputContextSurfaceLineSelectionEditor(); var someValue = new object();