Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs =================================================================== diff -u -r989be010778ab44a778d79f0e2d892343acf0c0d -r842e446f88e513e8be98fa0cf6c111f74d19de6c --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 989be010778ab44a778d79f0e2d892343acf0c0d) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsPlugin.cs (.../GrassCoverErosionInwardsPlugin.cs) (revision 842e446f88e513e8be98fa0cf6c111f74d19de6c) @@ -111,7 +111,7 @@ Category = RingtoetsCommonFormsResources.Ringtoets_Category, Image = RingtoetsCommonFormsResources.DikeProfile, FileFilterGenerator = DikeProfileImporterFileFilterGenerator(), - IsEnabled = IsDikeProfileImporterEnabled, + IsEnabled = context => context.ParentAssessmentSection.ReferenceLine != null, VerifyUpdates = context => VerifyDikeProfilesShouldUpdate(context, Resources.GrassCoverErosionInwardsPlugin_VerifyDikeProfileImport_When_importing_DikeProfiles_Calculation_output_will_be_cleared_confirm) }; @@ -131,7 +131,7 @@ Image = RingtoetsCommonFormsResources.DikeProfile, FileFilterGenerator = DikeProfileImporterFileFilterGenerator(), CurrentPath = context => context.WrappedData.SourcePath, - IsEnabled = IsDikeProfileImporterEnabled, + IsEnabled = context => context.WrappedData.SourcePath != null, VerifyUpdates = context => VerifyDikeProfilesShouldUpdate(context, Resources.GrassCoverErosionInwardsPlugin_VerifyDikeProfileUpdate_When_updating_Calculation_with_DikeProfile_data_output_will_be_cleared_confirm) }; @@ -900,11 +900,6 @@ RingtoetsCommonIOResources.Shape_file_filter_Description); } - private static bool IsDikeProfileImporterEnabled(DikeProfilesContext context) - { - return context.ParentAssessmentSection.ReferenceLine != null; - } - private bool VerifyDikeProfilesShouldUpdate(DikeProfilesContext context, string query) { var changeHandler = new FailureMechanismCalculationChangeHandler(context.ParentFailureMechanism, Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs =================================================================== diff -u -r5cede57abe00f676961d9642a0f0621aadd9f762 -r842e446f88e513e8be98fa0cf6c111f74d19de6c --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 5cede57abe00f676961d9642a0f0621aadd9f762) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 842e446f88e513e8be98fa0cf6c111f74d19de6c) @@ -106,7 +106,7 @@ Category = RingtoetsCommonFormsResources.Ringtoets_Category, Image = PipingFormsResources.PipingSurfaceLineIcon, FileFilterGenerator = RingtoetsPipingSurfaceLineFileFilter, - IsEnabled = IsSurfaceLineImporterEnabled, + IsEnabled = context => context.AssessmentSection.ReferenceLine != null, CreateFileImporter = (context, filePath) => PipingSurfaceLinesCsvImporter(context, filePath, new ImportMessageProvider(), new RingtoetsPipingSurfaceLineReplaceDataStrategy(context.FailureMechanism)), VerifyUpdates = context => VerifyPipingSurfaceLineUpdates(context, Resources.PipingPlugin_VerifyRingtoetsPipingSurfaceLineImport_When_importing_surfacelines_calculation_output_will_be_cleared_confirm) }; @@ -117,7 +117,7 @@ Category = RingtoetsCommonFormsResources.Ringtoets_Category, Image = PipingFormsResources.PipingSoilProfileIcon, FileFilterGenerator = StochasticSoilModelFileFilter, - IsEnabled = StochasticSoilModelImporterEnabled, + IsEnabled = context => context.AssessmentSection.ReferenceLine != null, CreateFileImporter = (context, filePath) => StochasticSoilModelImporter(context, filePath, new ImportMessageProvider(), new StochasticSoilModelReplaceDataStrategy(context.FailureMechanism)), VerifyUpdates = context => VerifyStochasticSoilModelUpdates(context, Resources.PipingPlugin_VerifyStochasticSoilModelImport_When_importing_StochasticSoilModels_calculation_output_will_be_cleared_confirm) }; @@ -152,7 +152,7 @@ Category = RingtoetsCommonFormsResources.Ringtoets_Category, Image = PipingFormsResources.PipingSurfaceLineIcon, FileFilterGenerator = RingtoetsPipingSurfaceLineFileFilter, - IsEnabled = IsSurfaceLineImporterEnabled, + IsEnabled = context => context.WrappedData.SourcePath != null, CurrentPath = context => context.WrappedData.SourcePath, CreateFileImporter = (context, filePath) => PipingSurfaceLinesCsvImporter(context, filePath, new UpdateMessageProvider(), new RingtoetsPipingSurfaceLineUpdateDataStrategy(context.FailureMechanism)), VerifyUpdates = context => VerifyPipingSurfaceLineUpdates(context, Resources.PipingPlugin_VerifyRingtoetsPipingSurfaceLineUpdates_When_updating_surfacelines_definitions_assigned_to_calculation_output_will_be_cleared_confirm) @@ -164,7 +164,7 @@ Category = RingtoetsCommonFormsResources.Ringtoets_Category, Image = PipingFormsResources.PipingSoilProfileIcon, FileFilterGenerator = StochasticSoilModelFileFilter, - IsEnabled = StochasticSoilModelImporterEnabled, + IsEnabled = context => context.WrappedData.SourcePath != null, CurrentPath = context => context.WrappedData.SourcePath, CreateFileImporter = (context, filePath) => StochasticSoilModelImporter(context, filePath, new UpdateMessageProvider(), new StochasticSoilModelUpdateDataStrategy(context.FailureMechanism)), VerifyUpdates = context => VerifyStochasticSoilModelUpdates(context, Resources.PipingPlugin_VerifyStochasticSoilModelUpdates_When_updating_StochasticSoilModel_definitions_assigned_to_calculation_output_will_be_cleared_confirm) @@ -361,11 +361,6 @@ updateStrategy); } - private static bool StochasticSoilModelImporterEnabled(StochasticSoilModelCollectionContext context) - { - return context.AssessmentSection.ReferenceLine != null; - } - private bool VerifyStochasticSoilModelUpdates(StochasticSoilModelCollectionContext context, string query) { var changeHandler = new FailureMechanismCalculationChangeHandler(context.FailureMechanism, @@ -1079,11 +1074,6 @@ strategy); } - private static bool IsSurfaceLineImporterEnabled(RingtoetsPipingSurfaceLinesContext context) - { - return context.AssessmentSection.ReferenceLine != null; - } - private static FileFilterGenerator RingtoetsPipingSurfaceLineFileFilter { get Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/RingtoetsPipingSurfaceLinesContextUpdateInfoTest.cs =================================================================== diff -u -r81fa8a9bf3bd503cbd280e88b8f6037a840cff12 -r842e446f88e513e8be98fa0cf6c111f74d19de6c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/RingtoetsPipingSurfaceLinesContextUpdateInfoTest.cs (.../RingtoetsPipingSurfaceLinesContextUpdateInfoTest.cs) (revision 81fa8a9bf3bd503cbd280e88b8f6037a840cff12) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/RingtoetsPipingSurfaceLinesContextUpdateInfoTest.cs (.../RingtoetsPipingSurfaceLinesContextUpdateInfoTest.cs) (revision 842e446f88e513e8be98fa0cf6c111f74d19de6c) @@ -90,7 +90,7 @@ } [Test] - public void IsEnabled_ReferenceLineNull_ReturnFalse() + public void IsEnabled_SurfaceLineCollectionSourcePathNull_ReturnFalse() { // Setup var mocks = new MockRepository(); @@ -111,17 +111,16 @@ } [Test] - public void IsEnabled_ReferenceLineSet_ReturnTrue() + public void IsEnabled_SurfaceLineCollectionSourcePathSet_ReturnTrue() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - assessmentSection.ReferenceLine = new ReferenceLine(); - var failureMechanism = new PipingFailureMechanism(); var surfaceLines = new RingtoetsPipingSurfaceLineCollection(); + surfaceLines.AddRange(Enumerable.Empty(),"some/path"); var context = new RingtoetsPipingSurfaceLinesContext(surfaceLines, failureMechanism, assessmentSection); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs =================================================================== diff -u -ra70cb733eb761229173777b9f6cd1b977830b24b -r842e446f88e513e8be98fa0cf6c111f74d19de6c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs (.../StochasticSoilModelCollectionContextUpdateInfoTest.cs) (revision a70cb733eb761229173777b9f6cd1b977830b24b) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/UpdateInfos/StochasticSoilModelCollectionContextUpdateInfoTest.cs (.../StochasticSoilModelCollectionContextUpdateInfoTest.cs) (revision 842e446f88e513e8be98fa0cf6c111f74d19de6c) @@ -91,16 +91,17 @@ } [Test] - public void IsEnabled_ReferenceLineNull_ReturnFalse() + public void IsEnabled_SoilModelCollectionSourcePathNull_ReturnFalse() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); var failureMechanism = new PipingFailureMechanism(); + var stochasticSoilModel = new StochasticSoilModelCollection(); - var context = new StochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + var context = new StochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection); // Call bool isEnabled = updateInfo.IsEnabled(context); @@ -111,18 +112,18 @@ } [Test] - public void IsEnabled_ReferenceLineSet_ReturnTrue() + public void IsEnabled_SoilModelCollectionSourcePathSet_ReturnTrue() { // Setup var mocks = new MockRepository(); var assessmentSection = mocks.Stub(); mocks.ReplayAll(); - assessmentSection.ReferenceLine = new ReferenceLine(); - var failureMechanism = new PipingFailureMechanism(); + var stochasticSoilModel = new StochasticSoilModelCollection(); + stochasticSoilModel.AddRange(Enumerable.Empty(), "some/path"); - var context = new StochasticSoilModelCollectionContext(failureMechanism.StochasticSoilModels, failureMechanism, assessmentSection); + var context = new StochasticSoilModelCollectionContext(stochasticSoilModel, failureMechanism, assessmentSection); // Call bool isEnabled = updateInfo.IsEnabled(context);