Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs
===================================================================
diff -u -r4c958ce7ec9ae0247146de8bf83b5495a6ac2ec0 -r7c6b0a809f0c14f6192e9518a92192bf59aafd15
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 4c958ce7ec9ae0247146de8bf83b5495a6ac2ec0)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 7c6b0a809f0c14f6192e9518a92192bf59aafd15)
@@ -37,6 +37,7 @@
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.HeightStructures.Data;
using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Data.Merge;
using Ringtoets.Integration.Data.StandAlone;
using Ringtoets.Integration.Plugin.Properties;
using Ringtoets.MacroStabilityInwards.Data;
@@ -105,6 +106,16 @@
AfterMerge(changedObjects);
}
+ public void PerformMerge(AssessmentSection targetAssessmentSection, AssessmentSectionMergeData mergeData)
+ {
+ if (mergeData == null)
+ {
+ throw new ArgumentNullException(nameof(mergeData));
+ }
+
+ PerformMerge(targetAssessmentSection, mergeData.AssessmentSection, mergeData.FailureMechanisms);
+ }
+
private void BeforeMerge(AssessmentSection assessmentSection)
{
viewCommands.RemoveAllViewsForItem(assessmentSection);
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs
===================================================================
diff -u -r1604f9968c87181d6e94d89b287fc8dd5a85854b -r7c6b0a809f0c14f6192e9518a92192bf59aafd15
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs (.../IAssessmentSectionMergeHandler.cs) (revision 1604f9968c87181d6e94d89b287fc8dd5a85854b)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/IAssessmentSectionMergeHandler.cs (.../IAssessmentSectionMergeHandler.cs) (revision 7c6b0a809f0c14f6192e9518a92192bf59aafd15)
@@ -23,6 +23,7 @@
using System.Collections.Generic;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Data.Merge;
namespace Ringtoets.Integration.Plugin.Merge
{
@@ -40,5 +41,13 @@
/// Thrown when any parameter is null.
void PerformMerge(AssessmentSection targetAssessmentSection, AssessmentSection sourceAssessmentSection,
IEnumerable failureMechanismsToMerge);
+
+ ///
+ /// Performs the merge.
+ ///
+ /// The assessment section to merge to.
+ /// The data to merge.
+ /// Thrown when any parameter is null.
+ void PerformMerge(AssessmentSection targetAssessmentSection, AssessmentSectionMergeData mergeData);
}
}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs
===================================================================
diff -u -r4c958ce7ec9ae0247146de8bf83b5495a6ac2ec0 -r7c6b0a809f0c14f6192e9518a92192bf59aafd15
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 4c958ce7ec9ae0247146de8bf83b5495a6ac2ec0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 7c6b0a809f0c14f6192e9518a92192bf59aafd15)
@@ -40,6 +40,7 @@
using Ringtoets.GrassCoverErosionOutwards.Data.TestUtil;
using Ringtoets.HeightStructures.Data;
using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Data.Merge;
using Ringtoets.Integration.Plugin.Merge;
using Ringtoets.MacroStabilityInwards.Data;
using Ringtoets.Piping.Data;
@@ -141,6 +142,24 @@
}
[Test]
+ public void PerformMerge_MergeDataNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var viewCommands = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var handler = new AssessmentSectionMergeHandler(viewCommands);
+
+ // Call
+ TestDelegate call = () => handler.PerformMerge(new AssessmentSection(AssessmentSectionComposition.Dike), null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("mergeData", exception.ParamName);
+ }
+
+ [Test]
public void PerformMerge_WithAllData_AllViewsForTargetAssessmentSectionClosed()
{
// Setup