Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsProperties.cs =================================================================== diff -u -ra4914458efa8ce67244c7743d5511080ac232dad -r13a01ffdbf2301d2959171f8899765fc0c6d62d4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsProperties.cs (.../DesignWaterLevelLocationsProperties.cs) (revision a4914458efa8ce67244c7743d5511080ac232dad) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsProperties.cs (.../DesignWaterLevelLocationsProperties.cs) (revision 13a01ffdbf2301d2959171f8899765fc0c6d62d4) @@ -50,6 +50,11 @@ Func getCalculationFunc) : base(hydraulicBoundaryLocations) { + if (getCalculationFunc == null) + { + throw new ArgumentNullException(nameof(getCalculationFunc)); + } + this.getCalculationFunc = getCalculationFunc; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsProperties.cs =================================================================== diff -u -ra4914458efa8ce67244c7743d5511080ac232dad -r13a01ffdbf2301d2959171f8899765fc0c6d62d4 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsProperties.cs (.../WaveHeightLocationsProperties.cs) (revision a4914458efa8ce67244c7743d5511080ac232dad) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsProperties.cs (.../WaveHeightLocationsProperties.cs) (revision 13a01ffdbf2301d2959171f8899765fc0c6d62d4) @@ -50,6 +50,11 @@ Func getCalculationFunc) : base(hydraulicBoundaryLocations) { + if (getCalculationFunc == null) + { + throw new ArgumentNullException(nameof(getCalculationFunc)); + } + this.getCalculationFunc = getCalculationFunc; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r622768283f80b349b41e4de33d2f86fef8d989ac -r13a01ffdbf2301d2959171f8899765fc0c6d62d4 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 622768283f80b349b41e4de33d2f86fef8d989ac) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 13a01ffdbf2301d2959171f8899765fc0c6d62d4) @@ -316,17 +316,17 @@ }; yield return new PropertyInfo { - CreateInstance = context => new DesignWaterLevelLocationsProperties( - context.WrappedData) + CreateInstance = context => new DesignWaterLevelLocationsProperties(context.WrappedData, + hbl => hbl.DesignWaterLevelCalculation) }; yield return new PropertyInfo { CreateInstance = context => new DesignWaterLevelLocationProperties(context.WrappedData, context.WrappedData.DesignWaterLevelCalculation) }; yield return new PropertyInfo { - CreateInstance = context => new WaveHeightLocationsProperties( - context.WrappedData) + CreateInstance = context => new WaveHeightLocationsProperties(context.WrappedData, + hbl => hbl.WaveHeightCalculation) }; yield return new PropertyInfo { Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsPropertiesTest.cs =================================================================== diff -u -r26e8d737f7a07e9999ba93f71486ec4c1bb89c24 -r13a01ffdbf2301d2959171f8899765fc0c6d62d4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsPropertiesTest.cs (.../DesignWaterLevelLocationsPropertiesTest.cs) (revision 26e8d737f7a07e9999ba93f71486ec4c1bb89c24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsPropertiesTest.cs (.../DesignWaterLevelLocationsPropertiesTest.cs) (revision 13a01ffdbf2301d2959171f8899765fc0c6d62d4) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; using System.Linq; using Core.Common.Base; @@ -38,13 +39,28 @@ private const int requiredLocationsPropertyIndex = 0; [Test] + public void Constructor_GetCalculationFuncNull_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryLocations = new ObservableList(); + + // Call + TestDelegate call = () => new DesignWaterLevelLocationsProperties(hydraulicBoundaryLocations, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getCalculationFunc", exception.ParamName); + } + + [Test] public void Constructor_WithHydraulicBoundaryLocations_ExpectedValues() { // Setup var hydraulicBoundaryLocations = new ObservableList(); // Call - var properties = new DesignWaterLevelLocationsProperties(hydraulicBoundaryLocations); + var properties = new DesignWaterLevelLocationsProperties(hydraulicBoundaryLocations, + hbl => new HydraulicBoundaryLocationCalculation()); // Assert Assert.IsInstanceOf(properties); @@ -62,7 +78,8 @@ }; // Call - var properties = new DesignWaterLevelLocationsProperties(hydraulicBoundaryLocations); + var properties = new DesignWaterLevelLocationsProperties(hydraulicBoundaryLocations, + hbl => hbl.DesignWaterLevelCalculation); // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(DesignWaterLevelLocationProperties)); @@ -81,7 +98,8 @@ public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Call - var properties = new DesignWaterLevelLocationsProperties(new ObservableList()); + var properties = new DesignWaterLevelLocationsProperties(new ObservableList(), + hbl => new HydraulicBoundaryLocationCalculation()); // Assert TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsPropertiesTest.cs =================================================================== diff -u -r26e8d737f7a07e9999ba93f71486ec4c1bb89c24 -r13a01ffdbf2301d2959171f8899765fc0c6d62d4 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsPropertiesTest.cs (.../WaveHeightLocationsPropertiesTest.cs) (revision 26e8d737f7a07e9999ba93f71486ec4c1bb89c24) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsPropertiesTest.cs (.../WaveHeightLocationsPropertiesTest.cs) (revision 13a01ffdbf2301d2959171f8899765fc0c6d62d4) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.ComponentModel; using System.Linq; using Core.Common.Base; @@ -38,13 +39,28 @@ private const int requiredLocationsPropertyIndex = 0; [Test] + public void Constructor_GetCalculationFuncNull_ThrowsArgumentNullException() + { + // Setup + var hydraulicBoundaryLocations = new ObservableList(); + + // Call + TestDelegate call = () => new WaveHeightLocationsProperties(hydraulicBoundaryLocations, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getCalculationFunc", exception.ParamName); + } + + [Test] public void Constructor_WithDatabase_ExpectedValues() { // Setup var hydraulicBoundaryDatabase = new ObservableList(); // Call - var properties = new WaveHeightLocationsProperties(hydraulicBoundaryDatabase); + var properties = new WaveHeightLocationsProperties(hydraulicBoundaryDatabase, + hbl => new HydraulicBoundaryLocationCalculation()); // Assert Assert.IsInstanceOf(properties); @@ -62,7 +78,8 @@ }; // Call - var properties = new WaveHeightLocationsProperties(hydraulicBoundaryDatabase); + var properties = new WaveHeightLocationsProperties(hydraulicBoundaryDatabase, + hbl => hbl.WaveHeightCalculation); // Assert CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(WaveHeightLocationProperties)); @@ -81,7 +98,8 @@ public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Call - var properties = new WaveHeightLocationsProperties(new ObservableList()); + var properties = new WaveHeightLocationsProperties(new ObservableList(), + hbl => new HydraulicBoundaryLocationCalculation()); // Assert TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true);