Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs =================================================================== diff -u -r8536b5bd3d91298dc866db708d7c75ae10fc84de -rbe728a02e74f50b29c4b3dfcbefa2642badfc6ce --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 8536b5bd3d91298dc866db708d7c75ae10fc84de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision be728a02e74f50b29c4b3dfcbefa2642badfc6ce) @@ -168,6 +168,8 @@ if (!targetCalculationHasOutput && !sourceCalculationHasOutput || targetCalculationHasOutput && !sourceCalculationHasOutput + || targetCalculationHasOutput && !targetCalculation.Output.HasGeneralResult && !sourceCalculation.Output.HasGeneralResult + || targetCalculationHasOutput && targetCalculation.Output.HasGeneralResult && sourceCalculation.Output.HasGeneralResult || targetCalculationHasOutput && targetCalculation.Output.HasGeneralResult && !sourceCalculation.Output.HasGeneralResult) { return false; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs =================================================================== diff -u -r8536b5bd3d91298dc866db708d7c75ae10fc84de -rbe728a02e74f50b29c4b3dfcbefa2642badfc6ce --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 8536b5bd3d91298dc866db708d7c75ae10fc84de) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision be728a02e74f50b29c4b3dfcbefa2642badfc6ce) @@ -528,6 +528,49 @@ [Test] [TestCaseSource(nameof(GetCalculationsFuncs))] + public void GivenAssessmentSectionWithHydraulicBoundaryLocationCalculations_WhenBothAssessmentSectionsHaveOutput_ThenCalculationsNotChanged( + Func> getCalculationsFunc) + { + // Given + var mocks = new MockRepository(); + var viewCommands = mocks.Stub(); + mocks.ReplayAll(); + + HydraulicBoundaryLocation[] locations = + { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + AssessmentSection targetAssessmentSection = CreateAssessmentSection(locations); + AssessmentSection sourceAssessmentSection = CreateAssessmentSection(locations); + + IEnumerable targetCalculations = getCalculationsFunc(targetAssessmentSection); + IEnumerable sourceCalculations = getCalculationsFunc(sourceAssessmentSection); + + SetOutput(targetCalculations); + SetOutput(sourceCalculations); + sourceCalculations.ForEachElementDo(c => c.InputParameters.ShouldIllustrationPointsBeCalculated = true); + + var handler = new AssessmentSectionMergeHandler(viewCommands); + + // Precondition + Assert.IsTrue(targetCalculations.All(c => c.HasOutput)); + Assert.IsTrue(sourceCalculations.All(c => c.HasOutput)); + Assert.IsTrue(targetCalculations.All(c => !c.InputParameters.ShouldIllustrationPointsBeCalculated)); + + // When + handler.PerformMerge(targetAssessmentSection, sourceAssessmentSection, Enumerable.Empty()); + + // Then + Assert.IsTrue(targetCalculations.All(c => c.HasOutput)); + Assert.IsTrue(sourceCalculations.All(c => c.HasOutput)); + Assert.IsTrue(targetCalculations.All(c => !c.InputParameters.ShouldIllustrationPointsBeCalculated)); + mocks.VerifyAll(); + } + + [Test] + [TestCaseSource(nameof(GetCalculationsFuncs))] public void GivenAssessmentSectionWithHydraulicBoundaryLocationCalculations_WhenSourceAssessmentSectionHasOutput_ThenCalculationDataMerged( Func> getCalculationsFunc) { @@ -656,6 +699,49 @@ [Test] [TestCaseSource(nameof(GetCalculationsFuncs))] + public void GivenAssessmentSectionWithHydraulicBoundaryLocationCalculations_WhenBothAssessmentSectionsHaveOutputAndIllustrationPoints_ThenCalculationsNotChanged( + Func> getCalculationsFunc) + { + // Given + var mocks = new MockRepository(); + var viewCommands = mocks.Stub(); + mocks.ReplayAll(); + + HydraulicBoundaryLocation[] locations = + { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + AssessmentSection targetAssessmentSection = CreateAssessmentSection(locations); + AssessmentSection sourceAssessmentSection = CreateAssessmentSection(locations); + + IEnumerable targetCalculations = getCalculationsFunc(targetAssessmentSection); + IEnumerable sourceCalculations = getCalculationsFunc(sourceAssessmentSection); + + SetOutput(targetCalculations, true); + SetOutput(sourceCalculations, true); + sourceCalculations.ForEachElementDo(c => c.InputParameters.ShouldIllustrationPointsBeCalculated = true); + + var handler = new AssessmentSectionMergeHandler(viewCommands); + + // Precondition + Assert.IsTrue(targetCalculations.All(c => c.HasOutput)); + Assert.IsTrue(sourceCalculations.All(c => c.HasOutput)); + Assert.IsTrue(targetCalculations.All(c => !c.InputParameters.ShouldIllustrationPointsBeCalculated)); + + // When + handler.PerformMerge(targetAssessmentSection, sourceAssessmentSection, Enumerable.Empty()); + + // Then + Assert.IsTrue(targetCalculations.All(c => c.HasOutput)); + Assert.IsTrue(sourceCalculations.All(c => c.HasOutput)); + Assert.IsTrue(targetCalculations.All(c => !c.InputParameters.ShouldIllustrationPointsBeCalculated)); + mocks.VerifyAll(); + } + + [Test] + [TestCaseSource(nameof(GetCalculationsFuncs))] public void PerformMerge_HydraulicBoundaryLocationCalculationsMerged_ObserversNotified( Func> getCalculationsFunc) {