Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs =================================================================== diff -u -r4d756fd114602a04d8c2149bc2d3b024fa199be5 -r342dca79b04065042348d6a156edfd2766159613 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 4d756fd114602a04d8c2149bc2d3b024fa199be5) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 342dca79b04065042348d6a156edfd2766159613) @@ -77,11 +77,9 @@ var observerMock = mocks.StrictMock(); observerMock.Expect(o => o.UpdateObserver()); - mocks.ReplayAll(); var command = new AddNewDemoAssessmentSectionCommand(projectOwnerStub); - project.Attach(observerMock); // Call @@ -93,162 +91,22 @@ Assert.AreEqual("Demo traject", demoAssessmentSection.Name); Assert.AreEqual("6-3", demoAssessmentSection.Id); - Assert.IsNotEmpty(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath); - Assert.IsTrue(File.Exists(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath)); - Assert.IsTrue(File.Exists(Path.Combine(Path.GetDirectoryName(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath), "HLCD.sqlite"))); - var hydraulicBoundaryLocations = demoAssessmentSection.HydraulicBoundaryDatabase.Locations.ToArray(); - Assert.AreEqual(18, hydraulicBoundaryLocations.Length); - AssertDesignWaterLevelValuesOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); - AssertDesignWaterLevelCalculationConvergenceOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); - AssertWaveHeightValuesOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); - AssertWaveHeightCalculationConvergenceOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); + AssertHydraulicBoundaryDatabase(demoAssessmentSection); - Assert.AreEqual(demoAssessmentSection.GrassCoverErosionOutwards.GrassCoverErosionOutwardsHydraulicBoundaryLocations.Count, hydraulicBoundaryLocations.Length); - Assert.AreEqual(2380, demoAssessmentSection.ReferenceLine.Points.Count()); - var soilModels = demoAssessmentSection.PipingFailureMechanism.StochasticSoilModels.ToArray(); - Assert.AreEqual(4, soilModels.Length); - var surfaceLines = demoAssessmentSection.PipingFailureMechanism.SurfaceLines.ToArray(); - Assert.AreEqual(4, surfaceLines.Length); - AssertCharacteristicPointsOnSurfaceLines(surfaceLines); - - Assert.AreEqual(1, demoAssessmentSection.PipingFailureMechanism.CalculationsGroup.Children.Count); - PipingCalculationScenario pipingCalculationScenario = demoAssessmentSection.PipingFailureMechanism - .CalculationsGroup.GetCalculations() - .OfType() - .First(); - AssertCalculationAbleToCalculate(pipingCalculationScenario); - AssertCalculationInFailureMechanismSectionResult( - pipingCalculationScenario, - demoAssessmentSection.PipingFailureMechanism.SectionResults.ToArray(), - demoAssessmentSection.PipingFailureMechanism.Calculations.OfType()); - - Assert.AreEqual(1, demoAssessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Count); - GrassCoverErosionInwardsCalculation grassCoverErosionInwardsCalculation = demoAssessmentSection.GrassCoverErosionInwards - .CalculationsGroup.GetCalculations() - .OfType() - .First(); - AssertExpectedGrassCoverErosionInwardsInput(grassCoverErosionInwardsCalculation.InputParameters); - - Assert.AreEqual(1, demoAssessmentSection.HeightStructures.CalculationsGroup.Children.Count); - HeightStructuresCalculation heightStructuresCalculation = demoAssessmentSection.HeightStructures - .CalculationsGroup.GetCalculations() - .OfType() - .First(); - AssertExpectedHeightStructuresInput(heightStructuresCalculation.InputParameters); - foreach (var failureMechanism in demoAssessmentSection.GetFailureMechanisms()) { Assert.AreEqual(283, failureMechanism.Sections.Count()); } - AssertDesignWaterLevelValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(demoAssessmentSection.GrassCoverErosionOutwards.GrassCoverErosionOutwardsHydraulicBoundaryLocations.ToArray()); - AssertDesignWaterLevelConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(hydraulicBoundaryLocations); + AssertGrassCoverErosionInwardsFailureMechanism(demoAssessmentSection); + AssertGrassCoverErosionOutwardsFailureMechanism(demoAssessmentSection); + AssertHeightStructuresFailureMechanism(demoAssessmentSection); + AssertPipingFailureMechanism(demoAssessmentSection); mocks.VerifyAll(); } - private static void AssertCalculationInFailureMechanismSectionResult(PipingCalculationScenario calculation, PipingFailureMechanismSectionResult[] sectionResults, IEnumerable calculations) - { - Assert.AreEqual(283, sectionResults.Length); - var sectionResultWithCalculation = sectionResults[22]; - - CollectionAssert.AreEqual(new[] - { - calculation - }, sectionResultWithCalculation.GetCalculationScenarios(calculations)); - } - - private static void AssertDesignWaterLevelValuesOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) - { - Assert.AreEqual((RoundedDouble) 5.78, locations[0].DesignWaterLevel, locations[0].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.77, locations[1].DesignWaterLevel, locations[1].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.77, locations[2].DesignWaterLevel, locations[2].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.77, locations[3].DesignWaterLevel, locations[3].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.77, locations[4].DesignWaterLevel, locations[4].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[5].DesignWaterLevel, locations[5].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[6].DesignWaterLevel, locations[6].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[7].DesignWaterLevel, locations[7].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[8].DesignWaterLevel, locations[8].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[9].DesignWaterLevel, locations[9].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[10].DesignWaterLevel, locations[10].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[11].DesignWaterLevel, locations[11].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[12].DesignWaterLevel, locations[12].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[13].DesignWaterLevel, locations[13].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.93, locations[14].DesignWaterLevel, locations[14].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.54, locations[15].DesignWaterLevel, locations[15].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 5.86, locations[16].DesignWaterLevel, locations[16].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 6.0, locations[17].DesignWaterLevel, locations[17].DesignWaterLevel.GetAccuracy()); - } - - private static void AssertDesignWaterLevelCalculationConvergenceOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) - { - foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) - { - Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); - } - } - - private static void AssertWaveHeightValuesOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) - { - Assert.AreEqual((RoundedDouble) 4.13374, locations[0].WaveHeight, locations[0].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.19044, locations[1].WaveHeight, locations[1].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.01717, locations[2].WaveHeight, locations[2].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.87408, locations[3].WaveHeight, locations[3].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.73281, locations[4].WaveHeight, locations[4].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 2.65268, locations[5].WaveHeight, locations[5].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.04333, locations[6].WaveHeight, locations[6].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.19952, locations[7].WaveHeight, locations[7].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.3554, locations[8].WaveHeight, locations[8].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.52929, locations[9].WaveHeight, locations[9].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.62194, locations[10].WaveHeight, locations[10].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.6851, locations[11].WaveHeight, locations[11].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.72909, locations[12].WaveHeight, locations[12].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.74794, locations[13].WaveHeight, locations[13].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 3.29686, locations[14].WaveHeight, locations[14].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 9.57558, locations[15].WaveHeight, locations[15].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 8.01959, locations[16].WaveHeight, locations[16].WaveHeight.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.11447, locations[17].WaveHeight, locations[17].WaveHeight.GetAccuracy()); - } - - private static void AssertWaveHeightCalculationConvergenceOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) - { - foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) - { - Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); - } - } - - private static void AssertDesignWaterLevelValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(GrassCoverErosionOutwardsHydraulicBoundaryLocation[] locations) - { - Assert.AreEqual((RoundedDouble) 4.54, locations[0].DesignWaterLevel, locations[0].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.54, locations[1].DesignWaterLevel, locations[1].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.54, locations[2].DesignWaterLevel, locations[2].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.53, locations[3].DesignWaterLevel, locations[3].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.53, locations[4].DesignWaterLevel, locations[4].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.66, locations[5].DesignWaterLevel, locations[5].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.66, locations[6].DesignWaterLevel, locations[6].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[7].DesignWaterLevel, locations[7].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[8].DesignWaterLevel, locations[8].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[9].DesignWaterLevel, locations[9].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[10].DesignWaterLevel, locations[10].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[11].DesignWaterLevel, locations[11].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[12].DesignWaterLevel, locations[12].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[13].DesignWaterLevel, locations[13].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.65, locations[14].DesignWaterLevel, locations[14].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.34, locations[15].DesignWaterLevel, locations[15].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.44, locations[16].DesignWaterLevel, locations[16].DesignWaterLevel.GetAccuracy()); - Assert.AreEqual((RoundedDouble) 4.48, locations[17].DesignWaterLevel, locations[17].DesignWaterLevel.GetAccuracy()); - } - - private static void AssertDesignWaterLevelConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) - { - foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) - { - Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); - } - } - private static void AssertCharacteristicPointsOnSurfaceLines(RingtoetsPipingSurfaceLine[] surfaceLines) { var surfaceLine1 = surfaceLines.FirstOrDefault(s => s.Name == "PK001_0001"); @@ -290,21 +148,33 @@ Assert.AreEqual(new Point3D(154586.088, 568119.17, -4), surfaceLine4.DikeToeAtRiver); } - private static void AssertCalculationAbleToCalculate(PipingCalculationScenario calculation) + private static double GetAccuracy(IDistribution distribution) { - PipingInput inputParameters = calculation.InputParameters; - AssertExpectedPipingInput(inputParameters); + return Math.Pow(10.0, -distribution.Mean.NumberOfDecimalPlaces); + } - Assert.IsTrue(PipingCalculationService.Validate(calculation)); + #region FailureMechanisms - PipingCalculationService.Calculate(calculation); - Assert.IsTrue(calculation.HasOutput); - Assert.AreEqual(0.568, calculation.Output.HeaveFactorOfSafety, 1e-3); - Assert.AreEqual(-0.228, calculation.Output.HeaveZValue, 1e-3); - Assert.AreEqual(1.484, calculation.Output.UpliftFactorOfSafety, 1e-3); - Assert.AreEqual(1.499, calculation.Output.UpliftZValue, 1e-3); - Assert.AreEqual(0.432, calculation.Output.SellmeijerFactorOfSafety, 1e-3); - Assert.AreEqual(-1.514, calculation.Output.SellmeijerZValue, 1e-3); + #region PipingFailureMechanism + + private static void AssertPipingFailureMechanism(AssessmentSection demoAssessmentSection) + { + var soilModels = demoAssessmentSection.PipingFailureMechanism.StochasticSoilModels.ToArray(); + Assert.AreEqual(4, soilModels.Length); + var surfaceLines = demoAssessmentSection.PipingFailureMechanism.SurfaceLines.ToArray(); + Assert.AreEqual(4, surfaceLines.Length); + AssertCharacteristicPointsOnSurfaceLines(surfaceLines); + + Assert.AreEqual(1, demoAssessmentSection.PipingFailureMechanism.CalculationsGroup.Children.Count); + PipingCalculationScenario pipingCalculationScenario = demoAssessmentSection.PipingFailureMechanism + .CalculationsGroup.GetCalculations() + .OfType() + .First(); + AssertCalculationAbleToCalculate(pipingCalculationScenario); + AssertCalculationInFailureMechanismSectionResult( + pipingCalculationScenario, + demoAssessmentSection.PipingFailureMechanism.SectionResults.ToArray(), + demoAssessmentSection.PipingFailureMechanism.Calculations.OfType()); } private static void AssertExpectedPipingInput(PipingInput inputParameters) @@ -349,19 +219,230 @@ GetAccuracy(inputParameters.DampingFactorExit)); } - private static void AssertExpectedGrassCoverErosionInwardsInput(GrassCoverErosionInwardsInput inputParameters) + private static void AssertCalculationAbleToCalculate(PipingCalculationScenario calculation) { - Assert.AreEqual(1300001, inputParameters.HydraulicBoundaryLocation.Id); + PipingInput inputParameters = calculation.InputParameters; + AssertExpectedPipingInput(inputParameters); + + Assert.IsTrue(PipingCalculationService.Validate(calculation)); + + PipingCalculationService.Calculate(calculation); + Assert.IsTrue(calculation.HasOutput); + Assert.AreEqual(0.568, calculation.Output.HeaveFactorOfSafety, 1e-3); + Assert.AreEqual(-0.228, calculation.Output.HeaveZValue, 1e-3); + Assert.AreEqual(1.484, calculation.Output.UpliftFactorOfSafety, 1e-3); + Assert.AreEqual(1.499, calculation.Output.UpliftZValue, 1e-3); + Assert.AreEqual(0.432, calculation.Output.SellmeijerFactorOfSafety, 1e-3); + Assert.AreEqual(-1.514, calculation.Output.SellmeijerZValue, 1e-3); } + private static void AssertCalculationInFailureMechanismSectionResult(PipingCalculationScenario calculation, PipingFailureMechanismSectionResult[] sectionResults, IEnumerable calculations) + { + Assert.AreEqual(283, sectionResults.Length); + var sectionResultWithCalculation = sectionResults[22]; + + CollectionAssert.AreEqual(new[] + { + calculation + }, sectionResultWithCalculation.GetCalculationScenarios(calculations)); + } + + #endregion + + #region HeightStructuresFailureMechanism + + private static void AssertHeightStructuresFailureMechanism(AssessmentSection demoAssessmentSection) + { + Assert.AreEqual(1, demoAssessmentSection.HeightStructures.CalculationsGroup.Children.Count); + HeightStructuresCalculation heightStructuresCalculation = demoAssessmentSection.HeightStructures + .CalculationsGroup.GetCalculations() + .OfType() + .First(); + AssertExpectedHeightStructuresInput(heightStructuresCalculation.InputParameters); + } + private static void AssertExpectedHeightStructuresInput(HeightStructuresInput inputParameters) { Assert.AreEqual(1300001, inputParameters.HydraulicBoundaryLocation.Id); } - private static double GetAccuracy(IDistribution distribution) + #endregion + + #region GrassCoverErosionInwardsFailureMechanism + + private static void AssertGrassCoverErosionInwardsFailureMechanism(AssessmentSection demoAssessmentSection) { - return Math.Pow(10.0, -distribution.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(1, demoAssessmentSection.GrassCoverErosionInwards.CalculationsGroup.Children.Count); + GrassCoverErosionInwardsCalculation grassCoverErosionInwardsCalculation = demoAssessmentSection.GrassCoverErosionInwards + .CalculationsGroup.GetCalculations() + .OfType() + .First(); + AssertExpectedGrassCoverErosionInwardsInput(grassCoverErosionInwardsCalculation.InputParameters); } + + private static void AssertExpectedGrassCoverErosionInwardsInput(GrassCoverErosionInwardsInput inputParameters) + { + Assert.AreEqual(1300001, inputParameters.HydraulicBoundaryLocation.Id); + } + + #endregion + + #region GrassCoverErosionOutwardsFailureMechanism + + private static void AssertGrassCoverErosionOutwardsFailureMechanism(AssessmentSection demoAssessmentSection) + { + HydraulicBoundaryLocation[] hydraulicBoundaryLocations = demoAssessmentSection.HydraulicBoundaryDatabase.Locations.ToArray(); + + Assert.AreEqual(demoAssessmentSection.GrassCoverErosionOutwards.GrassCoverErosionOutwardsHydraulicBoundaryLocations.Count, hydraulicBoundaryLocations.Length); + + AssertDesignWaterLevelValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(demoAssessmentSection.GrassCoverErosionOutwards.GrassCoverErosionOutwardsHydraulicBoundaryLocations.ToArray()); + AssertDesignWaterLevelConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(hydraulicBoundaryLocations); + + AssertWaveHeightValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(demoAssessmentSection.GrassCoverErosionOutwards.GrassCoverErosionOutwardsHydraulicBoundaryLocations.ToArray()); + AssertWaveHeightConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(hydraulicBoundaryLocations); + } + + private static void AssertDesignWaterLevelValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(GrassCoverErosionOutwardsHydraulicBoundaryLocation[] locations) + { + Assert.AreEqual((RoundedDouble) 4.54, locations[0].DesignWaterLevel, locations[0].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.54, locations[1].DesignWaterLevel, locations[1].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.54, locations[2].DesignWaterLevel, locations[2].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.53, locations[3].DesignWaterLevel, locations[3].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.53, locations[4].DesignWaterLevel, locations[4].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.66, locations[5].DesignWaterLevel, locations[5].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.66, locations[6].DesignWaterLevel, locations[6].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[7].DesignWaterLevel, locations[7].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[8].DesignWaterLevel, locations[8].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[9].DesignWaterLevel, locations[9].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[10].DesignWaterLevel, locations[10].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[11].DesignWaterLevel, locations[11].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[12].DesignWaterLevel, locations[12].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[13].DesignWaterLevel, locations[13].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.65, locations[14].DesignWaterLevel, locations[14].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.34, locations[15].DesignWaterLevel, locations[15].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.44, locations[16].DesignWaterLevel, locations[16].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.48, locations[17].DesignWaterLevel, locations[17].DesignWaterLevel.GetAccuracy()); + } + + private static void AssertDesignWaterLevelConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) + { + Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.DesignWaterLevelCalculationConvergence); + } + } + + private static void AssertWaveHeightValuesOnGrassCoverErosionOutwardsHydraulicBoundaryLocation(GrassCoverErosionOutwardsHydraulicBoundaryLocation[] locations) + { + Assert.AreEqual((RoundedDouble) 3.31, locations[0].WaveHeight, locations[0].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.36, locations[1].WaveHeight, locations[1].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.20, locations[2].WaveHeight, locations[2].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.06, locations[3].WaveHeight, locations[3].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.92, locations[4].WaveHeight, locations[4].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.01, locations[5].WaveHeight, locations[5].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.29, locations[6].WaveHeight, locations[6].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.42, locations[7].WaveHeight, locations[7].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.52, locations[8].WaveHeight, locations[8].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.65, locations[9].WaveHeight, locations[9].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.73, locations[10].WaveHeight, locations[10].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.79, locations[11].WaveHeight, locations[11].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.82, locations[12].WaveHeight, locations[12].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.82, locations[13].WaveHeight, locations[13].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.47, locations[14].WaveHeight, locations[14].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 7.84, locations[15].WaveHeight, locations[15].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 6.72, locations[16].WaveHeight, locations[16].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.06, locations[17].WaveHeight, locations[17].WaveHeight.GetAccuracy()); + } + + private static void AssertWaveHeightConvergenceOnGrassCoverErosionOutwardsHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) + { + Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); + } + } + + #endregion + + #endregion + + #region HydraulicBoundaryDatabase + + private static void AssertHydraulicBoundaryDatabase(AssessmentSection demoAssessmentSection) + { + Assert.IsNotEmpty(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath); + Assert.IsTrue(File.Exists(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath)); + var directoryName = Path.GetDirectoryName(demoAssessmentSection.HydraulicBoundaryDatabase.FilePath); + Assert.IsNotNull(directoryName); + Assert.IsTrue(File.Exists(Path.Combine(directoryName, "HLCD.sqlite"))); + var hydraulicBoundaryLocations = demoAssessmentSection.HydraulicBoundaryDatabase.Locations.ToArray(); + Assert.AreEqual(18, hydraulicBoundaryLocations.Length); + AssertDesignWaterLevelValuesOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); + AssertDesignWaterLevelCalculationConvergenceOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); + AssertWaveHeightValuesOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); + AssertWaveHeightCalculationConvergenceOnHydraulicBoundaryLocations(hydraulicBoundaryLocations); + } + + private static void AssertDesignWaterLevelValuesOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + Assert.AreEqual((RoundedDouble) 5.78, locations[0].DesignWaterLevel, locations[0].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.77, locations[1].DesignWaterLevel, locations[1].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.77, locations[2].DesignWaterLevel, locations[2].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.77, locations[3].DesignWaterLevel, locations[3].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.77, locations[4].DesignWaterLevel, locations[4].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[5].DesignWaterLevel, locations[5].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[6].DesignWaterLevel, locations[6].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[7].DesignWaterLevel, locations[7].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[8].DesignWaterLevel, locations[8].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[9].DesignWaterLevel, locations[9].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[10].DesignWaterLevel, locations[10].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[11].DesignWaterLevel, locations[11].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[12].DesignWaterLevel, locations[12].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[13].DesignWaterLevel, locations[13].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.93, locations[14].DesignWaterLevel, locations[14].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.54, locations[15].DesignWaterLevel, locations[15].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 5.86, locations[16].DesignWaterLevel, locations[16].DesignWaterLevel.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 6.0, locations[17].DesignWaterLevel, locations[17].DesignWaterLevel.GetAccuracy()); + } + + private static void AssertDesignWaterLevelCalculationConvergenceOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) + { + Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); + } + } + + private static void AssertWaveHeightValuesOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + Assert.AreEqual((RoundedDouble) 4.13374, locations[0].WaveHeight, locations[0].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.19044, locations[1].WaveHeight, locations[1].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.01717, locations[2].WaveHeight, locations[2].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.87408, locations[3].WaveHeight, locations[3].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.73281, locations[4].WaveHeight, locations[4].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 2.65268, locations[5].WaveHeight, locations[5].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.04333, locations[6].WaveHeight, locations[6].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.19952, locations[7].WaveHeight, locations[7].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.3554, locations[8].WaveHeight, locations[8].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.52929, locations[9].WaveHeight, locations[9].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.62194, locations[10].WaveHeight, locations[10].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.6851, locations[11].WaveHeight, locations[11].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.72909, locations[12].WaveHeight, locations[12].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.74794, locations[13].WaveHeight, locations[13].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 3.29686, locations[14].WaveHeight, locations[14].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 9.57558, locations[15].WaveHeight, locations[15].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 8.01959, locations[16].WaveHeight, locations[16].WaveHeight.GetAccuracy()); + Assert.AreEqual((RoundedDouble) 4.11447, locations[17].WaveHeight, locations[17].WaveHeight.GetAccuracy()); + } + + private static void AssertWaveHeightCalculationConvergenceOnHydraulicBoundaryLocations(HydraulicBoundaryLocation[] locations) + { + foreach (HydraulicBoundaryLocation hydraulicBoundaryLocation in locations) + { + Assert.AreEqual(CalculationConvergence.CalculatedConverged, hydraulicBoundaryLocation.WaveHeightCalculationConvergence); + } + } + + #endregion } } \ No newline at end of file