Index: Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs =================================================================== diff -u -rdcf38b56892032a9330058f71a7778bb550b0d30 -r1bcc783d2896788b05cd13e7c2aa500ddcae8826 --- Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision dcf38b56892032a9330058f71a7778bb550b0d30) +++ Riskeer/ClosingStructures/test/Riskeer.ClosingStructures.Service.Test/ClosingStructureDataSynchronizationServiceTest.cs (.../ClosingStructureDataSynchronizationServiceTest.cs) (revision 1bcc783d2896788b05cd13e7c2aa500ddcae8826) @@ -284,7 +284,7 @@ var exception = Assert.Throws(Call); Assert.AreEqual("failureMechanism", exception.ParamName); } - + [Test] public void ClearAllCalculationOutputAndHydraulicBoundaryLocations_HydraulicBoundaryLocationsNull_ThrowsArgumentNullException() { @@ -518,66 +518,169 @@ new Point2D(2, 0), new Point2D(4, 0) }); - var structure1 = new TestClosingStructure(new Point2D(1, 0), "structure1"); - var structure2 = new TestClosingStructure(new Point2D(3, 0), "structure2"); + var structure1 = new TestClosingStructure(new Point2D(1, 0), "Id 1,0"); + var structure2 = new TestClosingStructure(new Point2D(3, 0), "Id 3,0"); var profile = new TestForeshoreProfile(); - StructuresCalculation calculation1 = new TestClosingStructuresCalculationScenario + + var failureMechanism = new ClosingStructuresFailureMechanism(); + failureMechanism.ForeshoreProfiles.AddRange(new[] { + profile + }, "path"); + + failureMechanism.ClosingStructures.AddRange(new[] + { + structure1, + structure2 + }, "someLocation"); + + FailureMechanismTestHelper.SetSections(failureMechanism, new[] + { + section1, + section2 + }); + + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + + var calculation = new StructuresCalculationScenario + { InputParameters = { - ForeshoreProfile = profile, Structure = structure1 + } + }; + var calculationWithOutput = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1 }, Output = new TestStructuresOutput() }; - StructuresCalculation calculation2 = new TestClosingStructuresCalculationScenario + var calculationWithOutputAndHydraulicBoundaryLocation = new StructuresCalculationScenario { InputParameters = { - ForeshoreProfile = profile, + Structure = structure2, + HydraulicBoundaryLocation = hydraulicBoundaryLocation + }, + Output = new TestStructuresOutput() + }; + var calculationWithHydraulicBoundaryLocation = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1, + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + var calculationWithHydraulicBoundaryLocationAndForeshoreProfile = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure2, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ForeshoreProfile = profile + } + }; + var calculationWithForeshoreProfile = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1, + ForeshoreProfile = profile + } + }; + var calculationWithOutputHydraulicBoundaryLocationAndForeshoreProfile = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ForeshoreProfile = profile + }, + Output = new TestStructuresOutput() + }; + + var subCalculation = new StructuresCalculationScenario + { + InputParameters = + { Structure = structure2 } }; - StructuresCalculation calculation3 = new TestClosingStructuresCalculationScenario + var subCalculationWithOutput = new StructuresCalculationScenario { InputParameters = { - ForeshoreProfile = profile, - Structure = structure1 + Structure = structure2 + }, + Output = new TestStructuresOutput() + }; + var subCalculationWithOutputAndHydraulicBoundaryLocation = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1, + HydraulicBoundaryLocation = hydraulicBoundaryLocation + }, + Output = new TestStructuresOutput() + }; + var subCalculationWithHydraulicBoundaryLocation = new StructuresCalculationScenario + { + InputParameters = + { + Structure = structure1, + HydraulicBoundaryLocation = hydraulicBoundaryLocation } }; - var failureMechanism = new ClosingStructuresFailureMechanism + var subCalculationWithHydraulicBoundaryLocationAndForeshoreProfile = new StructuresCalculationScenario { - CalculationsGroup = + InputParameters = { - Children = - { - calculation1, - new CalculationGroup - { - Children = - { - calculation2 - } - }, - calculation3 - } + Structure = structure1, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ForeshoreProfile = profile } }; - failureMechanism.ClosingStructures.AddRange(new[] + var subCalculationWithForeshoreProfile = new StructuresCalculationScenario { - structure1, - structure2 - }, "some path"); - failureMechanism.ForeshoreProfiles.AddRange(new[] + InputParameters = + { + Structure = structure2, + ForeshoreProfile = profile + } + }; + var subCalculationWithOutputHydraulicBoundaryLocationAndForeshoreProfile = new StructuresCalculationScenario { - profile - }, "path"); + InputParameters = + { + Structure = structure2, + HydraulicBoundaryLocation = hydraulicBoundaryLocation, + ForeshoreProfile = profile + }, + Output = new TestStructuresOutput() + }; - FailureMechanismTestHelper.SetSections(failureMechanism, new[] + failureMechanism.CalculationsGroup.Children.Add(calculation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutput); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutputAndHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithHydraulicBoundaryLocation); + failureMechanism.CalculationsGroup.Children.Add(calculationWithForeshoreProfile); + failureMechanism.CalculationsGroup.Children.Add(calculationWithHydraulicBoundaryLocationAndForeshoreProfile); + failureMechanism.CalculationsGroup.Children.Add(calculationWithOutputHydraulicBoundaryLocationAndForeshoreProfile); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup { - section1, - section2 + Children = + { + subCalculation, + subCalculationWithOutput, + subCalculationWithOutputAndHydraulicBoundaryLocation, + subCalculationWithHydraulicBoundaryLocation, + subCalculationWithForeshoreProfile, + subCalculationWithHydraulicBoundaryLocationAndForeshoreProfile, + subCalculationWithOutputHydraulicBoundaryLocationAndForeshoreProfile + } }); return failureMechanism;