Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs =================================================================== diff -u -rdceae551e9b21a93bac21265e8957638af348f19 -r34a8d508dfd3fcd7e454be401023067f6620926a --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision dceae551e9b21a93bac21265e8957638af348f19) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Merge/AssessmentSectionMergeHandler.cs (.../AssessmentSectionMergeHandler.cs) (revision 34a8d508dfd3fcd7e454be401023067f6620926a) @@ -95,7 +95,8 @@ bool sourceCalculationHasOutput = sourceCalculation.HasOutput; if (!targetCalculationHasOutput && !sourceCalculationHasOutput - || targetCalculationHasOutput && !sourceCalculationHasOutput) + || targetCalculationHasOutput && !sourceCalculationHasOutput + || targetCalculationHasOutput && targetCalculation.Output.HasGeneralResult && !sourceCalculation.Output.HasGeneralResult) { return false; } Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs =================================================================== diff -u -rdceae551e9b21a93bac21265e8957638af348f19 -r34a8d508dfd3fcd7e454be401023067f6620926a --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision dceae551e9b21a93bac21265e8957638af348f19) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Merge/AssessmentSectionMergeHandlerTest.cs (.../AssessmentSectionMergeHandlerTest.cs) (revision 34a8d508dfd3fcd7e454be401023067f6620926a) @@ -220,6 +220,96 @@ mocks.VerifyAll(); } + [Test] + public void GivenAssessmentSectionWithHydraulicBoundaryLocationCalculations_WhenTargetAssessmentSectionHasOutputWithIllustrationPoints_ThenCalculationsNotChanged() + { + // Setup + var mocks = new MockRepository(); + var viewCommands = mocks.Stub(); + mocks.ReplayAll(); + + var locations = new[] + { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + AssessmentSection targetAssessmentSection = CreateAssessmentSection(locations); + AssessmentSection sourceAssessmentSection = CreateAssessmentSection(locations); + + foreach (HydraulicBoundaryLocationCalculation calculation in targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm) + { + calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint()); + } + + foreach (HydraulicBoundaryLocationCalculation calculation in sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm) + { + calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(); + } + + var handler = new AssessmentSectionMergeHandler(viewCommands); + + // Precondition + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.Output.HasGeneralResult)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => !c.Output.HasGeneralResult)); + + // Call + handler.PerformMerge(targetAssessmentSection, sourceAssessmentSection, Enumerable.Empty()); + + // Assert + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.Output.HasGeneralResult)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => !c.Output.HasGeneralResult)); + mocks.VerifyAll(); + } + + [Test] + public void GivenAssessmentSectionWithHydraulicBoundaryLocationCalculations_WhenSourceAssessmentSectionHasOutputWithIllustrationPoints_ThenCalculationsMerged() + { + // Setup + var mocks = new MockRepository(); + var viewCommands = mocks.Stub(); + mocks.ReplayAll(); + + var locations = new[] + { + new TestHydraulicBoundaryLocation(), + new TestHydraulicBoundaryLocation() + }; + + AssessmentSection targetAssessmentSection = CreateAssessmentSection(locations); + AssessmentSection sourceAssessmentSection = CreateAssessmentSection(locations); + + foreach (HydraulicBoundaryLocationCalculation calculation in targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm) + { + calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(); + } + + foreach (HydraulicBoundaryLocationCalculation calculation in sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm) + { + calculation.Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint()); + } + + var handler = new AssessmentSectionMergeHandler(viewCommands); + + // Precondition + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => !c.Output.HasGeneralResult)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(sourceAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.Output.HasGeneralResult)); + + // Call + handler.PerformMerge(targetAssessmentSection, sourceAssessmentSection, Enumerable.Empty()); + + // Assert + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.HasOutput)); + Assert.IsTrue(targetAssessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm.All(c => c.Output.HasGeneralResult)); + mocks.VerifyAll(); + } + private static AssessmentSection CreateAssessmentSection(TestHydraulicBoundaryLocation[] locations) { var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);