Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs =================================================================== diff -u -r6f32731c2729c4b656afa114c90ecc40a327a55c -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision 6f32731c2729c4b656afa114c90ecc40a327a55c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -69,38 +69,34 @@ private const int diameter70PropertyIndex = 17; private const int saturatedVolumicWeightOfCoverageLayerPropertyIndex = 18; - 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 PipingInputContextProperties(PipingInputContext 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(propertyChangeHandler)); } Data = data; - this.getNormativeAssessmentLevelFunc = getNormativeAssessmentLevelFunc; + this.normativeAssessmentLevel = normativeAssessmentLevel; this.propertyChangeHandler = propertyChangeHandler; } @@ -177,7 +173,7 @@ { return data.WrappedData.UseAssessmentLevelManualInput ? data.WrappedData.AssessmentLevel - : getNormativeAssessmentLevelFunc(); + : normativeAssessmentLevel; } #region Hydraulic data Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -refaa2edd50840c91789e601b19d523377641c824 -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision efaa2edd50840c91789e601b19d523377641c824) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -76,7 +76,7 @@ yield return new PropertyInfo { CreateInstance = context => new PipingInputContextProperties(context, - () => GetNormativeAssessmentLevel(context.AssessmentSection, context.PipingCalculation), + GetNormativeAssessmentLevel(context.AssessmentSection, context.PipingCalculation), new ObservablePropertyChangeHandler(context.PipingCalculation, context.WrappedData)) }; yield return new PropertyInfo Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -80,7 +80,7 @@ mocks.ReplayAll(); // Call - TestDelegate test = () => new PipingInputContextProperties(null, GetTestNormativeAssessmentLevel, handler); + TestDelegate test = () => new PipingInputContextProperties(null, GetTestNormativeAssessmentLevel(), handler); // Assert var exception = Assert.Throws(test); @@ -89,34 +89,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 PipingCalculationScenario(new GeneralPipingInput()); - var failureMechanism = new PipingFailureMechanism(); - - var context = new PipingInputContext(calculationItem.InputParameters, - calculationItem, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - // Call - TestDelegate test = () => new PipingInputContextProperties(context, null, handler); - - // Assert - var exception = Assert.Throws(test); - Assert.AreEqual("getNormativeAssessmentLevelFunc", exception.ParamName); - mocks.VerifyAll(); - } - - [Test] public void Constructor_PropertyChangeHandlerNull_ThrowArgumentNullException() { // Setup @@ -135,7 +107,7 @@ assessmentSection); // Call - TestDelegate test = () => new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, null); + TestDelegate test = () => new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), null); // Assert var exception = Assert.Throws(test); @@ -162,7 +134,7 @@ assessmentSection); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Assert Assert.IsInstanceOf>(properties); @@ -229,7 +201,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { UseAssessmentLevelManualInput = false }; @@ -410,7 +382,7 @@ assessmentSection); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Assert PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); @@ -459,7 +431,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { UseAssessmentLevelManualInput = useManualAssessmentLevelInput }; @@ -556,7 +528,7 @@ assessmentSection); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Assert Assert.AreEqual(inputParameters.PhreaticLevelExit.Mean, properties.PhreaticLevelExit.Mean); @@ -635,7 +607,7 @@ assessmentSection); var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); const double assessmentLevel = 0.36; const double entryPointL = 0.12; @@ -849,7 +821,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { ExitPointL = (RoundedDouble) exitPoint, EntryPointL = (RoundedDouble) entryPoint @@ -891,7 +863,7 @@ var handler = new ObservablePropertyChangeHandler(calculationItem, calculationItem.InputParameters); // Call - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler) + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler) { EntryPointL = (RoundedDouble) 0.5, ExitPointL = (RoundedDouble) 2 @@ -939,7 +911,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call TestDelegate call = () => properties.ExitPointL = newExitPointL; @@ -986,7 +958,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call TestDelegate call = () => properties.EntryPointL = entryPoint; @@ -1033,7 +1005,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call TestDelegate call = () => properties.EntryPointL = entryPointL; @@ -1078,7 +1050,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call TestDelegate call = () => properties.ExitPointL = exitPointL; @@ -1119,7 +1091,7 @@ var handler = new SetPropertyValueAfterConfirmationParameterTester(new IObservable[0]); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); inputParameters.StochasticSoilProfile = new PipingStochasticSoilProfile(0.0, PipingSoilProfileTestFactory.CreatePipingSoilProfile()); @@ -1171,7 +1143,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call properties.SurfaceLine = testSurfaceLine; @@ -1222,7 +1194,7 @@ var handler = new SetPropertyValueAfterConfirmationParameterTester(new IObservable[0]); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call properties.SurfaceLine = newSurfaceLine; @@ -1247,7 +1219,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable surfaceLines = properties.GetAvailableSurfaceLines(); @@ -1271,7 +1243,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition: Assert.IsNull(calculation.InputParameters.SurfaceLine); @@ -1338,7 +1310,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition: Assert.IsNotNull(calculation.InputParameters.SurfaceLine); @@ -1369,7 +1341,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition Assert.IsNull(calculation.InputParameters.StochasticSoilModel); @@ -1407,7 +1379,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Precondition Assert.IsNotNull(calculation.InputParameters.StochasticSoilModel); @@ -1434,7 +1406,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); SelectableHydraulicBoundaryLocation selectedHydraulicBoundaryLocation = null; @@ -1484,7 +1456,7 @@ failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // When IEnumerable availableHydraulicBoundaryLocations = @@ -1526,7 +1498,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable selectableHydraulicBoundaryLocations = @@ -1578,7 +1550,7 @@ var context = new PipingInputContext(calculation.InputParameters, calculation, failureMechanism.SurfaceLines, failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call IEnumerable selectableHydraulicBoundaryLocations = @@ -1643,7 +1615,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); IEnumerable originalList = properties.GetSelectableHydraulicBoundaryLocations() .ToList(); @@ -1693,7 +1665,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicReadOnlyValidationMethod("AssessmentLevel"); @@ -1720,7 +1692,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicReadOnlyValidationMethod("prop"); @@ -1756,7 +1728,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicVisibleValidationMethod("SelectedHydraulicBoundaryLocation"); @@ -1783,7 +1755,7 @@ Enumerable.Empty(), failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call bool result = properties.DynamicVisibleValidationMethod("prop"); @@ -1819,7 +1791,7 @@ observable }); - var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(context, GetTestNormativeAssessmentLevel(), handler); // Call setProperty(properties); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditorTest.cs (.../PipingInputContextStochasticSoilModelSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditorTest.cs (.../PipingInputContextStochasticSoilModelSelectionEditorTest.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -72,7 +72,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(pipingInputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(pipingInputContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextStochasticSoilModelSelectionEditor(); var someValue = new object(); @@ -140,7 +140,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextStochasticSoilModelSelectionEditor(); var someValue = new object(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditorTest.cs (.../PipingInputContextStochasticSoilProfileSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditorTest.cs (.../PipingInputContextStochasticSoilProfileSelectionEditorTest.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -72,7 +72,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(pipingInputContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(pipingInputContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextStochasticSoilProfileSelectionEditor(); var someValue = new object(); @@ -140,7 +140,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextStochasticSoilProfileSelectionEditor(); var someValue = new object(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs =================================================================== diff -u -r3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c -rd7785d3e6c198e55be32c216857d49ca6b8c3f43 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs (.../PipingInputContextSurfaceLineSelectionEditorTest.cs) (revision 3407ec4aaf9a98e3f5c7ba5d3b61939bd2773b4c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs (.../PipingInputContextSurfaceLineSelectionEditorTest.cs) (revision d7785d3e6c198e55be32c216857d49ca6b8c3f43) @@ -70,7 +70,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextSurfaceLineSelectionEditor(); var someValue = new object(); @@ -125,7 +125,7 @@ failureMechanism, assessmentSection); - var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel, handler); + var properties = new PipingInputContextProperties(inputParametersContext, GetTestNormativeAssessmentLevel(), handler); var editor = new PipingInputContextSurfaceLineSelectionEditor(); var someValue = new object();