Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -rb7b5138e77e8624ad8cc820e15cde5ff493073d8 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision b7b5138e77e8624ad8cc820e15cde5ff493073d8) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -147,7 +147,7 @@ GetViewName = (view, locations) => RingtoetsGrassCoverErosionOutwardsFormsResources.GrassCoverErosionOutwardsWaterLevelLocations_DisplayName, GetViewData = context => context.WrappedData, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, - CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(context.FailureMechanism, context.AssessmentSection, context.AssessmentSection.FailureMechanismContribution.Norm), + CreateInstance = context => new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(context.FailureMechanism, context.AssessmentSection, () => context.AssessmentSection.FailureMechanismContribution.Norm), AfterCreate = (view, context) => { view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; @@ -164,7 +164,7 @@ GetViewData = context => context.WrappedData, CloseForData = CloseGrassCoverErosionOutwardsLocationsViewForData, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, - CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationsView(context.FailureMechanism, context.AssessmentSection, context.AssessmentSection.FailureMechanismContribution.Norm), + CreateInstance = context => new GrassCoverErosionOutwardsWaveHeightLocationsView(context.FailureMechanism, context.AssessmentSection, () => context.AssessmentSection.FailureMechanismContribution.Norm), AfterCreate = (view, context) => { view.CalculationGuiService = hydraulicBoundaryLocationCalculationGuiService; Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs =================================================================== diff -u -r6d76d4ccdc61afb7f55947084929318483a0c110 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision 6d76d4ccdc61afb7f55947084929318483a0c110) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -86,7 +86,7 @@ // Call using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, - 0.01)) + () => 0.01)) { // Assert Assert.IsInstanceOf(view); @@ -102,14 +102,31 @@ mockRepository.ReplayAll(); // Call - TestDelegate call = () => new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(null, assessmentSection, 0.01); + TestDelegate call = () => new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(null, assessmentSection, () => 0.01); // Assert var exception = Assert.Throws(call); Assert.AreEqual("locations", exception.ParamName); } [Test] + public void Constructor_GetNormFuncNull_ThrowsArgumentNullException() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getNormFunc", exception.ParamName); + } + + [Test] public void Constructor_DataGridViewCorrectlyInitialized() { // Setup @@ -626,7 +643,7 @@ }; failureMechanism.HydraulicBoundaryLocations.AddRange(locations); - var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSection, norm); + var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSection, () => norm); form.Controls.Add(view); form.Show(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs =================================================================== diff -u -r384159a25f7e4598081e23c92fde39578b078434 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs) (revision 384159a25f7e4598081e23c92fde39578b078434) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/Views/GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -86,7 +86,7 @@ // Call using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, - 0.01)) + () => 0.01)) { // Assert Assert.IsInstanceOf(view); @@ -102,14 +102,31 @@ mockRepository.ReplayAll(); // Call - TestDelegate call = () => new GrassCoverErosionOutwardsWaveHeightLocationsView(null, assessmentSection, 0.01); + TestDelegate call = () => new GrassCoverErosionOutwardsWaveHeightLocationsView(null, assessmentSection, () => 0.01); // Assert var exception = Assert.Throws(call); Assert.AreEqual("locations", exception.ParamName); } [Test] + public void Constructor_GetNormFuncNull_ThrowsArgumentNullException() + { + // Setup + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(mockRepository); + mockRepository.ReplayAll(); + + // Call + TestDelegate call = () => new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), + assessmentSection, + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("getNormFunc", exception.ParamName); + } + + [Test] public void Constructor_DataGridViewCorrectlyInitialized() { // Setup @@ -625,7 +642,7 @@ }; failureMechanism.HydraulicBoundaryLocations.AddRange(locations); - var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, norm); + var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, () => norm); form.Controls.Add(view); form.Show(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewIntegrationTest.cs =================================================================== diff -u -rb78bd54dee643af1884c498bb127702962540856 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewIntegrationTest.cs) (revision b78bd54dee643af1884c498bb127702962540856) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewIntegrationTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -119,7 +119,7 @@ var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, new AssessmentSection(AssessmentSectionComposition.Dike), - 0.01); + () => 0.01); testForm.Controls.Add(view); testForm.Show(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs =================================================================== diff -u -rb78bd54dee643af1884c498bb127702962540856 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs) (revision b78bd54dee643af1884c498bb127702962540856) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Integration.Test/GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewIntegrationTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -119,7 +119,7 @@ var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, new AssessmentSection(AssessmentSectionComposition.Dike), - 0.01); + () => 0.01); testForm.Controls.Add(view); testForm.Show(); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs =================================================================== diff -u -r6d76d4ccdc61afb7f55947084929318483a0c110 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs) (revision 6d76d4ccdc61afb7f55947084929318483a0c110) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsDesignWaterLevelLocationsViewInfoTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -147,7 +147,7 @@ plugin.Gui = gui; plugin.Activate(); - using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(grassCoverErosionOutwardsFailureMechanism, assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(grassCoverErosionOutwardsFailureMechanism, assessmentSection, () => 0.01)) { // Call info.AfterCreate(view, data); @@ -177,7 +177,7 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSection, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -213,7 +213,7 @@ }); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSectionA, 0.01)) + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(failureMechanism, assessmentSectionA, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -248,7 +248,7 @@ using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, - 0.01)) + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -286,7 +286,7 @@ new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionB); - using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionA, 0.01)) + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionA, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -315,7 +315,7 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsDesignWaterLevelLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs =================================================================== diff -u -r6d76d4ccdc61afb7f55947084929318483a0c110 -r4dc948e21c0dc0076780aaf48e0c2acf35a4b802 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs) (revision 6d76d4ccdc61afb7f55947084929318483a0c110) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ViewInfos/GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs (.../GrassCoverErosionOutwardsWaveHeightLocationsViewInfoTest.cs) (revision 4dc948e21c0dc0076780aaf48e0c2acf35a4b802) @@ -144,7 +144,7 @@ plugin.Gui = gui; plugin.Activate(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, () => 0.01)) { info.AfterCreate(view, data); @@ -173,7 +173,7 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSection, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -209,7 +209,7 @@ }); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSectionA, 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(failureMechanism, assessmentSectionA, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -244,7 +244,7 @@ using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, - 0.01)) + () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -282,7 +282,7 @@ new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionB); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionA, 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSectionA, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin); @@ -311,7 +311,7 @@ assessmentSection.Stub(a => a.Detach(null)).IgnoreArguments(); mocks.ReplayAll(); - using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, 0.01)) + using (var view = new GrassCoverErosionOutwardsWaveHeightLocationsView(new GrassCoverErosionOutwardsFailureMechanism(), assessmentSection, () => 0.01)) using (var plugin = new GrassCoverErosionOutwardsPlugin()) { ViewInfo info = GetInfo(plugin);