Index: Ringtoets.sln =================================================================== diff -u -r9282912f66e29bea5197cfcf0a047ea723fdda6f -rc7930c00c8c694260f69119c3ae4687f1297c69a --- Ringtoets.sln (.../Ringtoets.sln) (revision 9282912f66e29bea5197cfcf0a047ea723fdda6f) +++ Ringtoets.sln (.../Ringtoets.sln) (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -459,7 +459,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.HydraRing.Calculation.Test", "Ringtoets\HydraRing\test\Ringtoets.HydraRing.Calculation.Test\Riskeer.HydraRing.Calculation.Test.csproj", "{175406DB-C0DA-42A7-968C-0C17CF2257B1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.HydraRing.Calculation.Test", "Ringtoets\HydraRing\test\Riskeer.HydraRing.Calculation.Test\Riskeer.HydraRing.Calculation.Test.csproj", "{175406DB-C0DA-42A7-968C-0C17CF2257B1}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/DesignWaterLevelCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/DunesBoundaryConditionsCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/HydraRingCalculatorBaseTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/HydraulicLoadsCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/OvertoppingCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/StructuresCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/WaveConditionsCosineCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Calculator/WaveHeightCalculatorTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Defaults/FailureMechanismDefaultsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Defaults/VariableDefaultsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingBreakWaterTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingDeviationTypeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingDistributionTypeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingForelandPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingProfilePointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/HydraRingUncertaintiesTypeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationSettingsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/DunesBoundaryConditionsCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/HydraulicLoadsCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Hydraulics/WaveHeightCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Overtopping/HydraRingRoughnessProfilePointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/ReliabilityIndexCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureLowSillCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureVerticalWallCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresOvertoppingCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertLinearCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertQuadraticCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillLinearCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillQuadraticCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidCalculationInputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/DunesBoundaryConditionsCalculationOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/FaultTreeIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/GeneralResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointTreeNodeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/StochastTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/OvertoppingCalculationWaveHeightOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/ReliabilityIndexCalculationOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/WaveConditionsCalculationOutputTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Settings/DesignTablesSettingTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Settings/NumericsSettingTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Settings/PreprocessorSettingTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Settings/TimeIntegrationSettingTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/DeterministicHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/HydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/LogNormalHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/NormalHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/RandomHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/RayleighNHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Variables/TruncatedNormalHydraRingVariableTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Exceptions/HydraRingCalculationExceptionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Exceptions/HydraRingFileParserExceptionTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/ConvergenceParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/DunesBoundaryConditionsCalculationParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/ExceedanceProbabilityCalculationParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/HydraRingDatabaseParseHelperTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/IllustrationPoints/IllustrationPointsParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/LastErrorFileParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/OvertoppingCalculationWaveHeightParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/ReliabilityIndexCalculationParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveConditionsCalculationParserTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Readers/HydraRingDatabaseReaderTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Riskeer.HydraRing.Calculation.Test.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingInitializationServiceTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Services/HydraRingProcessFactoryTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceNull/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnAllButLastIteration/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnAllSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaAndValueSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaAndValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaSection2/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueAndValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/InvalidFile/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/NoConvergenceSection1/1-output.sqlite =================================================================== diff -u -rf5a99cad6b53959f6fd1c7da3136ebf1a27539e2 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/InvalidFile/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ResultsOnAllButLastIteration/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWaterLevel/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWaveHeight/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWavePeriod/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/BetaNull/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaFaultTree/1-output.sqlite =================================================================== diff -u -rb75888ac4a86ce24369ba0dad93cfe5bcd3fc794 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaGeneralResult/1-output.sqlite =================================================================== diff -u -rb75888ac4a86ce24369ba0dad93cfe5bcd3fc794 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaSubMechanism/1-output.sqlite =================================================================== diff -u -rb75888ac4a86ce24369ba0dad93cfe5bcd3fc794 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -re73c8b159778b281ecb275512f42da65c0d02e9d -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptySchema/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/MissingWindDirectionClosingSituationFaultTree/1-output.sqlite =================================================================== diff -u -r2494425b0c9355fa337d49efcc0267f958ebe154 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/MissingWindDirectionClosingSituationSubMechanism/1-output.sqlite =================================================================== diff -u -r2494425b0c9355fa337d49efcc0267f958ebe154 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaFaultTree/1-output.sqlite =================================================================== diff -u -re141f1eb48ef664ac3672cf3eab0492c7b483b9c -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaGeneralResult/1-output.sqlite =================================================================== diff -u -re141f1eb48ef664ac3672cf3eab0492c7b483b9c -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaSubMechanism/1-output.sqlite =================================================================== diff -u -re141f1eb48ef664ac3672cf3eab0492c7b483b9c -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoGoverningWindDirection/1-output.sqlite =================================================================== diff -u -rb8d852df1bd7269388f44bcb13d23a51920842fc -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullAlphaValue/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullBetaValue/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullDuration/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullIllustrationPointResultValue/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullRealization/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullWindDirectionAngle/1-output.sqlite =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidDesignWaterLevelOutputSection1/1-output.sqlite =================================================================== diff -u -rc4f75aa39431df092fc41bd13c1bd66c52b9e36e -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidStructuresStabilityOutputSection1/1-output.sqlite =================================================================== diff -u -r57b198a3f80256e02b871d8de11c05d9f2dcf311 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidStructuresStabilityOutputSection1/2-output.sqlite =================================================================== diff -u -r57b198a3f80256e02b871d8de11c05d9f2dcf311 -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/LastErrorFileParser/last_error.txt'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/1-output.txt'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/123.log'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyTableDesignBeta/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyTableGoverningWind/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/InvalidFile/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableDesignBeta/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableDesignPointResults/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableGoverningWind/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/OtherSection/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileOvertoppingDominant/1-output.sqlite =================================================================== diff -u -r1d6571206d815886a014b0f59f3aae070d46154c -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileOvertoppingNotDominant/1-output.sqlite =================================================================== diff -u -r1d6571206d815886a014b0f59f3aae070d46154c -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileWaveHeightNull/1-output.sqlite =================================================================== diff -u -r57c9aff5c1e30cb83c1cc2f33c7ce97dfe8d04fe -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/BetaNull/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/ValueNull/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/InvalidFile/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveAngle/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveDirection/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveHeight/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWavePeriod/1-output.sqlite =================================================================== diff -u -re111eec42ba01c6a60caf3356ee7353880913c6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseParseHelper/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseParseHelper/ValidFile/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/EmptyDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/InvalidDatabase/1-output.sqlite'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/ValidDatabase/1-output.sqlite =================================================================== diff -u -r1d8c35ad08fddf6471c168876fc01552af29fd6a -rc7930c00c8c694260f69119c3ae4687f1297c69a Binary files differ Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Settings/DesignTablesSettingsTest.csv'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Settings/HydraulicModelsSettingsTest.csv'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c7930c00c8c694260f69119c3ae4687f1297c69a refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/test-data/Settings/NumericsSettingsTest.csv'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DesignWaterLevelCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DesignWaterLevelCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DesignWaterLevelCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class DesignWaterLevelCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new DesignWaterLevelCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.ReliabilityIndex); + Assert.IsNaN(calculator.DesignWaterLevel); + Assert.IsNull(calculator.Converged); + Assert.IsNull(calculator.OutputDirectory); + Assert.IsNull(calculator.IllustrationPointsResult); + Assert.IsNull(calculator.IllustrationPointsParserErrorMessage); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DunesBoundaryConditionsCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DunesBoundaryConditionsCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/DunesBoundaryConditionsCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class DunesBoundaryConditionsCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new DunesBoundaryConditionsCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.WaterLevel); + Assert.IsNaN(calculator.WaveHeight); + Assert.IsNaN(calculator.WavePeriod); + Assert.IsNaN(calculator.ReliabilityIndex); + Assert.IsNull(calculator.OutputDirectory); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraRingCalculatorBaseTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraRingCalculatorBaseTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraRingCalculatorBaseTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,253 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.IO; +using System.Security; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Settings; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class HydraRingCalculatorBaseTest + { + [Test] + public void Constructor_CalculationSettingsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraRingCalculator(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculationSettings", exception.ParamName); + } + + [Test] + public void Calculate_NoPreprocessorDirectoryWhenRequired_ThrowsInvalidOperationException() + { + // Setup + var parser = new TestParser(); + var settings = new HydraRingCalculationSettings("D:\\hlcd.sqlite", string.Empty); + var calculator = new TestHydraRingCalculator(settings, parser); + var hydraRingCalculationInput = new TestHydraRingCalculationInput(); + + hydraRingCalculationInput.PreprocessorSetting = new PreprocessorSetting(1, 2, new NumericsSetting(1, 4, 50, 0.15, 0.05, 0.01, 0.01, 0, 2, 20000, 100000, 0.1, -6, 6)); + + // Call + TestDelegate test = () => calculator.PublicCalculate(hydraRingCalculationInput); + + // Assert + string message = Assert.Throws(test).Message; + Assert.AreEqual("Preprocessor directory required but not specified.", message); + } + + [Test] + public void Calculate_WithCustomParser_ParsersExecutedAndOutputSet() + { + // Setup + var parser = new TestParser(); + var calculator = new TestHydraRingCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings(), + parser); + + // Call + calculator.PublicCalculate(new TestHydraRingCalculationInput()); + + // Assert + Assert.IsTrue(!string.IsNullOrEmpty(calculator.OutputDirectory)); + Assert.IsTrue(parser.Parsed); + } + + [Test] + public void Calculate_WithCustomParserThrowingHydraRingFileParserException_HydraRingCalculationExceptionThrown() + { + // Setup + var parseException = new HydraRingFileParserException("message", new Exception()); + var parser = new TestParser(parseException); + var calculator = new TestHydraRingCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings(), + parser); + + // Call + TestDelegate test = () => calculator.PublicCalculate(new TestHydraRingCalculationInput()); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual(parseException.Message, exception.Message); + Assert.AreSame(parseException.InnerException, exception.InnerException); + } + + [Test] + [TestCase(typeof(SecurityException))] + [TestCase(typeof(IOException))] + [TestCase(typeof(UnauthorizedAccessException))] + [TestCase(typeof(ArgumentException))] + [TestCase(typeof(NotSupportedException))] + [TestCase(typeof(Win32Exception))] + public void Calculate_WithCustomParserThrowingSupportedCalculatedException_HydraRingCalculationExceptionThrown(Type exceptionType) + { + // Setup + var supportedException = (Exception) Activator.CreateInstance(exceptionType, + "Exception message", + new Exception("InnerException")); + var parser = new TestParser(supportedException); + var calculator = new TestHydraRingCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings(), + parser); + + // Call + TestDelegate test = () => calculator.PublicCalculate(new TestHydraRingCalculationInput()); + + // Assert + var exception = Assert.Throws(test); + string expectedMessage = "Het besturingssysteem geeft de volgende melding:" + + Environment.NewLine + + $"{supportedException.Message}"; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.AreSame(supportedException.InnerException, exception.InnerException); + } + + [Test] + public void Calculate_LastErrorFilePresent_LastErrorFileContentSet() + { + // Setup + var settings = new HydraRingCalculationSettings("D:\\HLCD.sqlite", string.Empty); + var calculator = new TestHydraRingCalculator(settings, new TestParser()); + + // Call + calculator.PublicCalculate(new TestHydraRingCalculationInput()); + + // Assert + string expectedContent = $"Hydraulic database {settings.HlcdFilePath} not found.\r\n"; + Assert.AreEqual(expectedContent, calculator.LastErrorFileContent); + } + + [Test] + public void Calculate_IllustrationPointsParserThrowsException_SetsIllustrationPointsParserError() + { + // Setup + var calculator = new TestHydraRingCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings(), + new TestParser()); + + // Call + calculator.PublicCalculate(new TestHydraRingCalculationInput()); + + // Assert + const string expectedMessage = "Er konden geen illustratiepunten worden uitgelezen."; + Assert.AreEqual(expectedMessage, calculator.IllustrationPointsParserErrorMessage); + Assert.IsNull(calculator.IllustrationPointsResult); + } + + private class TestHydraRingCalculator : HydraRingCalculatorBase + { + private readonly IHydraRingFileParser parser; + + public TestHydraRingCalculator(HydraRingCalculationSettings calculationSettings) : base(calculationSettings) {} + + public TestHydraRingCalculator(HydraRingCalculationSettings calculationSettings, IHydraRingFileParser parser) : base(calculationSettings) + { + this.parser = parser; + } + + public void PublicCalculate(HydraRingCalculationInput hydraRingCalculationInput) + { + Calculate(HydraRingUncertaintiesType.All, hydraRingCalculationInput); + } + + protected override void SetOutputs() {} + + protected override IEnumerable GetParsers() + { + yield return parser; + } + } + + private class TestHydraRingCalculationInput : HydraRingCalculationInput + { + public TestHydraRingCalculationInput() : base(12) + { + PreprocessorSetting = new PreprocessorSetting(); + DesignTablesSetting = new DesignTablesSetting(0, 0); + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6.0, 6.0, 25) + } + }; + TimeIntegrationSetting = new TimeIntegrationSetting(1); + } + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.AssessmentLevel; + } + } + + public override int CalculationTypeId + { + get + { + return 0; + } + } + + public override int VariableId + { + get + { + return 0; + } + } + + public override HydraRingSection Section { get; } = new HydraRingSection(12, 12, 12); + } + + private class TestParser : IHydraRingFileParser + { + private readonly Exception exception; + + public TestParser(Exception exception = null) + { + this.exception = exception; + } + + public bool Parsed { get; private set; } + + public void Parse(string workingDirectory, int sectionId) + { + if (exception != null) + { + throw exception; + } + + Parsed = true; + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraulicLoadsCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraulicLoadsCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/HydraulicLoadsCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class HydraulicLoadsCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new HydraulicLoadsCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.Value); + Assert.IsNaN(calculator.ReliabilityIndex); + Assert.IsNull(calculator.Converged); + Assert.IsNull(calculator.OutputDirectory); + Assert.IsNull(calculator.IllustrationPointsResult); + Assert.IsNull(calculator.IllustrationPointsParserErrorMessage); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/OvertoppingCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/OvertoppingCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/OvertoppingCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class OvertoppingCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new OvertoppingCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.WaveHeight); + Assert.IsNaN(calculator.ExceedanceProbabilityBeta); + Assert.IsFalse(calculator.IsOvertoppingDominant); + Assert.IsNull(calculator.OutputDirectory); + Assert.IsNull(calculator.IllustrationPointsResult); + Assert.IsNull(calculator.IllustrationPointsParserErrorMessage); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/StructuresCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/StructuresCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/StructuresCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; +using Riskeer.HydraRing.Calculation.Data.Input; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class StructuresCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new StructuresCalculator( + HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf>(calculator); + Assert.IsNaN(calculator.ExceedanceProbabilityBeta); + Assert.IsNull(calculator.OutputDirectory); + Assert.IsNull(calculator.IllustrationPointsResult); + Assert.IsNull(calculator.IllustrationPointsParserErrorMessage); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveConditionsCosineCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveConditionsCosineCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveConditionsCosineCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class WaveConditionsCosineCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new WaveConditionsCosineCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.WaveHeight); + Assert.IsNaN(calculator.WaveAngle); + Assert.IsNaN(calculator.WaveDirection); + Assert.IsNaN(calculator.WavePeakPeriod); + Assert.IsNaN(calculator.ReliabilityIndex); + Assert.IsNull(calculator.Converged); + Assert.IsNull(calculator.OutputDirectory); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveHeightCalculatorTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveHeightCalculatorTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Calculator/WaveHeightCalculatorTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Calculator; + +namespace Riskeer.HydraRing.Calculation.Test.Calculator +{ + [TestFixture] + public class WaveHeightCalculatorTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var calculator = new WaveHeightCalculator(HydraRingCalculationSettingsTestFactory.CreateSettings()); + + // Assert + Assert.IsInstanceOf(calculator); + Assert.IsInstanceOf(calculator); + Assert.IsNaN(calculator.ReliabilityIndex); + Assert.IsNaN(calculator.WaveHeight); + Assert.IsNull(calculator.Converged); + Assert.IsNull(calculator.OutputDirectory); + Assert.IsNull(calculator.IllustrationPointsResult); + Assert.IsNull(calculator.IllustrationPointsParserErrorMessage); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/FailureMechanismDefaultsTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/FailureMechanismDefaultsTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/FailureMechanismDefaultsTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Defaults; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Defaults +{ + [TestFixture] + public class FailureMechanismDefaultsTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var failureMechanismDefaults = new FailureMechanismDefaults(1, new[] + { + 2, + 3 + }, 4, 5, 6); + + // Assert + Assert.AreEqual(1, failureMechanismDefaults.MechanismId); + CollectionAssert.AreEqual(new[] + { + 2, + 3 + }, failureMechanismDefaults.SubMechanismIds); + Assert.AreEqual(4, failureMechanismDefaults.FaultTreeModelId); + Assert.AreEqual(5, failureMechanismDefaults.PreprocessorFaultTreeModelId); + Assert.AreEqual(6, failureMechanismDefaults.PreprocessorMechanismId); + Assert.AreEqual(7, failureMechanismDefaults.PreprocessorSubMechanismId); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/VariableDefaultsTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/VariableDefaultsTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Defaults/VariableDefaultsTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,40 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Defaults; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Defaults +{ + [TestFixture] + public class VariableDefaultsTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var variableDefaults = new VariableDefaults(1.1); + + // Assert + Assert.AreEqual(1.1, variableDefaults.CorrelationLength); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingBreakWaterTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingBreakWaterTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingBreakWaterTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,45 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingBreakWaterTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int type = 1; + const double height = 100.1; + + // Call + var breakWater = new HydraRingBreakWater(type, height); + + // Assert + Assert.AreEqual(type, breakWater.Type); + Assert.AreEqual(height, breakWater.Height); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDeviationTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDeviationTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDeviationTypeTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,44 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingDeviationTypeTest + { + [Test] + public void Values_HasTwo() + { + Assert.AreEqual(2, Enum.GetValues(typeof(HydraRingDeviationType)).Length); + } + + [Test] + public void ConvertToInteger_ForAllValues_ReturnsExpectedInteger() + { + Assert.AreEqual(1, (int) HydraRingDeviationType.Standard); + Assert.AreEqual(0, (int) HydraRingDeviationType.Variation); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDistributionTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDistributionTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingDistributionTypeTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingDistributionTypeTest + { + [Test] + public void Values_HasFive() + { + Assert.AreEqual(5, Enum.GetValues(typeof(HydraRingDistributionType)).Length); + } + + [Test] + public void ConvertToInteger_ForAllValues_ReturnsExpectedInteger() + { + Assert.AreEqual(0, (int) HydraRingDistributionType.Deterministic); + Assert.AreEqual(2, (int) HydraRingDistributionType.Normal); + Assert.AreEqual(4, (int) HydraRingDistributionType.LogNormal); + Assert.AreEqual(18, (int) HydraRingDistributionType.RayleighN); + Assert.AreEqual(19, (int) HydraRingDistributionType.TruncatedNormal); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingFailureMechanismTypeTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,51 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingFailureMechanismTypeTest + { + [Test] + public void Values_ExpectedValues() + { + Assert.AreEqual(12, Enum.GetValues(typeof(HydraRingFailureMechanismType)).Length); + + const string message = "Value no longer corresponds to id in Hydra-Ring settings database files."; + Assert.AreEqual(0, (int) HydraRingFailureMechanismType.AssessmentLevel, message); + Assert.AreEqual(1, (int) HydraRingFailureMechanismType.QVariant, message); + Assert.AreEqual(2, (int) HydraRingFailureMechanismType.WaveHeight, message); + Assert.AreEqual(3, (int) HydraRingFailureMechanismType.WavePeakPeriod, message); + Assert.AreEqual(4, (int) HydraRingFailureMechanismType.WaveSpectralPeriod, message); + Assert.AreEqual(5, (int) HydraRingFailureMechanismType.DikeHeight, message); + Assert.AreEqual(6, (int) HydraRingFailureMechanismType.DikesOvertopping, message); + Assert.AreEqual(7, (int) HydraRingFailureMechanismType.StructuresOvertopping, message); + Assert.AreEqual(8, (int) HydraRingFailureMechanismType.StructuresClosure, message); + Assert.AreEqual(9, (int) HydraRingFailureMechanismType.StructuresStructuralFailure, message); + Assert.AreEqual(10, (int) HydraRingFailureMechanismType.DunesBoundaryConditions, message); + Assert.AreEqual(11, (int) HydraRingFailureMechanismType.OvertoppingRate, message); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingForelandPointTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingForelandPointTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingForelandPointTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,45 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingForelandPointTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const double xCoordinate = 1.1; + const double zCoordinate = 2.2; + + // Call + var hydraRingForelandPoint = new HydraRingForelandPoint(xCoordinate, zCoordinate); + + // Assert + Assert.AreEqual(xCoordinate, hydraRingForelandPoint.X); + Assert.AreEqual(zCoordinate, hydraRingForelandPoint.Z); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingProfilePointTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingProfilePointTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingProfilePointTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingProfilePointTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingProfilePoint = new HydraRingProfilePoint(1.1, 2.2); + + // Assert + Assert.AreEqual(1.1, hydraRingProfilePoint.X); + Assert.AreEqual(2.2, hydraRingProfilePoint.Z); + Assert.AreEqual(1.0, hydraRingProfilePoint.Roughness); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingSectionTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,42 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingSectionTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingSection = new HydraRingSection(1, 2.2, 3.3); + + // Assert + Assert.AreEqual(1, hydraRingSection.SectionId); + Assert.AreEqual(2.2, hydraRingSection.SectionLength); + Assert.AreEqual(3.3, hydraRingSection.CrossSectionNormal); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingUncertaintiesTypeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingUncertaintiesTypeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/HydraRingUncertaintiesTypeTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,46 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; + +namespace Riskeer.HydraRing.Calculation.Test.Data +{ + [TestFixture] + public class HydraRingUncertaintiesTypeTest + { + [Test] + public void Values_HasFour() + { + Assert.AreEqual(4, Enum.GetValues(typeof(HydraRingUncertaintiesType)).Length); + } + + [Test] + public void ConvertToInteger_ForAllValues_ReturnsExpectedInteger() + { + Assert.AreEqual(0, (int) HydraRingUncertaintiesType.None); + Assert.AreEqual(1, (int) HydraRingUncertaintiesType.All); + Assert.AreEqual(2, (int) HydraRingUncertaintiesType.Model); + Assert.AreEqual(3, (int) HydraRingUncertaintiesType.Statistic); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ExceedanceProbabilityCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input +{ + [TestFixture] + public class ExceedanceProbabilityCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int expectedCalculationTypeId = 1; + const int hydraulicBoundaryLocationId = 1000; + + // Call + ExceedanceProbabilityCalculationInput exceedanceProbabilityCalculationInputImplementation = + new ExceedanceProbabilityCalculationInputImplementation(hydraulicBoundaryLocationId); + + // Assert + Assert.IsInstanceOf(exceedanceProbabilityCalculationInputImplementation); + Assert.AreEqual(expectedCalculationTypeId, exceedanceProbabilityCalculationInputImplementation.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, exceedanceProbabilityCalculationInputImplementation.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikesOvertopping, exceedanceProbabilityCalculationInputImplementation.FailureMechanismType); + Assert.AreEqual(5, exceedanceProbabilityCalculationInputImplementation.VariableId); + Assert.AreEqual(1, exceedanceProbabilityCalculationInputImplementation.Section.SectionId); + CollectionAssert.IsEmpty(exceedanceProbabilityCalculationInputImplementation.Variables); + CollectionAssert.IsEmpty(exceedanceProbabilityCalculationInputImplementation.ProfilePoints); + CollectionAssert.IsEmpty(exceedanceProbabilityCalculationInputImplementation.ForelandsPoints); + Assert.IsNull(exceedanceProbabilityCalculationInputImplementation.BreakWater); + Assert.IsNaN(exceedanceProbabilityCalculationInputImplementation.Beta); + } + + private class ExceedanceProbabilityCalculationInputImplementation : ExceedanceProbabilityCalculationInput + { + public ExceedanceProbabilityCalculationInputImplementation(int hydraulicBoundaryLocationId) : base(hydraulicBoundaryLocationId) {} + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.DikesOvertopping; + } + } + + public override int VariableId + { + get + { + return 5; + } + } + + public override HydraRingSection Section + { + get + { + return new HydraRingSection(1, 2.2, 3.3); + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,113 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input +{ + [TestFixture] + public class HydraRingCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingCalculationInput = new HydraRingCalculationInputImplementation(1); + + // Assert + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, hydraRingCalculationInput.FailureMechanismType); + Assert.AreEqual(4, hydraRingCalculationInput.CalculationTypeId); + Assert.AreEqual(5, hydraRingCalculationInput.VariableId); + Assert.AreEqual(1, hydraRingCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(1, hydraRingCalculationInput.Section.SectionId); + CollectionAssert.IsEmpty(hydraRingCalculationInput.Variables); + CollectionAssert.IsEmpty(hydraRingCalculationInput.ProfilePoints); + CollectionAssert.IsEmpty(hydraRingCalculationInput.ForelandsPoints); + Assert.IsNull(hydraRingCalculationInput.BreakWater); + Assert.IsNaN(hydraRingCalculationInput.Beta); + Assert.AreEqual(3, hydraRingCalculationInput.IterationMethodId); + } + + [Test] + public void GetSubMechanismModelId_ReturnsExpectedValues() + { + // Call + var hydraRingCalculationInput = new HydraRingCalculationInputImplementation(1); + + // Assert + Assert.AreEqual(10, hydraRingCalculationInput.GetSubMechanismModelId(1)); + Assert.AreEqual(20, hydraRingCalculationInput.GetSubMechanismModelId(2)); + Assert.IsNull(hydraRingCalculationInput.GetSubMechanismModelId(3)); + } + + private class HydraRingCalculationInputImplementation : HydraRingCalculationInput + { + public HydraRingCalculationInputImplementation(int hydraulicBoundaryLocationId) : base(hydraulicBoundaryLocationId) {} + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return HydraRingFailureMechanismType.QVariant; + } + } + + public override int CalculationTypeId + { + get + { + return 4; + } + } + + public override int VariableId + { + get + { + return 5; + } + } + + public override HydraRingSection Section + { + get + { + return new HydraRingSection(1, 2.2, 3.3); + } + } + + public override int? GetSubMechanismModelId(int subMechanismId) + { + switch (subMechanismId) + { + case 1: + return 10; + case 2: + return 20; + default: + return null; + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationSettingsTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationSettingsTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/HydraRingCalculationSettingsTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Input; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input +{ + [TestFixture] + public class HydraRingCalculationSettingsTest + { + [Test] + public void Constructor_HlcdFilePathNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new HydraRingCalculationSettings(null, string.Empty); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("hlcdFilePath", exception.ParamName); + } + + [Test] + public void Constructor_PreprocessorDirectoryNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new HydraRingCalculationSettings(string.Empty, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("preprocessorDirectory", exception.ParamName); + } + + [Test] + public void Constructor_WithArguments_ExpectedValues() + { + // Setup + const string hlcdFilePath = "hlcdFilePath"; + const string preProcessorDirectory = "PreprocessorDirectory"; + + // Call + var settings = new HydraRingCalculationSettings(hlcdFilePath, preProcessorDirectory); + + // Assert + Assert.AreEqual(hlcdFilePath, settings.HlcdFilePath); + Assert.AreEqual(preProcessorDirectory, settings.PreprocessorDirectory); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/AssessmentLevelCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,82 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class AssessmentLevelCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int sectionId = 1; + const long hydraulicBoundaryLocationId = 1234; + + // Call + var assessmentLevelCalculationInput = new AssessmentLevelCalculationInput(sectionId, hydraulicBoundaryLocationId, norm); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(assessmentLevelCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.AssessmentLevel, assessmentLevelCalculationInput.FailureMechanismType); + Assert.AreEqual(9, assessmentLevelCalculationInput.CalculationTypeId); + Assert.AreEqual(26, assessmentLevelCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, assessmentLevelCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(assessmentLevelCalculationInput.Section); + CollectionAssert.IsEmpty(assessmentLevelCalculationInput.ProfilePoints); + CollectionAssert.IsEmpty(assessmentLevelCalculationInput.ForelandsPoints); + Assert.IsNull(assessmentLevelCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, assessmentLevelCalculationInput.Beta); + + HydraRingSection section = assessmentLevelCalculationInput.Section; + Assert.AreEqual(sectionId, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.IsNaN(section.CrossSectionNormal); + + HydraRingVariable[] variables = assessmentLevelCalculationInput.Variables.ToArray(); + Assert.AreEqual(1, variables.Length); + HydraRingVariable waterLevelVariable = variables.First(); + Assert.IsInstanceOf(waterLevelVariable); + Assert.AreEqual(26, waterLevelVariable.VariableId); + Assert.AreEqual(0.0, waterLevelVariable.Value); + } + + [Test] + public void GetSubMechanismModelId_ReturnsExpectedValues() + { + // Call + var assessmentLevelCalculationInput = new AssessmentLevelCalculationInput(1, 1, 2.2); + + // Assert + Assert.IsNull(assessmentLevelCalculationInput.GetSubMechanismModelId(1)); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DikeHeightCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,141 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class DikeHeightCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int hydraulicBoundaryLocationId = 1000; + + const double sectionNormal = 21.1; + const double modelFactorCriticalOvertopping = 1.1; + const double factorFbMean = 2.2; + const double factorFbStandardDeviation = 3.3; + const double factorFbLowerBoundary = 4.4; + const double factorFbUpperBoundary = 5.5; + const double factorFnMean = 6.6; + const double factorFnStandardDeviation = 7.7; + const double factorFnLowerBoundary = 8.8; + const double factorFnUpperBoundary = 9.9; + const double modelFactorOvertopping = 10.0; + const double criticalOvertoppingMean = 11.1; + const double criticalOvertoppingStandardDeviation = 12.2; + const double modelFactorFrunupMean = 13.3; + const double modelFactorFrunupStandardDeviation = 14.4; + const double modelFactorFrunupLowerBoundary = 15.5; + const double modelFactorFrunupUpperBoundary = 16.6; + const double exponentModelFactorShallowMean = 17.7; + const double exponentModelFactorShallowStandardDeviation = 18.8; + const double exponentModelFactorShallowLowerBoundary = 19.9; + const double exponentModelFactorShallowUpperBoundary = 20.0; + + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + var input = new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, sectionNormal, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(input); + Assert.AreEqual(9, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikeHeight, input.FailureMechanismType); + Assert.AreEqual(1, input.VariableId); + HydraRingDataEqualityHelper.AreEqual(GetDefaultDikeHeightVariables().ToArray(), input.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, input.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, input.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, input.BreakWater); + Assert.AreEqual(expectedBeta, input.Beta); + + HydraRingSection hydraRingSection = input.Section; + Assert.AreEqual(1, hydraRingSection.SectionId); + Assert.IsNaN(hydraRingSection.SectionLength); + Assert.AreEqual(sectionNormal, hydraRingSection.CrossSectionNormal); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var input = new DikeHeightCalculationInput(1, 1.0 / 1000, double.NaN, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetDefaultDikeHeightVariables() + { + yield return new DeterministicHydraRingVariable(1, 0.0); + yield return new DeterministicHydraRingVariable(8, 1.1); + yield return new TruncatedNormalHydraRingVariable(10, HydraRingDeviationType.Standard, 2.2, 3.3, 4.4, 5.5); + yield return new TruncatedNormalHydraRingVariable(11, HydraRingDeviationType.Standard, 6.6, 7.7, 8.8, 9.9); + yield return new DeterministicHydraRingVariable(12, 10.0); + yield return new LogNormalHydraRingVariable(17, HydraRingDeviationType.Standard, 11.1, 12.2); + yield return new TruncatedNormalHydraRingVariable(120, HydraRingDeviationType.Standard, 13.3, 14.4, 15.5, 16.6); + yield return new TruncatedNormalHydraRingVariable(123, HydraRingDeviationType.Standard, 17.7, 18.8, 19.9, 20.0); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DunesBoundaryConditionsCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DunesBoundaryConditionsCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/DunesBoundaryConditionsCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,81 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class DunesBoundaryConditionsCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int sectionId = 1; + const long hydraulicBoundaryLocationId = 1234; + + // Call + var dunesBoundaryConditionsCalculationInput = new DunesBoundaryConditionsCalculationInput(sectionId, hydraulicBoundaryLocationId, norm); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(dunesBoundaryConditionsCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.DunesBoundaryConditions, dunesBoundaryConditionsCalculationInput.FailureMechanismType); + Assert.AreEqual(2, dunesBoundaryConditionsCalculationInput.CalculationTypeId); + Assert.AreEqual(26, dunesBoundaryConditionsCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, dunesBoundaryConditionsCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(dunesBoundaryConditionsCalculationInput.Section); + CollectionAssert.IsEmpty(dunesBoundaryConditionsCalculationInput.ProfilePoints); + CollectionAssert.IsEmpty(dunesBoundaryConditionsCalculationInput.ForelandsPoints); + Assert.IsNull(dunesBoundaryConditionsCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, dunesBoundaryConditionsCalculationInput.Beta); + + HydraRingSection section = dunesBoundaryConditionsCalculationInput.Section; + Assert.AreEqual(sectionId, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.IsNaN(section.CrossSectionNormal); + + HydraRingVariable[] hydraRingVariables = dunesBoundaryConditionsCalculationInput.Variables.ToArray(); + Assert.AreEqual(1, hydraRingVariables.Length); + HydraRingVariable waterLevelVariable = hydraRingVariables.First(); + Assert.IsInstanceOf(waterLevelVariable); + Assert.AreEqual(26, waterLevelVariable.VariableId); + Assert.AreEqual(0.0, waterLevelVariable.Value); + } + + [Test] + public void GetSubMechanismModelId_ReturnsExpectedValues() + { + // Call + var dunesBoundaryConditionsCalculationInput = new DunesBoundaryConditionsCalculationInput(1, 1, 2.2); + + // Assert + Assert.IsNull(dunesBoundaryConditionsCalculationInput.GetSubMechanismModelId(1)); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/HydraulicLoadsCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/HydraulicLoadsCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/HydraulicLoadsCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,174 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class HydraulicLoadsCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int hydraulicBoundaryLocationId = 1000; + + const double sectionNormal = 19.9; + const double modelFactorCriticalOvertopping = 1.1; + const double factorFbMean = 2.2; + const double factorFbStandardDeviation = 3.3; + const double factorFbLowerBoundary = 4.4; + const double factorFbUpperBoundary = 5.5; + const double factorFnMean = 6.6; + const double factorFnStandardDeviation = 7.7; + const double factorFnLowerBoundary = 8.8; + const double factorFnUpperBoundary = 9.9; + const double modelFactorOvertopping = 10.0; + const double modelFactorFrunupMean = 11.1; + const double modelFactorFrunupStandardDeviation = 12.2; + const double modelFactorFrunupLowerBoundary = 13.3; + const double modelFactorFrunupUpperBoundary = 14.4; + const double exponentModelFactorShallowMean = 15.5; + const double exponentModelFactorShallowStandardDeviation = 16.6; + const double exponentModelFactorShallowLowerBoundary = 17.7; + const double exponentModelFactorShallowUpperBoundary = 18.8; + + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + var input = new HydraulicLoadsCalculationInputImplementation(hydraulicBoundaryLocationId, norm, sectionNormal, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(input); + Assert.AreEqual(9, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.IsNotNull(input.Section); + HydraRingDataEqualityHelper.AreEqual(GetDefaultHydraulicLoadsVariables().ToArray(), input.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, input.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, input.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, input.BreakWater); + Assert.AreEqual(expectedBeta, input.Beta); + + HydraRingSection hydraRingSection = input.Section; + Assert.AreEqual(1, hydraRingSection.SectionId); + Assert.IsNaN(hydraRingSection.SectionLength); + Assert.AreEqual(sectionNormal, hydraRingSection.CrossSectionNormal); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var input = new HydraulicLoadsCalculationInputImplementation(1, 1.0 / 1000, double.NaN, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetDefaultHydraulicLoadsVariables() + { + yield return new DeterministicHydraRingVariable(8, 1.1); + yield return new TruncatedNormalHydraRingVariable(10, HydraRingDeviationType.Standard, 2.2, 3.3, 4.4, 5.5); + yield return new TruncatedNormalHydraRingVariable(11, HydraRingDeviationType.Standard, 6.6, 7.7, 8.8, 9.9); + yield return new DeterministicHydraRingVariable(12, 10.0); + yield return new TruncatedNormalHydraRingVariable(120, HydraRingDeviationType.Standard, 11.1, 12.2, 13.3, 14.4); + yield return new TruncatedNormalHydraRingVariable(123, HydraRingDeviationType.Standard, 15.5, 16.6, 17.7, 18.8); + } + + private class HydraulicLoadsCalculationInputImplementation : HydraulicLoadsCalculationInput + { + public HydraulicLoadsCalculationInputImplementation(long hydraulicBoundaryLocationId, double norm, + double sectionNormal, + IEnumerable profilePoints, + IEnumerable forelandPoints, + HydraRingBreakWater breakWater, + double modelFactorCriticalOvertopping, + double factorFbMean, double factorFbStandardDeviation, + double factorFbLowerBoundary, double factorFbUpperBoundary, + double factorFnMean, double factorFnStandardDeviation, + double factorFnLowerBoundary, double factorFnUpperBoundary, + double modelFactorOvertopping, + double modelFactorFrunupMean, double modelFactorFrunupStandardDeviation, + double modelFactorFrunupLowerBoundary, double modelFactorFrunupUpperBoundary, + double exponentModelFactorShallowMean, double exponentModelFactorShallowStandardDeviation, + double exponentModelFactorShallowLowerBoundary, double exponentModelFactorShallowUpperBoundary) + : base(hydraulicBoundaryLocationId, norm, + sectionNormal, + profilePoints, + forelandPoints, + breakWater, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary) {} + + public override HydraRingFailureMechanismType FailureMechanismType { get; } = (HydraRingFailureMechanismType) 1000; + + public override int VariableId { get; } = -1; + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/OvertoppingRateCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,141 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class OvertoppingRateCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int hydraulicBoundaryLocationId = 1000; + + const double sectionNormal = 20.0; + const double dikeHeight = 1.1; + const double modelFactorCriticalOvertopping = 2.2; + const double factorFbMean = 3.3; + const double factorFbStandardDeviation = 4.4; + const double factorFbLowerBoundary = 5.5; + const double factorFbUpperBoundary = 6.6; + const double factorFnMean = 7.7; + const double factorFnStandardDeviation = 8.8; + const double factorFnLowerBoundary = 9.9; + const double factorFnUpperBoundary = 10.0; + const double modelFactorOvertopping = 11.1; + const double modelFactorFrunupMean = 12.2; + const double modelFactorFrunupStandardDeviation = 13.3; + const double modelFactorFrunupLowerBoundary = 14.4; + const double modelFactorFrunupUpperBoundary = 15.5; + const double exponentModelFactorShallowMean = 16.6; + const double exponentModelFactorShallowStandardDeviation = 17.7; + const double exponentModelFactorShallowLowerBoundary = 18.8; + const double exponentModelFactorShallowUpperBoundary = 19.9; + + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + var input = new OvertoppingRateCalculationInput(hydraulicBoundaryLocationId, norm, sectionNormal, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + dikeHeight, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(input); + Assert.AreEqual(2, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.OvertoppingRate, input.FailureMechanismType); + Assert.AreEqual(17, input.VariableId); + Assert.IsNotNull(input.Section); + HydraRingDataEqualityHelper.AreEqual(GetDefaultOvertoppingRateVariables().ToArray(), input.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, input.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, input.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, input.BreakWater); + Assert.AreEqual(expectedBeta, input.Beta); + + HydraRingSection hydraRingSection = input.Section; + Assert.AreEqual(1, hydraRingSection.SectionId); + Assert.IsNaN(hydraRingSection.SectionLength); + Assert.AreEqual(sectionNormal, hydraRingSection.CrossSectionNormal); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var input = new OvertoppingRateCalculationInput(1, 1000, double.NaN, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, input.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetDefaultOvertoppingRateVariables() + { + yield return new DeterministicHydraRingVariable(1, 1.1); + yield return new DeterministicHydraRingVariable(8, 2.2); + yield return new TruncatedNormalHydraRingVariable(10, HydraRingDeviationType.Standard, 3.3, 4.4, 5.5, 6.6); + yield return new TruncatedNormalHydraRingVariable(11, HydraRingDeviationType.Standard, 7.7, 8.8, 9.9, 10.0); + yield return new DeterministicHydraRingVariable(12, 11.1); + yield return new DeterministicHydraRingVariable(17, 0.0); + yield return new TruncatedNormalHydraRingVariable(120, HydraRingDeviationType.Standard, 12.2, 13.3, 14.4, 15.5); + yield return new TruncatedNormalHydraRingVariable(123, HydraRingDeviationType.Standard, 16.6, 17.7, 18.8, 19.9); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/WaveHeightCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/WaveHeightCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Hydraulics/WaveHeightCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,82 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Hydraulics +{ + [TestFixture] + public class WaveHeightCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const double norm = 1.0 / 10000; + const int sectionId = 1; + const long hydraulicBoundaryLocationId = 1234; + + // Call + var waveHeightCalculationInput = new WaveHeightCalculationInput(sectionId, hydraulicBoundaryLocationId, norm); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(waveHeightCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.WaveHeight, waveHeightCalculationInput.FailureMechanismType); + Assert.AreEqual(9, waveHeightCalculationInput.CalculationTypeId); + Assert.AreEqual(28, waveHeightCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveHeightCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveHeightCalculationInput.Section); + CollectionAssert.IsEmpty(waveHeightCalculationInput.ProfilePoints); + CollectionAssert.IsEmpty(waveHeightCalculationInput.ForelandsPoints); + Assert.IsNull(waveHeightCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, waveHeightCalculationInput.Beta); + + HydraRingSection section = waveHeightCalculationInput.Section; + Assert.AreEqual(sectionId, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.IsNaN(section.CrossSectionNormal); + + HydraRingVariable[] variables = waveHeightCalculationInput.Variables.ToArray(); + Assert.AreEqual(1, variables.Length); + HydraRingVariable waveHeightVariable = variables.First(); + Assert.IsInstanceOf(waveHeightVariable); + Assert.AreEqual(28, waveHeightVariable.VariableId); + Assert.AreEqual(0.0, waveHeightVariable.Value); + } + + [Test] + public void GetSubMechanismModelId_ReturnsExpectedValues() + { + // Call + var waveHeightCalculationInput = new WaveHeightCalculationInput(1, 1, 2.2); + + // Assert + Assert.IsNull(waveHeightCalculationInput.GetSubMechanismModelId(1)); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/HydraRingRoughnessProfilePointTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/HydraRingRoughnessProfilePointTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/HydraRingRoughnessProfilePointTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Overtopping +{ + [TestFixture] + public class HydraRingRoughnessProfilePointTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const double expectedX = 1.1; + const double expectedZ = 2.2; + const double expectedRoughness = 3.3; + + // Call + var hydraRingRoughnessProfilePoint = new HydraRingRoughnessProfilePoint(expectedX, expectedZ, expectedRoughness); + + // Assert + Assert.AreEqual(expectedX, hydraRingRoughnessProfilePoint.X); + Assert.AreEqual(expectedZ, hydraRingRoughnessProfilePoint.Z); + Assert.AreEqual(expectedRoughness, hydraRingRoughnessProfilePoint.Roughness); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Overtopping/OvertoppingCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,145 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Overtopping +{ + [TestFixture] + public class OvertoppingCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + + const double sectionNormal = 22.2; + const double dikeHeight = 1.1; + const double modelFactorCriticalOvertopping = 2.2; + const double factorFbMean = 3.3; + const double factorFbStandardDeviation = 4.4; + const double factorFbLowerBoundary = 14.4; + const double factorFbUpperBoundary = 15.5; + const double factorFnMean = 5.5; + const double factorFnStandardDeviation = 6.6; + const double factorFnLowerBoundary = 16.6; + const double factorFnUpperBoundary = 17.7; + const double modelFactorOvertopping = 7.7; + const double criticalOvertoppingMean = 8.8; + const double criticalOvertoppingStandardDeviation = 9.9; + const double modelFactorFrunupMean = 10.0; + const double modelFactorFrunupStandardDeviation = 11.1; + const double modelFactorFrunupLowerBoundary = 18.8; + const double modelFactorFrunupUpperBoundary = 19.9; + const double exponentModelFactorShallowMean = 12.2; + const double exponentModelFactorShallowStandardDeviation = 13.3; + const double exponentModelFactorShallowLowerBoundary = 20.0; + const double exponentModelFactorShallowUpperBoundary = 21.1; + + var expectedRingProfilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var expectedRingForelandPoints = new List + { + new HydraRingForelandPoint(2.2, 3.3) + }; + var expectedRingBreakWater = new HydraRingBreakWater(2, 3.3); + + // Call + + var overtoppingCalculationInput = new OvertoppingCalculationInput( + hydraulicBoundaryLocationId, sectionNormal, + expectedRingProfilePoints, expectedRingForelandPoints, expectedRingBreakWater, + dikeHeight, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary); + + // Assert + const int expectedCalculationTypeId = 1; + const int expectedVariableId = 1; + Assert.IsInstanceOf(overtoppingCalculationInput); + Assert.AreEqual(expectedCalculationTypeId, overtoppingCalculationInput.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, overtoppingCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.DikesOvertopping, overtoppingCalculationInput.FailureMechanismType); + Assert.AreEqual(expectedVariableId, overtoppingCalculationInput.VariableId); + HydraRingDataEqualityHelper.AreEqual(GetDefaultOvertoppingVariables().ToArray(), overtoppingCalculationInput.Variables.ToArray()); + CollectionAssert.AreEqual(expectedRingProfilePoints, overtoppingCalculationInput.ProfilePoints); + CollectionAssert.AreEqual(expectedRingForelandPoints, overtoppingCalculationInput.ForelandsPoints); + Assert.AreEqual(expectedRingBreakWater, overtoppingCalculationInput.BreakWater); + Assert.IsNaN(overtoppingCalculationInput.Beta); + + HydraRingSection hydraRingSection = overtoppingCalculationInput.Section; + Assert.AreEqual(1, hydraRingSection.SectionId); + Assert.IsNaN(hydraRingSection.SectionLength); + Assert.AreEqual(sectionNormal, hydraRingSection.CrossSectionNormal); + } + + [Test] + [TestCase(101, null)] + [TestCase(102, 94)] + [TestCase(103, 95)] + [TestCase(104, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var overtoppingCalculationInput = new OvertoppingCalculationInput( + 1, double.NaN, + new List(), + new List(), + new HydraRingBreakWater(0, 1.1), + 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, overtoppingCalculationInput.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetDefaultOvertoppingVariables() + { + yield return new DeterministicHydraRingVariable(1, 1.1); + yield return new DeterministicHydraRingVariable(8, 2.2); + yield return new TruncatedNormalHydraRingVariable(10, HydraRingDeviationType.Standard, 3.3, 4.4, 14.4, 15.5); + yield return new TruncatedNormalHydraRingVariable(11, HydraRingDeviationType.Standard, 5.5, 6.6, 16.6, 17.7); + yield return new DeterministicHydraRingVariable(12, 7.7); + yield return new LogNormalHydraRingVariable(17, HydraRingDeviationType.Standard, 8.8, 9.9); + yield return new TruncatedNormalHydraRingVariable(120, HydraRingDeviationType.Standard, 10.0, 11.1, 18.8, 19.9); + yield return new TruncatedNormalHydraRingVariable(123, HydraRingDeviationType.Standard, 12.2, 13.3, 20.0, 21.1); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ReliabilityIndexCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ReliabilityIndexCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/ReliabilityIndexCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,85 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Util; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input +{ + [TestFixture] + public class ReliabilityIndexCalculationInputTest + { + [Test] + [TestCase(2, 1.0 / 10000)] + [TestCase(-50, 1.0 / 1)] + [TestCase(0, 1.0 / -90)] + [TestCase(200000, double.NaN)] + public void Constructed_UsingDifferentReturnPeriodAndLocationId_ReturnDifferentBetaAndDefaultValues(int locationId, double norm) + { + // Call + var reliabilityIndexCalculationInput = new SimpleReliabilityIndexCalculationInput(locationId, norm); + + // Assert + Assert.IsInstanceOf(reliabilityIndexCalculationInput); + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.AreEqual(locationId, reliabilityIndexCalculationInput.HydraulicBoundaryLocationId); + Assert.AreEqual(9, reliabilityIndexCalculationInput.CalculationTypeId); + CollectionAssert.IsEmpty(reliabilityIndexCalculationInput.Variables); + CollectionAssert.IsEmpty(reliabilityIndexCalculationInput.ProfilePoints); + CollectionAssert.IsEmpty(reliabilityIndexCalculationInput.ForelandsPoints); + Assert.IsNull(reliabilityIndexCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, reliabilityIndexCalculationInput.Beta); + } + + private class SimpleReliabilityIndexCalculationInput : ReliabilityIndexCalculationInput + { + public SimpleReliabilityIndexCalculationInput(int i, double norm) + : base(i, norm) {} + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + throw new NotImplementedException(); + } + } + + public override int VariableId + { + get + { + throw new NotImplementedException(); + } + } + + public override HydraRingSection Section + { + get + { + throw new NotImplementedException(); + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,165 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresClosureCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 21.1; + const double gravitationalAcceleration = 1.1; + const double factorStormDurationOpenStructure = 2.2; + const double failureProbabilityOpenStructure = 3.3; + const double failureProbabilityReparation = 4.4; + const int identicalApertures = 5; + const double allowedLevelIncreaseStorageMean = 6.6; + const double allowedLevelIncreaseStorageStandardDeviation = 7.7; + const double modelFactorStorageVolumeMean = 8.8; + const double modelFactorStorageVolumeStandardDeviation = 9.9; + const double storageStructureAreaMean = 10.0; + const double storageStructureAreaVariation = 11.1; + const double modelFactorInflowVolume = 12.2; + const double flowWidthAtBottomProtectionMean = 13.3; + const double flowWidthAtBottomProtectionStandardDeviation = 14.4; + const double criticalOvertoppingDischargeMean = 15.5; + const double criticalOvertoppingDischargeVariation = 16.6; + const double failureProbabilityStructureWithErosion = 17.7; + const double stormDurationMean = 18.8; + const double stormDurationVariation = 19.9; + const double probabilityOpenStructureBeforeFlooding = 20.0; + + // Call + var input = new TestStructuresClosureCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + factorStormDurationOpenStructure, + failureProbabilityOpenStructure, + failureProbabilityReparation, + identicalApertures, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + probabilityOpenStructureBeforeFlooding); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType); + Assert.AreEqual(6, input.IterationMethodId); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(58, 1.1); + yield return new DeterministicHydraRingVariable(63, 2.2); + yield return new DeterministicHydraRingVariable(68, 3.3); + yield return new DeterministicHydraRingVariable(69, 4.4); + yield return new DeterministicHydraRingVariable(71, 5); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 6.6, 7.7); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 8.8, 9.9); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 10.0, 11.1); + yield return new DeterministicHydraRingVariable(97, 12.2); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 13.3, 14.4); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 15.5, 16.6); + yield return new DeterministicHydraRingVariable(105, 17.7); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 18.8, 19.9); + yield return new DeterministicHydraRingVariable(129, 20.0); + } + + private class TestStructuresClosureCalculationInput : StructuresClosureCalculationInput + { + public TestStructuresClosureCalculationInput(long hydraulicBoundaryLocationId, + double sectionNormal, + IEnumerable forelandPoints, + HydraRingBreakWater breakWater, + double gravitationalAcceleration, + double factorStormDurationOpenStructure, + double failureProbabilityOpenStructure, + double failureProbabilityReparation, + int identicalApertures, + double allowedLevelIncreaseStorageMean, double allowedLevelIncreaseStorageStandardDeviation, + double modelFactorStorageVolumeMean, double modelFactorStorageVolumeStandardDeviation, + double storageStructureAreaMean, double storageStructureAreaVariation, + double modelFactorInflowVolume, + double flowWidthAtBottomProtectionMean, double flowWidthAtBottomProtectionStandardDeviation, + double criticalOvertoppingDischargeMean, double criticalOvertoppingDischargeVariation, + double failureProbabilityStructureWithErosion, + double stormDurationMean, double stormDurationVariation, + double probabilityOpenStructureBeforeFlooding) + : base(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + factorStormDurationOpenStructure, + failureProbabilityOpenStructure, + failureProbabilityReparation, + identicalApertures, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + probabilityOpenStructureBeforeFlooding) {} + + public override int? GetSubMechanismModelId(int subMechanismId) + { + throw new NotImplementedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureFloodedCulvertCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,151 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresClosureFloodedCulvertCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 27.7; + const double gravitationalAcceleration = 1.1; + const double factorStormDurationOpenStructure = 2.2; + const double failureProbabilityOpenStructure = 3.3; + const double failureProbabilityReparation = 4.4; + const int identicalApertures = 5; + const double allowedLevelIncreaseStorageMean = 6.6; + const double allowedLevelIncreaseStorageStandardDeviation = 7.7; + const double modelFactorStorageVolumeMean = 8.8; + const double modelFactorStorageVolumeStandardDeviation = 9.9; + const double storageStructureAreaMean = 10.0; + const double storageStructureAreaVariation = 11.1; + const double modelFactorInflowVolume = 12.2; + const double flowWidthAtBottomProtectionMean = 13.3; + const double flowWidthAtBottomProtectionStandardDeviation = 14.4; + const double criticalOvertoppingDischargeMean = 15.5; + const double criticalOvertoppingDischargeVariation = 16.6; + const double failureProbabilityStructureWithErosion = 17.7; + const double stormDurationMean = 18.8; + const double stormDurationVariation = 19.9; + const double probabilityOpenStructureBeforeFlooding = 20.0; + const double drainCoefficientMean = 21.1; + const double drainCoefficientStandardDeviation = 22.2; + const double areaFlowAperturesMean = 23.3; + const double areaFlowAperturesStandardDeviation = 24.4; + const double insideWaterLevelMean = 25.5; + const double insideWaterLevelStandardDeviation = 26.6; + + // Call + var input = new StructuresClosureFloodedCulvertCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + factorStormDurationOpenStructure, + failureProbabilityOpenStructure, + failureProbabilityReparation, + identicalApertures, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + probabilityOpenStructureBeforeFlooding, + drainCoefficientMean, drainCoefficientStandardDeviation, + areaFlowAperturesMean, areaFlowAperturesStandardDeviation, + insideWaterLevelMean, insideWaterLevelStandardDeviation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 107)] + [TestCase(425, 113)] + [TestCase(426, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresClosureFloodedCulvertCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 222, 333, 5.5, 6, 7.7, 8.8, 11, 22, 33, 44, 55, + 66, 77, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(58, 1.1); + yield return new DeterministicHydraRingVariable(63, 2.2); + yield return new NormalHydraRingVariable(66, HydraRingDeviationType.Standard, 21.1, 22.2); + yield return new LogNormalHydraRingVariable(67, HydraRingDeviationType.Standard, 23.3, 24.4); + yield return new DeterministicHydraRingVariable(68, 3.3); + yield return new DeterministicHydraRingVariable(69, 4.4); + yield return new DeterministicHydraRingVariable(71, 5); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 25.5, 26.6); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 6.6, 7.7); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 8.8, 9.9); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 10.0, 11.1); + yield return new DeterministicHydraRingVariable(97, 12.2); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 13.3, 14.4); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 15.5, 16.6); + yield return new DeterministicHydraRingVariable(105, 17.7); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 18.8, 19.9); + yield return new DeterministicHydraRingVariable(129, 20.0); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureLowSillCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureLowSillCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureLowSillCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,156 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresClosureLowSillCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 31.1; + const double gravitationalAcceleration = 1.1; + const double factorStormDurationOpenStructure = 2.2; + const double failureProbabilityOpenStructure = 3.3; + const double failureProbabilityReparation = 4.4; + const int identicalApertures = 5; + const double allowedLevelIncreaseStorageMean = 6.6; + const double allowedLevelIncreaseStorageStandardDeviation = 7.7; + const double modelFactorStorageVolumeMean = 8.8; + const double modelFactorStorageVolumeStandardDeviation = 9.9; + const double storageStructureAreaMean = 10.0; + const double storageStructureAreaVariation = 11.1; + const double modelFactorInflowVolume = 12.2; + const double flowWidthAtBottomProtectionMean = 13.3; + const double flowWidthAtBottomProtectionStandardDeviation = 14.4; + const double criticalOvertoppingDischargeMean = 15.5; + const double criticalOvertoppingDischargeVariation = 16.6; + const double failureProbabilityStructureWithErosion = 17.7; + const double stormDurationMean = 18.8; + const double stormDurationVariation = 19.9; + const double probabilityOpenStructureBeforeFlooding = 20.0; + const double thresholdHeightOpenWeirMean = 21.1; + const double thresholdHeightOpenWeirStandardDeviation = 22.2; + const double insideWaterLevelMean = 23.3; + const double insideWaterLevelStandardDeviation = 24.4; + const double widthFlowAperturesMean = 25.5; + const double widthFlowAperturesStandardDeviation = 26.6; + const double modelFactorLongThresholdMean = 27.7; + const double modelFactorLongThresholdStandardDeviation = 28.8; + + // Call + var input = new StructuresClosureLowSillCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + factorStormDurationOpenStructure, + failureProbabilityOpenStructure, + failureProbabilityReparation, + identicalApertures, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + probabilityOpenStructureBeforeFlooding, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 106)] + [TestCase(425, 111)] + [TestCase(426, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresClosureLowSillCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 222, 333, 5.5, 6, 7.7, 8.8, 11, 22, 33, 44, 55, + 66, 77, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(58, 1.1); + yield return new DeterministicHydraRingVariable(63, 2.2); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 21.1, 22.2); + yield return new DeterministicHydraRingVariable(68, 3.3); + yield return new DeterministicHydraRingVariable(69, 4.4); + yield return new DeterministicHydraRingVariable(71, 5); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 23.3, 24.4); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 6.6, 7.7); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 8.8, 9.9); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 10.0, 11.1); + yield return new DeterministicHydraRingVariable(97, 12.2); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 13.3, 14.4); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 15.5, 16.6); + yield return new DeterministicHydraRingVariable(105, 17.7); + yield return new NormalHydraRingVariable(106, HydraRingDeviationType.Standard, 25.5, 26.6); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 18.8, 19.9); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 27.7, 28.8); + yield return new DeterministicHydraRingVariable(129, 20.0); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureVerticalWallCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureVerticalWallCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresClosureVerticalWallCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,162 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresClosureVerticalWallCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 31.1; + const double gravitationalAcceleration = 1.1; + const double factorStormDurationOpenStructure = 2.2; + const double failureProbabilityOpenStructure = 3.3; + const double failureProbabilityReparation = 4.4; + const int identicalApertures = 5; + const double allowedLevelIncreaseStorageMean = 6.6; + const double allowedLevelIncreaseStorageStandardDeviation = 7.7; + const double modelFactorStorageVolumeMean = 8.8; + const double modelFactorStorageVolumeStandardDeviation = 9.9; + const double storageStructureAreaMean = 10.0; + const double storageStructureAreaVariation = 11.1; + const double modelFactorInflowVolume = 12.2; + const double flowWidthAtBottomProtectionMean = 13.3; + const double flowWidthAtBottomProtectionStandardDeviation = 14.4; + const double criticalOvertoppingDischargeMean = 15.5; + const double criticalOvertoppingDischargeVariation = 16.6; + const double failureProbabilityStructureWithErosion = 17.7; + const double stormDurationMean = 18.8; + const double stormDurationVariation = 19.9; + const double probabilityOpenStructureBeforeFlooding = 20.0; + const double modelFactorOvertoppingFlowMean = 21.1; + const double modelFactorOvertoppingFlowStandardDeviation = 22.2; + const double structureNormalOrientation = 23.3; + const double modelFactorSuperCriticalFlowMean = 24.4; + const double modelFactorSuperCriticalFlowStandardDeviation = 25.5; + const double levelCrestStructureNotClosingMean = 26.6; + const double levelCrestStructureNotClosingStandardDeviation = 27.7; + const double widthFlowAperturesMean = 28.8; + const double widthFlowAperturesStandardDeviation = 29.9; + const double deviationWaveDirection = 30.0; + + // Call + var input = new StructuresClosureVerticalWallCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + factorStormDurationOpenStructure, + failureProbabilityOpenStructure, + failureProbabilityReparation, + identicalApertures, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + probabilityOpenStructureBeforeFlooding, + modelFactorOvertoppingFlowMean, modelFactorOvertoppingFlowStandardDeviation, + structureNormalOrientation, + modelFactorSuperCriticalFlowMean, modelFactorSuperCriticalFlowStandardDeviation, + levelCrestStructureNotClosingMean, levelCrestStructureNotClosingStandardDeviation, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation, + deviationWaveDirection); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresClosure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 105)] + [TestCase(425, 109)] + [TestCase(426, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresClosureVerticalWallCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 222, 333, 5.5, 6, 7.7, 8.8, 11, 22, 33, 44, 55, + 66, 77, 88, 99, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(58, 1.1); + yield return new LogNormalHydraRingVariable(59, HydraRingDeviationType.Standard, 21.1, 22.2); + yield return new DeterministicHydraRingVariable(61, 23.3); + yield return new NormalHydraRingVariable(62, HydraRingDeviationType.Standard, 24.4, 25.5); + yield return new DeterministicHydraRingVariable(63, 2.2); + yield return new DeterministicHydraRingVariable(68, 3.3); + yield return new DeterministicHydraRingVariable(69, 4.4); + yield return new DeterministicHydraRingVariable(71, 5); + yield return new NormalHydraRingVariable(72, HydraRingDeviationType.Standard, 26.6, 27.7); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 6.6, 7.7); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 8.8, 9.9); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 10.0, 11.1); + yield return new DeterministicHydraRingVariable(97, 12.2); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 13.3, 14.4); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 15.5, 16.6); + yield return new DeterministicHydraRingVariable(105, 17.7); + yield return new NormalHydraRingVariable(106, HydraRingDeviationType.Standard, 28.8, 29.9); + yield return new DeterministicHydraRingVariable(107, 30.0); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 18.8, 19.9); + yield return new DeterministicHydraRingVariable(129, 20.0); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresOvertoppingCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresOvertoppingCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresOvertoppingCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresOvertoppingCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 26.6; + const double gravitationalAcceleration = 1.1; + const double modelFactorOvertoppingFlowMean = 2.2; + const double modelFactorOvertoppingFlowStandardDeviation = 3.3; + const double levelCrestStructureMean = 4.4; + const double levelCrestStructureStandardDeviation = 5.5; + const double structureNormalOrientation = 6.6; + const double modelFactorSuperCriticalFlowMean = 7.7; + const double modelFactorSuperCriticalFlowStandardDeviation = 8.8; + const double allowedLevelIncreaseStorageMean = 9.9; + const double allowedLevelIncreaseStorageStandardDeviation = 10.0; + const double modelFactorStorageVolumeMean = 11.1; + const double modelFactorStorageVolumeStandardDeviation = 12.2; + const double storageStructureAreaMean = 13.3; + const double storageStructureAreaVariation = 14.4; + const double modelFactorInflowVolume = 15.5; + const double flowWidthAtBottomProtectionMean = 16.6; + const double flowWidthAtBottomProtectionStandardDeviation = 17.7; + const double criticalOvertoppingDischargeMean = 18.8; + const double criticalOvertoppingDischargeVariation = 19.9; + const double failureProbabilityStructureWithErosion = 20.0; + const double widthFlowAperturesMean = 21.1; + const double widthFlowAperturesStandardDeviation = 22.2; + const double deviationWaveDirection = 23.3; + const double stormDurationMean = 24.4; + const double stormDurationVariation = 25.5; + + // Call + var input = new StructuresOvertoppingCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + modelFactorOvertoppingFlowMean, modelFactorOvertoppingFlowStandardDeviation, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + modelFactorSuperCriticalFlowMean, modelFactorSuperCriticalFlowStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation, + deviationWaveDirection, + stormDurationMean, stormDurationVariation); + + // Assert + const int expectedCalculationTypeId = 1; + const int variableId = 60; + Assert.IsInstanceOf(input); + Assert.AreEqual(expectedCalculationTypeId, input.CalculationTypeId); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresOvertopping, input.FailureMechanismType); + Assert.AreEqual(variableId, input.VariableId); + Assert.AreEqual(6, input.IterationMethodId); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultOvertoppingVariables().ToArray(), input.Variables.ToArray()); + } + + private static IEnumerable GetDefaultOvertoppingVariables() + { + yield return new DeterministicHydraRingVariable(58, 1.1); + yield return new LogNormalHydraRingVariable(59, HydraRingDeviationType.Standard, 2.2, 3.3); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 4.4, 5.5); + yield return new DeterministicHydraRingVariable(61, 6.6); + yield return new NormalHydraRingVariable(62, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 9.9, 10.0); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 11.1, 12.2); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 13.3, 14.4); + yield return new DeterministicHydraRingVariable(97, 15.5); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 16.6, 17.7); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 18.8, 19.9); + yield return new DeterministicHydraRingVariable(105, 20.0); + yield return new NormalHydraRingVariable(106, HydraRingDeviationType.Standard, 21.1, 22.2); + yield return new DeterministicHydraRingVariable(107, 23.3); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 24.4, 25.5); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,266 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresStabilityPointCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 52.2; + const double volumicWeightWater = 1.1; + const double gravitationalAcceleration = 2.2; + const double levelCrestStructureMean = 3.3; + const double levelCrestStructureStandardDeviation = 4.4; + const double structureNormalOrientation = 5.5; + const double factorStormDurationOpenStructure = 6.6; + const double thresholdHeightOpenWeirMean = 7.7; + const double thresholdHeightOpenWeirStandardDeviation = 8.8; + const double insideWaterLevelFailureConstructionMean = 9.9; + const double insideWaterLevelFailureConstructionStandardDeviation = 10.10; + const double failureProbabilityRepairClosure = 11.11; + const double failureCollisionEnergyMean = 12.12; + const double failureCollisionEnergyVariation = 13.13; + const double modelFactorCollisionLoadMean = 14.14; + const double modelFactorCollisionLoadVariation = 15.15; + const double shipMassMean = 16.16; + const double shipMassVariation = 17.17; + const double shipVelocityMean = 18.18; + const double shipVelocityVariation = 19.19; + const int levellingCount = 20; + const double probabilityCollisionSecondaryStructure = 21.21; + const double flowVelocityStructureClosableMean = 22.22; + const double flowVelocityStructureClosableVariation = 23.23; + const double insideWaterLevelMean = 24.24; + const double insideWaterLevelStandardDeviation = 25.25; + const double allowedLevelIncreaseStorageMean = 26.26; + const double allowedLevelIncreaseStorageStandardDeviation = 27.27; + const double modelFactorStorageVolumeMean = 28.28; + const double modelFactorStorageVolumeStandardDeviation = 29.29; + const double storageStructureAreaMean = 30.30; + const double storageStructureAreaVariation = 31.31; + const double modelFactorInflowVolume = 32.32; + const double flowWidthAtBottomProtectionMean = 33.33; + const double flowWidthAtBottomProtectionStandardDeviation = 34.34; + const double criticalOvertoppingDischargeMean = 35.35; + const double criticalOvertoppingDischargeVariation = 36.36; + const double failureProbabilityStructureWithErosion = 37.37; + const double stormDurationMean = 38.38; + const double stormDurationVariation = 39.39; + const double modelFactorLongThresholdMean = 40.40; + const double modelFactorLongThresholdStandardDeviation = 41.41; + const double bankWidthMean = 42.42; + const double bankWidthStandardDeviation = 43.43; + const double evaluationLevel = 44.44; + const double modelFactorLoadEffectMean = 45.45; + const double modelFactorLoadEffectStandardDeviation = 46.46; + const double waveRatioMaxHN = 47.47; + const double waveRatioMaxHStandardDeviation = 48.48; + const double verticalDistance = 49.49; + const double modificationFactorWavesSlowlyVaryingPressureComponent = 50.50; + const double modificationFactorDynamicOrImpulsivePressureComponent = 51.51; + + // Call + var input = new TestStructuresStabilityPointCalculationInput(hydraulicBoundaryLocationId, sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresStructuralFailure, input.FailureMechanismType); + Assert.AreEqual(6, input.IterationMethodId); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(43, 1.1); + yield return new DeterministicHydraRingVariable(58, 2.2); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 3.3, 4.4); + yield return new DeterministicHydraRingVariable(61, 5.5); + yield return new DeterministicHydraRingVariable(63, 6.6); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new NormalHydraRingVariable(82, HydraRingDeviationType.Standard, 9.9, 10.10); + yield return new DeterministicHydraRingVariable(85, 11.11); + yield return new LogNormalHydraRingVariable(86, HydraRingDeviationType.Variation, 12.12, 13.13); + yield return new NormalHydraRingVariable(87, HydraRingDeviationType.Variation, 14.14, 15.15); + yield return new NormalHydraRingVariable(88, HydraRingDeviationType.Variation, 16.16, 17.17); + yield return new NormalHydraRingVariable(89, HydraRingDeviationType.Variation, 18.18, 19.19); + yield return new DeterministicHydraRingVariable(90, 20); + yield return new DeterministicHydraRingVariable(91, 21.21); + yield return new NormalHydraRingVariable(92, HydraRingDeviationType.Variation, 22.22, 23.23); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 24.24, 25.25); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 26.26, 27.27); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 28.28, 29.29); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 30.30, 31.31); + yield return new DeterministicHydraRingVariable(97, 32.32); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 33.33, 34.34); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 35.35, 36.36); + yield return new DeterministicHydraRingVariable(105, 37.37); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 38.38, 39.39); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 40.40, 41.41); + yield return new NormalHydraRingVariable(130, HydraRingDeviationType.Standard, 42.42, 43.43); + yield return new DeterministicHydraRingVariable(131, 44.44); + yield return new NormalHydraRingVariable(132, HydraRingDeviationType.Standard, 45.45, 46.46); + yield return new RayleighNHydraRingVariable(133, HydraRingDeviationType.Standard, 47.47, 48.48); + yield return new DeterministicHydraRingVariable(134, 49.49); + yield return new DeterministicHydraRingVariable(135, 50.50); + yield return new DeterministicHydraRingVariable(136, 51.51); + } + + private class TestStructuresStabilityPointCalculationInput : StructuresStabilityPointCalculationInput + { + public TestStructuresStabilityPointCalculationInput(long hydraulicBoundaryLocationId, double sectionNormal, + IEnumerable forelandPoints, + HydraRingBreakWater breakWater, + double volumicWeightWater, + double gravitationalAcceleration, + double levelCrestStructureMean, double levelCrestStructureStandardDeviation, + double structureNormalOrientation, + double factorStormDurationOpenStructure, + double thresholdHeightOpenWeirMean, double thresholdHeightOpenWeirStandardDeviation, + double insideWaterLevelFailureConstructionMean, double insideWaterLevelFailureConstructionStandardDeviation, + double failureProbabilityRepairClosure, + double failureCollisionEnergyMean, double failureCollisionEnergyVariation, + double modelFactorCollisionLoadMean, double modelFactorCollisionLoadVariation, + double shipMassMean, double shipMassVariation, + double shipVelocityMean, double shipVelocityVariation, + int levellingCount, + double probabilityCollisionSecondaryStructure, + double flowVelocityStructureClosableMean, double flowVelocityStructureClosableVariation, + double insideWaterLevelMean, double insideWaterLevelStandardDeviation, + double allowedLevelIncreaseStorageMean, double allowedLevelIncreaseStorageStandardDeviation, + double modelFactorStorageVolumeMean, double modelFactorStorageVolumeStandardDeviation, + double storageStructureAreaMean, double storageStructureAreaVariation, + double modelFactorInflowVolume, + double flowWidthAtBottomProtectionMean, double flowWidthAtBottomProtectionStandardDeviation, + double criticalOvertoppingDischargeMean, double criticalOvertoppingDischargeVariation, + double failureProbabilityStructureWithErosion, + double stormDurationMean, double stormDurationVariation, + double modelFactorLongThresholdMean, double modelFactorLongThresholdStandardDeviation, + double bankWidthMean, double bankWidthStandardDeviation, + double evaluationLevel, + double modelFactorLoadEffectMean, double modelFactorLoadEffectStandardDeviation, + double waveRatioMaxHN, double waveRatioMaxHStandardDeviation, + double verticalDistance, + double modificationFactorWavesSlowlyVaryingPressureComponent, + double modificationFactorDynamicOrImpulsivePressureComponent) + : base(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent) {} + + public override int? GetSubMechanismModelId(int subMechanismId) + { + throw new NotImplementedException(); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertLinearCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertLinearCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertLinearCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,229 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresStabilityPointFloodedCulvertLinearCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 60.0; + const double volumicWeightWater = 1.1; + const double gravitationalAcceleration = 2.2; + const double levelCrestStructureMean = 3.3; + const double levelCrestStructureStandardDeviation = 4.4; + const double structureNormalOrientation = 5.5; + const double factorStormDurationOpenStructure = 6.6; + const double thresholdHeightOpenWeirMean = 7.7; + const double thresholdHeightOpenWeirStandardDeviation = 8.8; + const double insideWaterLevelFailureConstructionMean = 9.9; + const double insideWaterLevelFailureConstructionStandardDeviation = 10.10; + const double failureProbabilityRepairClosure = 11.11; + const double failureCollisionEnergyMean = 12.12; + const double failureCollisionEnergyVariation = 13.13; + const double modelFactorCollisionLoadMean = 14.14; + const double modelFactorCollisionLoadVariation = 15.15; + const double shipMassMean = 16.16; + const double shipMassVariation = 17.17; + const double shipVelocityMean = 18.18; + const double shipVelocityVariation = 19.19; + const int levellingCount = 20; + const double probabilityCollisionSecondaryStructure = 21.21; + const double flowVelocityStructureClosableMean = 22.22; + const double flowVelocityStructureClosableVariation = 23.23; + const double insideWaterLevelMean = 24.24; + const double insideWaterLevelStandardDeviation = 25.25; + const double allowedLevelIncreaseStorageMean = 26.26; + const double allowedLevelIncreaseStorageStandardDeviation = 27.27; + const double modelFactorStorageVolumeMean = 28.28; + const double modelFactorStorageVolumeStandardDeviation = 29.29; + const double storageStructureAreaMean = 30.30; + const double storageStructureAreaVariation = 31.31; + const double modelFactorInflowVolume = 32.32; + const double flowWidthAtBottomProtectionMean = 33.33; + const double flowWidthAtBottomProtectionStandardDeviation = 34.34; + const double criticalOvertoppingDischargeMean = 35.35; + const double criticalOvertoppingDischargeVariation = 36.36; + const double failureProbabilityStructureWithErosion = 37.37; + const double stormDurationMean = 38.38; + const double stormDurationVariation = 39.39; + const double modelFactorLongThresholdMean = 40.40; + const double modelFactorLongThresholdStandardDeviation = 41.41; + const double bankWidthMean = 42.42; + const double bankWidthStandardDeviation = 43.43; + const double evaluationLevel = 44.44; + const double modelFactorLoadEffectMean = 45.45; + const double modelFactorLoadEffectStandardDeviation = 46.46; + const double waveRatioMaxHN = 47.47; + const double waveRatioMaxHStandardDeviation = 48.48; + const double verticalDistance = 49.49; + const double modificationFactorWavesSlowlyVaryingPressureComponent = 50.50; + const double modificationFactorDynamicOrImpulsivePressureComponent = 51.51; + const double drainCoefficientMean = 52.52; + const double drainCoefficientStandardDeviation = 53.53; + const double areaFlowAperturesMean = 54.54; + const double areaFlowAperturesStandardDeviation = 55.55; + const double constructiveStrengthLinearLoadModelMean = 56.56; + const double constructiveStrengthLinearLoadModelVariation = 57.57; + const double stabilityLinearLoadModelMean = 58.58; + const double stabilityLinearLoadModelVariation = 59.59; + + // Call + var input = new StructuresStabilityPointFloodedCulvertLinearCalculationInput(hydraulicBoundaryLocationId, sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent, + drainCoefficientMean, drainCoefficientStandardDeviation, + areaFlowAperturesMean, areaFlowAperturesStandardDeviation, + constructiveStrengthLinearLoadModelMean, constructiveStrengthLinearLoadModelVariation, + stabilityLinearLoadModelMean, stabilityLinearLoadModelVariation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresStructuralFailure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 107)] + [TestCase(425, 113)] + [TestCase(430, 114)] + [TestCase(435, 116)] + [TestCase(436, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresStabilityPointFloodedCulvertLinearCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, + 11.11, 12.12, 13.13, 14.14, 15.15, 16.16, 17.17, + 18.18, 19.19, 20, 21.21, 22.22, 23.23, 24.24, + 25.25, 26.26, 27.27, 28.28, 29.29, 30.30, 31.31, + 32.32, 33.33, 34.34, 35.35, 36.36, 37.37, 38.38, + 39.39, 40.40, 41.41, 42.42, 43.43, 44.44, 45.45, + 46.46, 47.47, 48.48, 49.49, 50.50, 51.51, 52.52, + 53.53, 54.54, 55.55, 56.56, 57.57, 58.85, 59.59); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(43, 1.1); + yield return new DeterministicHydraRingVariable(58, 2.2); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 3.3, 4.4); + yield return new DeterministicHydraRingVariable(61, 5.5); + yield return new DeterministicHydraRingVariable(63, 6.6); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new NormalHydraRingVariable(66, HydraRingDeviationType.Standard, 52.52, 53.53); + yield return new LogNormalHydraRingVariable(67, HydraRingDeviationType.Standard, 54.54, 55.55); + yield return new LogNormalHydraRingVariable(80, HydraRingDeviationType.Variation, 56.56, 57.57); + yield return new NormalHydraRingVariable(82, HydraRingDeviationType.Standard, 9.9, 10.10); + yield return new LogNormalHydraRingVariable(83, HydraRingDeviationType.Variation, 58.58, 59.59); + yield return new DeterministicHydraRingVariable(85, 11.11); + yield return new LogNormalHydraRingVariable(86, HydraRingDeviationType.Variation, 12.12, 13.13); + yield return new NormalHydraRingVariable(87, HydraRingDeviationType.Variation, 14.14, 15.15); + yield return new NormalHydraRingVariable(88, HydraRingDeviationType.Variation, 16.16, 17.17); + yield return new NormalHydraRingVariable(89, HydraRingDeviationType.Variation, 18.18, 19.19); + yield return new DeterministicHydraRingVariable(90, 20); + yield return new DeterministicHydraRingVariable(91, 21.21); + yield return new NormalHydraRingVariable(92, HydraRingDeviationType.Variation, 22.22, 23.23); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 24.24, 25.25); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 26.26, 27.27); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 28.28, 29.29); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 30.30, 31.31); + yield return new DeterministicHydraRingVariable(97, 32.32); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 33.33, 34.34); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 35.35, 36.36); + yield return new DeterministicHydraRingVariable(105, 37.37); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 38.38, 39.39); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 40.40, 41.41); + yield return new NormalHydraRingVariable(130, HydraRingDeviationType.Standard, 42.42, 43.43); + yield return new DeterministicHydraRingVariable(131, 44.44); + yield return new NormalHydraRingVariable(132, HydraRingDeviationType.Standard, 45.45, 46.46); + yield return new RayleighNHydraRingVariable(133, HydraRingDeviationType.Standard, 47.47, 48.48); + yield return new DeterministicHydraRingVariable(134, 49.49); + yield return new DeterministicHydraRingVariable(135, 50.50); + yield return new DeterministicHydraRingVariable(136, 51.51); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertQuadraticCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertQuadraticCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointFloodedCulvertQuadraticCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,229 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresStabilityPointFloodedCulvertQuadraticCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 60.0; + const double volumicWeightWater = 1.1; + const double gravitationalAcceleration = 2.2; + const double levelCrestStructureMean = 3.3; + const double levelCrestStructureStandardDeviation = 4.4; + const double structureNormalOrientation = 5.5; + const double factorStormDurationOpenStructure = 6.6; + const double thresholdHeightOpenWeirMean = 7.7; + const double thresholdHeightOpenWeirStandardDeviation = 8.8; + const double insideWaterLevelFailureConstructionMean = 9.9; + const double insideWaterLevelFailureConstructionStandardDeviation = 10.10; + const double failureProbabilityRepairClosure = 11.11; + const double failureCollisionEnergyMean = 12.12; + const double failureCollisionEnergyVariation = 13.13; + const double modelFactorCollisionLoadMean = 14.14; + const double modelFactorCollisionLoadVariation = 15.15; + const double shipMassMean = 16.16; + const double shipMassVariation = 17.17; + const double shipVelocityMean = 18.18; + const double shipVelocityVariation = 19.19; + const int levellingCount = 20; + const double probabilityCollisionSecondaryStructure = 21.21; + const double flowVelocityStructureClosableMean = 22.22; + const double flowVelocityStructureClosableVariation = 23.23; + const double insideWaterLevelMean = 24.24; + const double insideWaterLevelStandardDeviation = 25.25; + const double allowedLevelIncreaseStorageMean = 26.26; + const double allowedLevelIncreaseStorageStandardDeviation = 27.27; + const double modelFactorStorageVolumeMean = 28.28; + const double modelFactorStorageVolumeStandardDeviation = 29.29; + const double storageStructureAreaMean = 30.30; + const double storageStructureAreaVariation = 31.31; + const double modelFactorInflowVolume = 32.32; + const double flowWidthAtBottomProtectionMean = 33.33; + const double flowWidthAtBottomProtectionStandardDeviation = 34.34; + const double criticalOvertoppingDischargeMean = 35.35; + const double criticalOvertoppingDischargeVariation = 36.36; + const double failureProbabilityStructureWithErosion = 37.37; + const double stormDurationMean = 38.38; + const double stormDurationVariation = 39.39; + const double modelFactorLongThresholdMean = 40.40; + const double modelFactorLongThresholdStandardDeviation = 41.41; + const double bankWidthMean = 42.42; + const double bankWidthStandardDeviation = 43.43; + const double evaluationLevel = 44.44; + const double modelFactorLoadEffectMean = 45.45; + const double modelFactorLoadEffectStandardDeviation = 46.46; + const double waveRatioMaxHN = 47.47; + const double waveRatioMaxHStandardDeviation = 48.48; + const double verticalDistance = 49.49; + const double modificationFactorWavesSlowlyVaryingPressureComponent = 50.50; + const double modificationFactorDynamicOrImpulsivePressureComponent = 51.51; + const double drainCoefficientMean = 52.52; + const double drainCoefficientStandardDeviation = 53.53; + const double areaFlowAperturesMean = 54.54; + const double areaFlowAperturesStandardDeviation = 55.55; + const double constructiveStrengthQuadraticLoadModelMean = 56.56; + const double constructiveStrengthQuadraticLoadModelVariation = 57.57; + const double stabilityQuadraticLoadModelMean = 58.58; + const double stabilityQuadraticLoadModelVariation = 59.59; + + // Call + var input = new StructuresStabilityPointFloodedCulvertQuadraticCalculationInput(hydraulicBoundaryLocationId, sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent, + drainCoefficientMean, drainCoefficientStandardDeviation, + areaFlowAperturesMean, areaFlowAperturesStandardDeviation, + constructiveStrengthQuadraticLoadModelMean, constructiveStrengthQuadraticLoadModelVariation, + stabilityQuadraticLoadModelMean, stabilityQuadraticLoadModelVariation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresStructuralFailure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 107)] + [TestCase(425, 113)] + [TestCase(430, 115)] + [TestCase(435, 117)] + [TestCase(436, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresStabilityPointFloodedCulvertQuadraticCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, + 11.11, 12.12, 13.13, 14.14, 15.15, 16.16, 17.17, + 18.18, 19.19, 20, 21.21, 22.22, 23.23, 24.24, + 25.25, 26.26, 27.27, 28.28, 29.29, 30.30, 31.31, + 32.32, 33.33, 34.34, 35.35, 36.36, 37.37, 38.38, + 39.39, 40.40, 41.41, 42.42, 43.43, 44.44, 45.45, + 46.46, 47.47, 48.48, 49.49, 50.50, 51.51, 52.52, + 53.53, 54.54, 55.55, 56.56, 57.57, 58.58, 59.59); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(43, 1.1); + yield return new DeterministicHydraRingVariable(58, 2.2); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 3.3, 4.4); + yield return new DeterministicHydraRingVariable(61, 5.5); + yield return new DeterministicHydraRingVariable(63, 6.6); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new NormalHydraRingVariable(66, HydraRingDeviationType.Standard, 52.52, 53.53); + yield return new LogNormalHydraRingVariable(67, HydraRingDeviationType.Standard, 54.54, 55.55); + yield return new LogNormalHydraRingVariable(81, HydraRingDeviationType.Variation, 56.56, 57.57); + yield return new NormalHydraRingVariable(82, HydraRingDeviationType.Standard, 9.9, 10.10); + yield return new LogNormalHydraRingVariable(84, HydraRingDeviationType.Variation, 58.58, 59.59); + yield return new DeterministicHydraRingVariable(85, 11.11); + yield return new LogNormalHydraRingVariable(86, HydraRingDeviationType.Variation, 12.12, 13.13); + yield return new NormalHydraRingVariable(87, HydraRingDeviationType.Variation, 14.14, 15.15); + yield return new NormalHydraRingVariable(88, HydraRingDeviationType.Variation, 16.16, 17.17); + yield return new NormalHydraRingVariable(89, HydraRingDeviationType.Variation, 18.18, 19.19); + yield return new DeterministicHydraRingVariable(90, 20); + yield return new DeterministicHydraRingVariable(91, 21.21); + yield return new NormalHydraRingVariable(92, HydraRingDeviationType.Variation, 22.22, 23.23); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 24.24, 25.25); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 26.26, 27.27); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 28.28, 29.29); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 30.30, 31.31); + yield return new DeterministicHydraRingVariable(97, 32.32); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 33.33, 34.34); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 35.35, 36.36); + yield return new DeterministicHydraRingVariable(105, 37.37); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 38.38, 39.39); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 40.40, 41.41); + yield return new NormalHydraRingVariable(130, HydraRingDeviationType.Standard, 42.42, 43.43); + yield return new DeterministicHydraRingVariable(131, 44.44); + yield return new NormalHydraRingVariable(132, HydraRingDeviationType.Standard, 45.45, 46.46); + yield return new RayleighNHydraRingVariable(133, HydraRingDeviationType.Standard, 47.47, 48.48); + yield return new DeterministicHydraRingVariable(134, 49.49); + yield return new DeterministicHydraRingVariable(135, 50.50); + yield return new DeterministicHydraRingVariable(136, 51.51); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillLinearCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillLinearCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillLinearCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,225 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresStabilityPointLowSillLinearCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 60.0; + const double volumicWeightWater = 1.1; + const double gravitationalAcceleration = 2.2; + const double levelCrestStructureMean = 3.3; + const double levelCrestStructureStandardDeviation = 4.4; + const double structureNormalOrientation = 5.5; + const double factorStormDurationOpenStructure = 6.6; + const double thresholdHeightOpenWeirMean = 7.7; + const double thresholdHeightOpenWeirStandardDeviation = 8.8; + const double insideWaterLevelFailureConstructionMean = 9.9; + const double insideWaterLevelFailureConstructionStandardDeviation = 10.10; + const double failureProbabilityRepairClosure = 11.11; + const double failureCollisionEnergyMean = 12.12; + const double failureCollisionEnergyVariation = 13.13; + const double modelFactorCollisionLoadMean = 14.14; + const double modelFactorCollisionLoadVariation = 15.15; + const double shipMassMean = 16.16; + const double shipMassVariation = 17.17; + const double shipVelocityMean = 18.18; + const double shipVelocityVariation = 19.19; + const int levellingCount = 20; + const double probabilityCollisionSecondaryStructure = 21.21; + const double flowVelocityStructureClosableMean = 22.22; + const double flowVelocityStructureClosableVariation = 23.23; + const double insideWaterLevelMean = 24.24; + const double insideWaterLevelStandardDeviation = 25.25; + const double allowedLevelIncreaseStorageMean = 26.26; + const double allowedLevelIncreaseStorageStandardDeviation = 27.27; + const double modelFactorStorageVolumeMean = 28.28; + const double modelFactorStorageVolumeStandardDeviation = 29.29; + const double storageStructureAreaMean = 30.30; + const double storageStructureAreaVariation = 31.31; + const double modelFactorInflowVolume = 32.32; + const double flowWidthAtBottomProtectionMean = 33.33; + const double flowWidthAtBottomProtectionStandardDeviation = 34.34; + const double criticalOvertoppingDischargeMean = 35.35; + const double criticalOvertoppingDischargeVariation = 36.36; + const double failureProbabilityStructureWithErosion = 37.37; + const double stormDurationMean = 38.38; + const double stormDurationVariation = 39.39; + const double modelFactorLongThresholdMean = 40.40; + const double modelFactorLongThresholdStandardDeviation = 41.41; + const double bankWidthMean = 42.42; + const double bankWidthStandardDeviation = 43.43; + const double evaluationLevel = 44.44; + const double modelFactorLoadEffectMean = 45.45; + const double modelFactorLoadEffectStandardDeviation = 46.46; + const double waveRatioMaxHN = 47.47; + const double waveRatioMaxHStandardDeviation = 48.48; + const double verticalDistance = 49.49; + const double modificationFactorWavesSlowlyVaryingPressureComponent = 50.50; + const double modificationFactorDynamicOrImpulsivePressureComponent = 51.51; + const double constructiveStrengthLinearLoadModelMean = 52.52; + const double constructiveStrengthLinearLoadModelVariation = 53.53; + const double stabilityLinearLoadModelMean = 54.54; + const double stabilityLinearLoadModelVariation = 55.55; + const double widthFlowAperturesMean = 56.56; + const double widthFlowAperturesStandardDeviation = 57.57; + + // Call + var input = new StructuresStabilityPointLowSillLinearCalculationInput(hydraulicBoundaryLocationId, sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent, + constructiveStrengthLinearLoadModelMean, constructiveStrengthLinearLoadModelVariation, + stabilityLinearLoadModelMean, stabilityLinearLoadModelVariation, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresStructuralFailure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 106)] + [TestCase(425, 111)] + [TestCase(430, 114)] + [TestCase(435, 116)] + [TestCase(436, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresStabilityPointLowSillLinearCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, + 11.11, 12.12, 13.13, 14.14, 15.15, 16.16, 17.17, + 18.18, 19.19, 20, 21.21, 22.22, 23.23, 24.24, + 25.25, 26.26, 27.27, 28.28, 29.29, 30.30, 31.31, + 32.32, 33.33, 34.34, 35.35, 36.36, 37.37, 38.38, + 39.39, 40.40, 41.41, 42.42, 43.43, 44.44, 45.45, + 46.46, 47.47, 48.48, 49.49, 50.50, 51.51, 52.52, + 53.53, 54.54, 55.55, 56.56, 57.57); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(43, 1.1); + yield return new DeterministicHydraRingVariable(58, 2.2); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 3.3, 4.4); + yield return new DeterministicHydraRingVariable(61, 5.5); + yield return new DeterministicHydraRingVariable(63, 6.6); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new LogNormalHydraRingVariable(80, HydraRingDeviationType.Variation, 52.52, 53.53); + yield return new NormalHydraRingVariable(82, HydraRingDeviationType.Standard, 9.9, 10.10); + yield return new LogNormalHydraRingVariable(83, HydraRingDeviationType.Variation, 54.54, 55.55); + yield return new DeterministicHydraRingVariable(85, 11.11); + yield return new LogNormalHydraRingVariable(86, HydraRingDeviationType.Variation, 12.12, 13.13); + yield return new NormalHydraRingVariable(87, HydraRingDeviationType.Variation, 14.14, 15.15); + yield return new NormalHydraRingVariable(88, HydraRingDeviationType.Variation, 16.16, 17.17); + yield return new NormalHydraRingVariable(89, HydraRingDeviationType.Variation, 18.18, 19.19); + yield return new DeterministicHydraRingVariable(90, 20); + yield return new DeterministicHydraRingVariable(91, 21.21); + yield return new NormalHydraRingVariable(92, HydraRingDeviationType.Variation, 22.22, 23.23); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 24.24, 25.25); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 26.26, 27.27); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 28.28, 29.29); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 30.30, 31.31); + yield return new DeterministicHydraRingVariable(97, 32.32); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 33.33, 34.34); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 35.35, 36.36); + yield return new DeterministicHydraRingVariable(105, 37.37); + yield return new NormalHydraRingVariable(106, HydraRingDeviationType.Standard, 56.56, 57.57); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 38.38, 39.39); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 40.40, 41.41); + yield return new NormalHydraRingVariable(130, HydraRingDeviationType.Standard, 42.42, 43.43); + yield return new DeterministicHydraRingVariable(131, 44.44); + yield return new NormalHydraRingVariable(132, HydraRingDeviationType.Standard, 45.45, 46.46); + yield return new RayleighNHydraRingVariable(133, HydraRingDeviationType.Standard, 47.47, 48.48); + yield return new DeterministicHydraRingVariable(134, 49.49); + yield return new DeterministicHydraRingVariable(135, 50.50); + yield return new DeterministicHydraRingVariable(136, 51.51); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillQuadraticCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillQuadraticCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/Structures/StructuresStabilityPointLowSillQuadraticCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,225 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.Structures +{ + [TestFixture] + public class StructuresStabilityPointLowSillQuadraticCalculationInputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int hydraulicBoundaryLocationId = 1000; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 1.1); + + const double sectionNormal = 60.0; + const double volumicWeightWater = 1.1; + const double gravitationalAcceleration = 2.2; + const double levelCrestStructureMean = 3.3; + const double levelCrestStructureStandardDeviation = 4.4; + const double structureNormalOrientation = 5.5; + const double factorStormDurationOpenStructure = 6.6; + const double thresholdHeightOpenWeirMean = 7.7; + const double thresholdHeightOpenWeirStandardDeviation = 8.8; + const double insideWaterLevelFailureConstructionMean = 9.9; + const double insideWaterLevelFailureConstructionStandardDeviation = 10.10; + const double failureProbabilityRepairClosure = 11.11; + const double failureCollisionEnergyMean = 12.12; + const double failureCollisionEnergyVariation = 13.13; + const double modelFactorCollisionLoadMean = 14.14; + const double modelFactorCollisionLoadVariation = 15.15; + const double shipMassMean = 16.16; + const double shipMassVariation = 17.17; + const double shipVelocityMean = 18.18; + const double shipVelocityVariation = 19.19; + const int levellingCount = 20; + const double probabilityCollisionSecondaryStructure = 21.21; + const double flowVelocityStructureClosableMean = 22.22; + const double flowVelocityStructureClosableVariation = 23.23; + const double insideWaterLevelMean = 24.24; + const double insideWaterLevelStandardDeviation = 25.25; + const double allowedLevelIncreaseStorageMean = 26.26; + const double allowedLevelIncreaseStorageStandardDeviation = 27.27; + const double modelFactorStorageVolumeMean = 28.28; + const double modelFactorStorageVolumeStandardDeviation = 29.29; + const double storageStructureAreaMean = 30.30; + const double storageStructureAreaVariation = 31.31; + const double modelFactorInflowVolume = 32.32; + const double flowWidthAtBottomProtectionMean = 33.33; + const double flowWidthAtBottomProtectionStandardDeviation = 34.34; + const double criticalOvertoppingDischargeMean = 35.35; + const double criticalOvertoppingDischargeVariation = 36.36; + const double failureProbabilityStructureWithErosion = 37.37; + const double stormDurationMean = 38.38; + const double stormDurationVariation = 39.39; + const double modelFactorLongThresholdMean = 40.40; + const double modelFactorLongThresholdStandardDeviation = 41.41; + const double bankWidthMean = 42.42; + const double bankWidthStandardDeviation = 43.43; + const double evaluationLevel = 44.44; + const double modelFactorLoadEffectMean = 45.45; + const double modelFactorLoadEffectStandardDeviation = 46.46; + const double waveRatioMaxHN = 47.47; + const double waveRatioMaxHStandardDeviation = 48.48; + const double verticalDistance = 49.49; + const double modificationFactorWavesSlowlyVaryingPressureComponent = 50.50; + const double modificationFactorDynamicOrImpulsivePressureComponent = 51.51; + const double constructiveStrengthQuadraticLoadModelMean = 52.52; + const double constructiveStrengthQuadraticLoadModelVariation = 53.53; + const double stabilityQuadraticLoadModelMean = 54.54; + const double stabilityQuadraticLoadModelVariation = 55.55; + const double widthFlowAperturesMean = 56.56; + const double widthFlowAperturesStandardDeviation = 57.57; + + // Call + var input = new StructuresStabilityPointLowSillQuadraticCalculationInput(hydraulicBoundaryLocationId, sectionNormal, + forelandPoints, breakWater, + volumicWeightWater, + gravitationalAcceleration, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + factorStormDurationOpenStructure, + thresholdHeightOpenWeirMean, thresholdHeightOpenWeirStandardDeviation, + insideWaterLevelFailureConstructionMean, insideWaterLevelFailureConstructionStandardDeviation, + failureProbabilityRepairClosure, + failureCollisionEnergyMean, failureCollisionEnergyVariation, + modelFactorCollisionLoadMean, modelFactorCollisionLoadVariation, + shipMassMean, shipMassVariation, + shipVelocityMean, shipVelocityVariation, + levellingCount, + probabilityCollisionSecondaryStructure, + flowVelocityStructureClosableMean, flowVelocityStructureClosableVariation, + insideWaterLevelMean, insideWaterLevelStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + stormDurationMean, stormDurationVariation, + modelFactorLongThresholdMean, modelFactorLongThresholdStandardDeviation, + bankWidthMean, bankWidthStandardDeviation, + evaluationLevel, + modelFactorLoadEffectMean, modelFactorLoadEffectStandardDeviation, + waveRatioMaxHN, waveRatioMaxHStandardDeviation, + verticalDistance, + modificationFactorWavesSlowlyVaryingPressureComponent, + modificationFactorDynamicOrImpulsivePressureComponent, + constructiveStrengthQuadraticLoadModelMean, constructiveStrengthQuadraticLoadModelVariation, + stabilityQuadraticLoadModelMean, stabilityQuadraticLoadModelVariation, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation); + + // Assert + Assert.IsInstanceOf(input); + Assert.AreEqual(hydraulicBoundaryLocationId, input.HydraulicBoundaryLocationId); + Assert.AreEqual(1, input.CalculationTypeId); + Assert.AreEqual(58, input.VariableId); + Assert.AreEqual(HydraRingFailureMechanismType.StructuresStructuralFailure, input.FailureMechanismType); + + HydraRingSection section = input.Section; + Assert.AreEqual(1, section.SectionId); + Assert.IsNaN(section.SectionLength); + Assert.AreEqual(sectionNormal, section.CrossSectionNormal); + Assert.AreSame(forelandPoints, input.ForelandsPoints); + Assert.AreSame(breakWater, input.BreakWater); + HydraRingDataEqualityHelper.AreEqual(GetDefaultVariables().ToArray(), input.Variables.ToArray()); + } + + [Test] + [TestCase(423, null)] + [TestCase(424, 106)] + [TestCase(425, 111)] + [TestCase(430, 115)] + [TestCase(435, 117)] + [TestCase(436, null)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Setup + var input = new StructuresStabilityPointLowSillQuadraticCalculationInput(111, double.NaN, + Enumerable.Empty(), + new HydraRingBreakWater(1, 1.1), + 1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.10, + 11.11, 12.12, 13.13, 14.14, 15.15, 16.16, 17.17, + 18.18, 19.19, 20, 21.21, 22.22, 23.23, 24.24, + 25.25, 26.26, 27.27, 28.28, 29.29, 30.30, 31.31, + 32.32, 33.33, 34.34, 35.35, 36.36, 37.37, 38.38, + 39.39, 40.40, 41.41, 42.42, 43.43, 44.44, 45.45, + 46.46, 47.47, 48.48, 49.49, 50.50, 51.51, 52.52, + 53.53, 54.54, 55.55, 56.56, 57.57); + + // Call + int? actualSubMechanismModelId = input.GetSubMechanismModelId(subMechanismModelId); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, actualSubMechanismModelId); + } + + private static IEnumerable GetDefaultVariables() + { + yield return new DeterministicHydraRingVariable(43, 1.1); + yield return new DeterministicHydraRingVariable(58, 2.2); + yield return new NormalHydraRingVariable(60, HydraRingDeviationType.Standard, 3.3, 4.4); + yield return new DeterministicHydraRingVariable(61, 5.5); + yield return new DeterministicHydraRingVariable(63, 6.6); + yield return new NormalHydraRingVariable(65, HydraRingDeviationType.Standard, 7.7, 8.8); + yield return new LogNormalHydraRingVariable(81, HydraRingDeviationType.Variation, 52.52, 53.53); + yield return new NormalHydraRingVariable(82, HydraRingDeviationType.Standard, 9.9, 10.10); + yield return new LogNormalHydraRingVariable(84, HydraRingDeviationType.Variation, 54.54, 55.55); + yield return new DeterministicHydraRingVariable(85, 11.11); + yield return new LogNormalHydraRingVariable(86, HydraRingDeviationType.Variation, 12.12, 13.13); + yield return new NormalHydraRingVariable(87, HydraRingDeviationType.Variation, 14.14, 15.15); + yield return new NormalHydraRingVariable(88, HydraRingDeviationType.Variation, 16.16, 17.17); + yield return new NormalHydraRingVariable(89, HydraRingDeviationType.Variation, 18.18, 19.19); + yield return new DeterministicHydraRingVariable(90, 20); + yield return new DeterministicHydraRingVariable(91, 21.21); + yield return new NormalHydraRingVariable(92, HydraRingDeviationType.Variation, 22.22, 23.23); + yield return new NormalHydraRingVariable(93, HydraRingDeviationType.Standard, 24.24, 25.25); + yield return new LogNormalHydraRingVariable(94, HydraRingDeviationType.Standard, 26.26, 27.27); + yield return new LogNormalHydraRingVariable(95, HydraRingDeviationType.Standard, 28.28, 29.29); + yield return new LogNormalHydraRingVariable(96, HydraRingDeviationType.Variation, 30.30, 31.31); + yield return new DeterministicHydraRingVariable(97, 32.32); + yield return new LogNormalHydraRingVariable(103, HydraRingDeviationType.Standard, 33.33, 34.34); + yield return new LogNormalHydraRingVariable(104, HydraRingDeviationType.Variation, 35.35, 36.36); + yield return new DeterministicHydraRingVariable(105, 37.37); + yield return new NormalHydraRingVariable(106, HydraRingDeviationType.Standard, 56.56, 57.57); + yield return new LogNormalHydraRingVariable(108, HydraRingDeviationType.Variation, 38.38, 39.39); + yield return new NormalHydraRingVariable(125, HydraRingDeviationType.Standard, 40.40, 41.41); + yield return new NormalHydraRingVariable(130, HydraRingDeviationType.Standard, 42.42, 43.43); + yield return new DeterministicHydraRingVariable(131, 44.44); + yield return new NormalHydraRingVariable(132, HydraRingDeviationType.Standard, 45.45, 46.46); + yield return new RayleighNHydraRingVariable(133, HydraRingDeviationType.Standard, 47.47, 48.48); + yield return new DeterministicHydraRingVariable(134, 49.49); + yield return new DeterministicHydraRingVariable(135, 50.50); + yield return new DeterministicHydraRingVariable(136, 51.51); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,108 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Input.WaveConditions; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.WaveConditions +{ + [TestFixture] + public class WaveConditionsCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int sectionId = 111; + const double sectionNormal = 90; + const int hydraulicBoundaryLocationId = 222; + const double norm = 0.333; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 4.4); + const double waterLevel = 5.5; + const double a = 6.6; + const double b = 7.7; + + // Call + var waveConditionsCalculationInput = new WaveConditionsCalculationInputImplementation(sectionId, + sectionNormal, + hydraulicBoundaryLocationId, + norm, + forelandPoints, + breakWater, + waterLevel, + a, + b); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(waveConditionsCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, waveConditionsCalculationInput.FailureMechanismType); + Assert.AreEqual(8, waveConditionsCalculationInput.CalculationTypeId); + Assert.AreEqual(114, waveConditionsCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveConditionsCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveConditionsCalculationInput.Section); + Assert.AreEqual(sectionId, waveConditionsCalculationInput.Section.SectionId); + Assert.AreEqual(sectionNormal, waveConditionsCalculationInput.Section.CrossSectionNormal); + HydraRingDataEqualityHelper.AreEqual(GetExpectedVariables(waterLevel, a, b).ToArray(), waveConditionsCalculationInput.Variables.ToArray()); + Assert.AreSame(forelandPoints, waveConditionsCalculationInput.ForelandsPoints); + Assert.AreSame(breakWater, waveConditionsCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, waveConditionsCalculationInput.Beta); + } + + private class WaveConditionsCalculationInputImplementation : WaveConditionsCalculationInput + { + public WaveConditionsCalculationInputImplementation(int sectionId, + double sectionNormal, + long hydraulicBoundaryLocationId, + double norm, + IEnumerable forelandPoints, + HydraRingBreakWater breakWater, + double waterLevel, + double a, + double b) + : base(sectionId, + sectionNormal, + hydraulicBoundaryLocationId, + norm, + forelandPoints, + breakWater, + waterLevel, + a, + b) {} + } + + private static IEnumerable GetExpectedVariables(double waterLevel, double a, double b) + { + yield return new DeterministicHydraRingVariable(113, waterLevel); + yield return new DeterministicHydraRingVariable(114, 1.0); + yield return new DeterministicHydraRingVariable(115, a); + yield return new DeterministicHydraRingVariable(116, b); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsCosineCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,111 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.WaveConditions; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.WaveConditions +{ + [TestFixture] + public class WaveConditionsCosineCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int sectionId = 111; + const double sectionNormal = 90; + const int hydraulicBoundaryLocationId = 222; + const double norm = 0.333; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 4.4); + + const double waterLevel = 5.5; + const double a = 6.6; + const double b = 7.7; + const double c = 8.8; + + // Call + var waveConditionsCosineCalculationInput = new WaveConditionsCosineCalculationInput(sectionId, + sectionNormal, + hydraulicBoundaryLocationId, + norm, + forelandPoints, + breakWater, + waterLevel, + a, + b, + c); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(waveConditionsCosineCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, waveConditionsCosineCalculationInput.FailureMechanismType); + Assert.AreEqual(8, waveConditionsCosineCalculationInput.CalculationTypeId); + Assert.AreEqual(114, waveConditionsCosineCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveConditionsCosineCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveConditionsCosineCalculationInput.Section); + Assert.AreEqual(sectionId, waveConditionsCosineCalculationInput.Section.SectionId); + Assert.AreEqual(sectionNormal, waveConditionsCosineCalculationInput.Section.CrossSectionNormal); + HydraRingDataEqualityHelper.AreEqual(GetExpectedVariables(waterLevel, a, b, c).ToArray(), waveConditionsCosineCalculationInput.Variables.ToArray()); + Assert.AreSame(forelandPoints, waveConditionsCosineCalculationInput.ForelandsPoints); + Assert.AreSame(breakWater, waveConditionsCosineCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, waveConditionsCosineCalculationInput.Beta); + } + + [Test] + [TestCase(3, null)] + [TestCase(4, null)] + [TestCase(5, 71)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var waveConditionsCosineCalculationInput = new WaveConditionsCosineCalculationInput(111, + 1.1, + 222, + 333, + Enumerable.Empty(), + new HydraRingBreakWater(1, 4.4), + 5.5, + 6.6, + 7.7, + 8.8); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, waveConditionsCosineCalculationInput.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetExpectedVariables(double waterLevel, double a, double b, double c) + { + yield return new DeterministicHydraRingVariable(113, waterLevel); + yield return new DeterministicHydraRingVariable(114, 1.0); + yield return new DeterministicHydraRingVariable(115, a); + yield return new DeterministicHydraRingVariable(116, b); + yield return new DeterministicHydraRingVariable(119, c); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidCalculationInputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidCalculationInputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Input/WaveConditions/WaveConditionsTrapezoidCalculationInputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,114 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Linq; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.WaveConditions; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Input.WaveConditions +{ + [TestFixture] + public class WaveConditionsTrapezoidCalculationInputTest + { + [Test] + public void Constructor_Always_ExpectedValues() + { + // Setup + const int sectionId = 111; + const double sectionNormal = 90; + const int hydraulicBoundaryLocationId = 222; + const double norm = 1.0 / 333; + IEnumerable forelandPoints = Enumerable.Empty(); + var breakWater = new HydraRingBreakWater(1, 4.4); + const double waterLevel = 5.5; + const double a = 6.6; + const double b = 7.7; + const double beta1 = 8.8; + const double beta2 = 9.9; + + // Call + var waveConditionsTrapezoidCalculationInput = new WaveConditionsTrapezoidCalculationInput(sectionId, + sectionNormal, + hydraulicBoundaryLocationId, + norm, + forelandPoints, + breakWater, + waterLevel, + a, + b, + beta1, + beta2); + + // Assert + double expectedBeta = StatisticsConverter.ProbabilityToReliability(norm); + Assert.IsInstanceOf(waveConditionsTrapezoidCalculationInput); + Assert.AreEqual(HydraRingFailureMechanismType.QVariant, waveConditionsTrapezoidCalculationInput.FailureMechanismType); + Assert.AreEqual(8, waveConditionsTrapezoidCalculationInput.CalculationTypeId); + Assert.AreEqual(114, waveConditionsTrapezoidCalculationInput.VariableId); + Assert.AreEqual(hydraulicBoundaryLocationId, waveConditionsTrapezoidCalculationInput.HydraulicBoundaryLocationId); + Assert.IsNotNull(waveConditionsTrapezoidCalculationInput.Section); + Assert.AreEqual(sectionId, waveConditionsTrapezoidCalculationInput.Section.SectionId); + Assert.AreEqual(sectionNormal, waveConditionsTrapezoidCalculationInput.Section.CrossSectionNormal); + HydraRingDataEqualityHelper.AreEqual(GetExpectedVariables(waterLevel, a, b, beta1, beta2).ToArray(), waveConditionsTrapezoidCalculationInput.Variables.ToArray()); + Assert.AreSame(forelandPoints, waveConditionsTrapezoidCalculationInput.ForelandsPoints); + Assert.AreSame(breakWater, waveConditionsTrapezoidCalculationInput.BreakWater); + Assert.AreEqual(expectedBeta, waveConditionsTrapezoidCalculationInput.Beta); + } + + [Test] + [TestCase(3, null)] + [TestCase(4, null)] + [TestCase(5, 70)] + public void GetSubMechanismModelId_Always_ReturnsExpectedValues(int subMechanismModelId, int? expectedSubMechanismModelId) + { + // Call + var waveConditionsTrapezoidCalculationInput = new WaveConditionsTrapezoidCalculationInput(111, + 1.1, + 222, + 0.3333, + Enumerable.Empty(), + new HydraRingBreakWater(1, 4.4), + 5.5, + 6.6, + 7.7, + 8.8, + 9.9); + + // Assert + Assert.AreEqual(expectedSubMechanismModelId, waveConditionsTrapezoidCalculationInput.GetSubMechanismModelId(subMechanismModelId)); + } + + private static IEnumerable GetExpectedVariables(double waterLevel, double a, double b, double beta1, double beta2) + { + yield return new DeterministicHydraRingVariable(113, waterLevel); + yield return new DeterministicHydraRingVariable(114, 1.0); + yield return new DeterministicHydraRingVariable(115, a); + yield return new DeterministicHydraRingVariable(116, b); + yield return new DeterministicHydraRingVariable(117, beta1); + yield return new DeterministicHydraRingVariable(118, beta2); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/DunesBoundaryConditionsCalculationOutputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/DunesBoundaryConditionsCalculationOutputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/DunesBoundaryConditionsCalculationOutputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output +{ + [TestFixture] + public class DunesBoundaryConditionsCalculationOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const double waterLevel = 1.1; + const double waveHeight = 2.2; + const double wavePeriod = 3.3; + + // Call + var output = new DunesBoundaryConditionsCalculationOutput(waterLevel, waveHeight, wavePeriod); + + // Assert + Assert.AreEqual(waterLevel, output.WaterLevel); + Assert.AreEqual(waveHeight, output.WaveHeight); + Assert.AreEqual(wavePeriod, output.WavePeriod); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/FaultTreeIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/FaultTreeIllustrationPointTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/FaultTreeIllustrationPointTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,90 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class FaultTreeIllustrationPointTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(123); + + // Call + TestDelegate call = () => new FaultTreeIllustrationPoint(null, + random.NextDouble(), + Enumerable.Empty(), + random.NextEnumValue()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("name", paramName); + } + + [Test] + public void Constructor_StochastsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(123); + + // Call + TestDelegate call = () => new FaultTreeIllustrationPoint("name", + random.NextDouble(), + null, + random.NextEnumValue()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("stochasts", exception.ParamName); + } + + [Test] + public void Constructor_WithValidParameter_ReturnsNewInstance() + { + // Setup + var random = new Random(123); + const string name = "name"; + double beta = random.NextDouble(); + var combinationType = random.NextEnumValue(); + IEnumerable stochasts = Enumerable.Empty(); + + // Call + var illustrationPoint = new FaultTreeIllustrationPoint(name, beta, stochasts, combinationType); + + // Assert + Assert.IsInstanceOf(illustrationPoint); + Assert.AreEqual(name, illustrationPoint.Name); + CollectionAssert.IsEmpty(illustrationPoint.Stochasts); + Assert.AreEqual(beta, illustrationPoint.Beta); + Assert.AreEqual(combinationType, illustrationPoint.CombinationType); + Assert.AreSame(stochasts, illustrationPoint.Stochasts); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/GeneralResultTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/GeneralResultTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/GeneralResultTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,99 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil.IllustrationPoints; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + public class GeneralResultTest + { + [Test] + public void Constructor_GoverningWindNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new GeneralResult(0, + null, + Enumerable.Empty(), + new Dictionary< + WindDirectionClosingSituation, + IllustrationPointTreeNode>()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("governingWindDirection", paramName); + } + + [Test] + public void Constructor_StochastsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new GeneralResult(0, + new TestWindDirection(), + null, + new Dictionary< + WindDirectionClosingSituation, + IllustrationPointTreeNode>()); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("stochasts", paramName); + } + + [Test] + public void Constructor_IllustrationPointsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new GeneralResult(0, + new TestWindDirection(), + Enumerable.Empty(), + null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("illustrationPoints", paramName); + } + + [Test] + public void Constructor_ValidArguments_ReturnsNewInstance() + { + // Setup + var random = new Random(123); + double beta = random.NextDouble(); + var governingWind = new TestWindDirection(); + IEnumerable stochasts = Enumerable.Empty(); + var illustrationPoints = new Dictionary(); + + // Call + var result = new GeneralResult(beta, governingWind, stochasts, illustrationPoints); + + // Assert + Assert.AreEqual(beta, result.Beta); + Assert.AreSame(governingWind, result.GoverningWindDirection); + Assert.AreSame(stochasts, result.Stochasts); + Assert.AreSame(illustrationPoints, result.IllustrationPoints); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class IllustrationPointResultTest + { + [Test] + public void Constructor_DescriptionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new IllustrationPointResult(null, 0); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("description", paramName); + } + + [Test] + public void Constructor_Always_ReturnsNewInstance() + { + // Setup + const string description = "some description"; + const double value = 123; + + // Call + var result = new IllustrationPointResult(description, value); + + // Assert + Assert.AreEqual(description, result.Description); + Assert.AreEqual(value, result.Value); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointTreeNodeTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointTreeNodeTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointTreeNodeTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class IllustrationPointTreeNodeTest + { + [Test] + public void Constructor_WithoutData_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new IllustrationPointTreeNode(null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("data", exception.ParamName); + } + + [Test] + public void Constructor_WithData_DataIsAssigned() + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + mocks.ReplayAll(); + + // Call + var node = new IllustrationPointTreeNode(data); + + // Assert + Assert.AreSame(data, node.Data); + CollectionAssert.IsEmpty(node.Children); + mocks.VerifyAll(); + } + + [Test] + public void SetChildren_ChildrenNull_ThrowsArgumentNullException() + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + mocks.ReplayAll(); + + var treeNode = new IllustrationPointTreeNode(data); + + // Call + TestDelegate call = () => treeNode.SetChildren(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("children", exception.ParamName); + + mocks.VerifyAll(); + } + + [Test] + [TestCase(1)] + [TestCase(3)] + public void SetChildren_InvalidNrOfChildren_ThrowsInvalidArgumentException(int nrOfChildren) + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + mocks.ReplayAll(); + + var treeNode = new IllustrationPointTreeNode(data); + var childrenToBeAttached = new IllustrationPointTreeNode[nrOfChildren]; + + // Call + TestDelegate call = () => treeNode.SetChildren(childrenToBeAttached); + + // Assert + const string expectedMessage = "Een illustratiepunt node in de foutenboom moet 0 of 2 onderliggende nodes hebben."; + var exception = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + Assert.AreEqual("children", exception.ParamName); + CollectionAssert.IsEmpty(treeNode.Children); + mocks.VerifyAll(); + } + + [Test] + [TestCase(0)] + [TestCase(2)] + public void SetChildren_ValidNrOfChildren_ReturnsExpectedProperties(int nrOfChildren) + { + // Setup + var mocks = new MockRepository(); + var data = mocks.Stub(); + mocks.ReplayAll(); + + var treeNode = new IllustrationPointTreeNode(data); + var childrenToBeAttached = new IllustrationPointTreeNode[nrOfChildren]; + + // Call + treeNode.SetChildren(childrenToBeAttached); + + // Assert + IEnumerable addedChildren = treeNode.Children; + Assert.AreSame(childrenToBeAttached, addedChildren); + Assert.AreEqual(nrOfChildren, addedChildren.Count()); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/StochastTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/StochastTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/StochastTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class StochastTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new Stochast(null, double.NaN, double.NaN); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_WithParameters_ReturnsNewInstance() + { + // Setup + const string name = "stochast name"; + + var random = new Random(21); + double duration = random.NextDouble(); + double alpha = random.NextDouble(); + + // Call + var stochast = new Stochast(name, duration, alpha); + + // Assert + Assert.AreEqual(name, stochast.Name); + Assert.AreEqual(duration, stochast.Duration); + Assert.AreEqual(alpha, stochast.Alpha); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointStochastTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointStochastTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SubMechanismIllustrationPointStochast(null, double.NaN, double.NaN, double.NaN); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_WithParameters_ReturnsNewInstance() + { + // Setup + const string name = "stochast name"; + + var random = new Random(21); + double duration = random.NextDouble(); + double alpha = random.NextDouble(); + double realization = random.NextDouble(); + + // Call + var stochast = new SubMechanismIllustrationPointStochast(name, duration, alpha, realization); + + // Assert + Assert.IsInstanceOf(stochast); + Assert.AreEqual(name, stochast.Name); + Assert.AreEqual(duration, stochast.Duration); + Assert.AreEqual(alpha, stochast.Alpha); + Assert.AreEqual(realization, stochast.Realization); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class SubMechanismIllustrationPointTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint(null, + Enumerable.Empty(), + Enumerable.Empty(), + 123); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_StochastNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Name", null, Enumerable.Empty(), 123); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("stochasts", exception.ParamName); + } + + [Test] + public void Constructor_IllustrationPointResultsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Name", Enumerable.Empty(), null, 123); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("illustrationPointResults", exception.ParamName); + } + + [Test] + public void Constructor_WithParameters_ReturnsNewInstance() + { + // Setup + const string name = "Name"; + + var random = new Random(21); + double beta = random.NextDouble(); + + IEnumerable stochasts = Enumerable.Empty(); + IEnumerable illustrationPointResults = Enumerable.Empty(); + + // Call + var illustrationPoint = new SubMechanismIllustrationPoint(name, stochasts, illustrationPointResults, beta); + + // Assert + Assert.IsInstanceOf(illustrationPoint); + Assert.AreSame(stochasts, illustrationPoint.Stochasts); + Assert.AreSame(illustrationPointResults, illustrationPoint.Results); + Assert.AreEqual(beta, illustrationPoint.Beta); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionClosingSituationTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,113 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil.IllustrationPoints; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class WindDirectionClosingSituationTest + { + [Test] + public void Constructor_WithoutWindDirection_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new WindDirectionClosingSituation(null, string.Empty); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("windDirection", exception.ParamName); + } + + [Test] + public void Constructor_WithoutClosingSituation_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new WindDirectionClosingSituation(new TestWindDirection(), null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("closingSituation", exception.ParamName); + } + + [Test] + public void Constructor_WithParameters_ReturnNewInstance() + { + // Setup + string closingSituation = string.Empty; + var windDirection = new TestWindDirection(); + + // Call + var instance = new WindDirectionClosingSituation(windDirection, closingSituation); + + // Assert + Assert.NotNull(instance); + Assert.AreEqual(closingSituation, instance.ClosingSituation); + Assert.AreSame(windDirection, instance.WindDirection); + } + + [TestFixture] + private class WindDirectionClosingSituationEqualsTest : EqualsTestFixture + { + protected override WindDirectionClosingSituation CreateObject() + { + return CreateWindDirectionClosingSituation(); + } + + protected override DerivedWindDirectionClosingSituation CreateDerivedObject() + { + return new DerivedWindDirectionClosingSituation(CreateWindDirectionClosingSituation()); + } + + private static IEnumerable GetUnequalTestCases() + { + WindDirectionClosingSituation baseCombination = CreateWindDirectionClosingSituation(); + + yield return new TestCaseData(new WindDirectionClosingSituation(CreateWindDirection(30), baseCombination.ClosingSituation)) + .SetName("WindDirection"); + yield return new TestCaseData(new WindDirectionClosingSituation(baseCombination.WindDirection, "Different closing situation")) + .SetName("ClosingSituation"); + } + + private static WindDirectionClosingSituation CreateWindDirectionClosingSituation() + { + return new WindDirectionClosingSituation(CreateWindDirection(21), "WDC"); + } + + private static WindDirection CreateWindDirection(int seed) + { + var random = new Random(seed); + return new WindDirection("Name", random.NextDouble()); + } + } + + private class DerivedWindDirectionClosingSituation : WindDirectionClosingSituation + { + public DerivedWindDirectionClosingSituation(WindDirectionClosingSituation wind) + : base(wind.WindDirection, wind.ClosingSituation) {} + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/WindDirectionTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,103 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output.IllustrationPoints +{ + [TestFixture] + public class WindDirectionTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + double windDirectionAngle = random.NextDouble(); + + // Call + TestDelegate call = () => new WindDirection(null, windDirectionAngle); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_ValidParameters_ReturnsExpectedValues() + { + // Setup + const string windDirectionName = "SSE"; + + var random = new Random(21); + double windDirectionAngle = random.NextDouble(); + + // Call + var direction = new WindDirection(windDirectionName, windDirectionAngle); + + // Assert + Assert.AreEqual(windDirectionName, direction.Name); + Assert.AreEqual(windDirectionAngle, direction.Angle); + } + + [TestFixture] + private class WindDirectionEqualsTest : EqualsTestFixture + { + protected override WindDirection CreateObject() + { + return CreateWindDirection(); + } + + protected override DerivedWindDirection CreateDerivedObject() + { + return new DerivedWindDirection(CreateWindDirection()); + } + + private static IEnumerable GetUnequalTestCases() + { + WindDirection baseDirection = CreateWindDirection(); + + var random = new Random(21); + double offset = random.NextDouble(); + + yield return new TestCaseData(new WindDirection("Different Name", baseDirection.Angle)) + .SetName("Name"); + yield return new TestCaseData(new WindDirection(baseDirection.Name, baseDirection.Angle + offset)) + .SetName("Angle"); + } + + private static WindDirection CreateWindDirection() + { + var random = new Random(21); + return new WindDirection("Name", random.NextDouble()); + } + } + + private class DerivedWindDirection : WindDirection + { + public DerivedWindDirection(WindDirection windDirection) : base(windDirection.Name, windDirection.Angle) {} + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/OvertoppingCalculationWaveHeightOutputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/OvertoppingCalculationWaveHeightOutputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/OvertoppingCalculationWaveHeightOutputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,47 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output +{ + [TestFixture] + public class OvertoppingCalculationWaveHeightOutputTest + { + [Test] + public void Constructor_WithParameters_ExpectedValues() + { + // Setup + var random = new Random(21); + double value = random.NextDouble(); + bool isDominant = Convert.ToBoolean(random.Next(0, 2)); + + // Call + var waveHeightOutput = new OvertoppingCalculationWaveHeightOutput(value, isDominant); + + // Assert + Assert.AreEqual(value, waveHeightOutput.WaveHeight); + Assert.AreEqual(isDominant, waveHeightOutput.IsOvertoppingDominant); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/ReliabilityIndexCalculationOutputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/ReliabilityIndexCalculationOutputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/ReliabilityIndexCalculationOutputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output +{ + [TestFixture] + public class ReliabilityIndexCalculationOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var reliabilityIndexCalculationOutput = new ReliabilityIndexCalculationOutput(1.1, 2.2); + + // Assert + Assert.AreEqual(1.1, reliabilityIndexCalculationOutput.Result); + Assert.AreEqual(2.2, reliabilityIndexCalculationOutput.CalculatedReliabilityIndex); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/WaveConditionsCalculationOutputTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/WaveConditionsCalculationOutputTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Output/WaveConditionsCalculationOutputTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,49 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Output +{ + [TestFixture] + public class WaveConditionsCalculationOutputTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const double waveAngle = 3.0; + const double waveDirection = 5.0; + const double waveHeight = 9.93; + const double wavePeakPeriod = 18; + + // Call + var output = new WaveConditionsCalculationOutput(waveHeight, wavePeakPeriod, waveAngle, waveDirection); + + // Assert + Assert.AreEqual(waveHeight, output.WaveHeight); + Assert.AreEqual(wavePeakPeriod, output.WavePeakPeriod); + Assert.AreEqual(waveAngle, output.WaveAngle); + Assert.AreEqual(waveDirection, output.WaveDirection); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/DesignTablesSettingTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/DesignTablesSettingTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/DesignTablesSettingTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,41 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Settings; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Settings +{ + [TestFixture] + public class DesignTablesSettingTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var designTablesSetting = new DesignTablesSetting(1.1, 2.2); + + // Assert + Assert.AreEqual(1.1, designTablesSetting.ValueMin); + Assert.AreEqual(2.2, designTablesSetting.ValueMax); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/NumericsSettingTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/NumericsSettingTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/NumericsSettingTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Settings; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Settings +{ + [TestFixture] + public class NumericsSettingTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var numericsSetting = new NumericsSetting(1, 2, 3, 4.4, 5.5, 6.6, 7.7, 8, 9, 10, 11.11, 12.12, 13.13, 14); + + // Assert + Assert.AreEqual(1, numericsSetting.CalculationTechniqueId); + Assert.AreEqual(2, numericsSetting.FormStartMethod); + Assert.AreEqual(3, numericsSetting.FormNumberOfIterations); + Assert.AreEqual(4.4, numericsSetting.FormRelaxationFactor); + Assert.AreEqual(5.5, numericsSetting.FormEpsBeta); + Assert.AreEqual(6.6, numericsSetting.FormEpsHoh); + Assert.AreEqual(7.7, numericsSetting.FormEpsZFunc); + Assert.AreEqual(8, numericsSetting.DsStartMethod); + Assert.AreEqual(9, numericsSetting.DsMinNumberOfIterations); + Assert.AreEqual(10, numericsSetting.DsMaxNumberOfIterations); + Assert.AreEqual(11.11, numericsSetting.DsVarCoefficient); + Assert.AreEqual(12.12, numericsSetting.NiUMin); + Assert.AreEqual(13.13, numericsSetting.NiUMax); + Assert.AreEqual(14, numericsSetting.NiNumberSteps); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/PreprocessorSettingTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/PreprocessorSettingTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/PreprocessorSettingTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,74 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Settings; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Settings +{ + [TestFixture] + public class PreprocessorSettingTest + { + [Test] + public void ParameterlessConstructor_ExpectedValues() + { + // Call + var preprocessorSetting = new PreprocessorSetting(); + + // Assert + Assert.IsFalse(preprocessorSetting.RunPreprocessor); + Assert.IsNaN(preprocessorSetting.ValueMin); + Assert.IsNaN(preprocessorSetting.ValueMax); + Assert.IsNull(preprocessorSetting.NumericsSetting); + } + + [Test] + public void ParameteredConstructor_ExpectedValues() + { + // Setup + var random = new Random(21); + double valueMin = random.NextDouble(); + double valueMax = random.NextDouble(); + var numericsSetting = new NumericsSetting(1, 4, 50, 0.15, 0.05, 0.01, 0.01, 0, 2, 20000, 100000, 0.1, -6, 6); + + // Call + var preprocessorSetting = new PreprocessorSetting(valueMin, valueMax, numericsSetting); + + // Assert + Assert.IsTrue(preprocessorSetting.RunPreprocessor); + Assert.AreEqual(valueMin, preprocessorSetting.ValueMin); + Assert.AreEqual(valueMax, preprocessorSetting.ValueMax); + Assert.AreSame(numericsSetting, preprocessorSetting.NumericsSetting); + } + + [Test] + public void ParameteredConstructor_NumericsSettingNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new PreprocessorSetting(1.0, 6.0, null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("numericsSetting", exception.ParamName); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/TimeIntegrationSettingTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/TimeIntegrationSettingTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Settings/TimeIntegrationSettingTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,43 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Settings; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Settings +{ + [TestFixture] + public class TimeIntegrationSettingTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int timeIntegrationSchemeId = 1; + + // Call + var timeIntegrationSetting = new TimeIntegrationSetting(timeIntegrationSchemeId); + + // Assert + Assert.AreEqual(timeIntegrationSchemeId, timeIntegrationSetting.TimeIntegrationSchemeId); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/DeterministicHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/DeterministicHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/DeterministicHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,50 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class DeterministicHydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingVariable = new DeterministicHydraRingVariable(1, 2.2); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(1, hydraRingVariable.VariableId); + Assert.AreEqual(2.2, hydraRingVariable.Value); + Assert.AreEqual(HydraRingDistributionType.Deterministic, hydraRingVariable.DistributionType); + Assert.AreEqual(HydraRingDeviationType.Standard, hydraRingVariable.DeviationType); + Assert.IsNaN(hydraRingVariable.Parameter1); + Assert.IsNaN(hydraRingVariable.Parameter2); + Assert.IsNaN(hydraRingVariable.Parameter3); + Assert.IsNaN(hydraRingVariable.Parameter4); + Assert.IsNaN(hydraRingVariable.CoefficientOfVariation); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/HydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/HydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/HydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,69 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class HydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingVariable = new TestHydraRingVariable(1); + + // Assert + Assert.AreEqual(1, hydraRingVariable.VariableId); + Assert.IsNaN(hydraRingVariable.Value); + Assert.IsNaN(hydraRingVariable.Parameter1); + Assert.IsNaN(hydraRingVariable.Parameter2); + Assert.IsNaN(hydraRingVariable.Parameter3); + Assert.IsNaN(hydraRingVariable.Parameter4); + Assert.IsNaN(hydraRingVariable.CoefficientOfVariation); + } + + private class TestHydraRingVariable : HydraRingVariable + { + public TestHydraRingVariable(int variableId) + : base(variableId) {} + + public override HydraRingDistributionType DistributionType + { + get + { + return HydraRingDistributionType.Normal; + } + } + + public override HydraRingDeviationType DeviationType + { + get + { + return HydraRingDeviationType.Standard; + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/LogNormalHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/LogNormalHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/LogNormalHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,64 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class LogNormalHydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int variableId = 1; + const HydraRingDeviationType deviationType = HydraRingDeviationType.Standard; + const double mean = 2.2; + const double variance = 3.3; + const double shift = 4.4; + + // Call + var hydraRingVariable = new LogNormalHydraRingVariable(variableId, deviationType, mean, variance, shift); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(HydraRingDistributionType.LogNormal, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(variableId, hydraRingVariable.VariableId); + Assert.AreEqual(mean, hydraRingVariable.Parameter1); + Assert.AreEqual(variance, hydraRingVariable.Parameter2); + Assert.AreEqual(shift, hydraRingVariable.Parameter3); + } + + [Test] + public void Constructor_ShiftNotSet_Parameter3NaN() + { + // Call + var hydraRingVariable = new LogNormalHydraRingVariable(1, HydraRingDeviationType.Standard, 2.2, 3.3); + + // Assert + Assert.IsNaN(hydraRingVariable.Parameter3); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/NormalHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/NormalHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/NormalHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class NormalHydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int variableId = 1; + const HydraRingDeviationType deviationType = HydraRingDeviationType.Standard; + const double mean = 2.2; + const double variance = 3.3; + + // Call + var hydraRingVariable = new NormalHydraRingVariable(variableId, deviationType, mean, variance); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(HydraRingDistributionType.Normal, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(variableId, hydraRingVariable.VariableId); + Assert.AreEqual(mean, hydraRingVariable.Parameter1); + Assert.AreEqual(variance, hydraRingVariable.Parameter2); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RandomHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RandomHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RandomHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,65 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class RandomHydraRingVariableTest + { + [Test] + [TestCase(HydraRingDeviationType.Standard, 3.3, double.NaN)] + [TestCase(HydraRingDeviationType.Variation, double.NaN, 3.3)] + public void Constructor_ExpectedValues(HydraRingDeviationType deviationType, double expectedParameter2, double expectedCoefficientOfVariation) + { + // Call + var hydraRingVariable = new TestRandomHydraRingVariable(1, deviationType, 2.2, 3.3); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(1, hydraRingVariable.VariableId); + Assert.IsNaN(hydraRingVariable.Value); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(2.2, hydraRingVariable.Parameter1); + Assert.AreEqual(expectedParameter2, hydraRingVariable.Parameter2); + Assert.IsNaN(hydraRingVariable.Parameter3); + Assert.IsNaN(hydraRingVariable.Parameter4); + Assert.AreEqual(expectedCoefficientOfVariation, hydraRingVariable.CoefficientOfVariation); + } + + private class TestRandomHydraRingVariable : RandomHydraRingVariable + { + public TestRandomHydraRingVariable(int variableId, HydraRingDeviationType deviationType, double mean, double variance) + : base(variableId, deviationType, mean, variance) {} + + public override HydraRingDistributionType DistributionType + { + get + { + return HydraRingDistributionType.Normal; + } + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RayleighNHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RayleighNHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/RayleighNHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class RayleighNHydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int variableId = 1; + const HydraRingDeviationType deviationType = HydraRingDeviationType.Standard; + const double n = 2.2; + const double variance = 3.3; + + // Call + var hydraRingVariable = new RayleighNHydraRingVariable(variableId, deviationType, n, variance); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(HydraRingDistributionType.RayleighN, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(variableId, hydraRingVariable.VariableId); + Assert.AreEqual(variance, hydraRingVariable.Parameter1); + Assert.AreEqual(n, hydraRingVariable.Parameter2); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/TruncatedNormalHydraRingVariableTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/TruncatedNormalHydraRingVariableTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Data/Variables/TruncatedNormalHydraRingVariableTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Variables; + +namespace Riskeer.HydraRing.Calculation.Test.Data.Variables +{ + [TestFixture] + public class TruncatedNormalHydraRingVariableTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + const int variableId = 1; + const HydraRingDeviationType deviationType = HydraRingDeviationType.Standard; + const double mean = 2.2; + const double variance = 3.3; + const double lowerBoundary = 4.4; + const double upperBoundary = 5.5; + + // Call + var hydraRingVariable = new TruncatedNormalHydraRingVariable(variableId, deviationType, mean, variance, lowerBoundary, upperBoundary); + + // Assert + Assert.IsInstanceOf(hydraRingVariable); + Assert.AreEqual(HydraRingDistributionType.TruncatedNormal, hydraRingVariable.DistributionType); + Assert.AreEqual(deviationType, hydraRingVariable.DeviationType); + Assert.AreEqual(variableId, hydraRingVariable.VariableId); + Assert.AreEqual(mean, hydraRingVariable.Parameter1); + Assert.AreEqual(variance, hydraRingVariable.Parameter2); + Assert.AreEqual(lowerBoundary, hydraRingVariable.Parameter3); + Assert.AreEqual(upperBoundary, hydraRingVariable.Parameter4); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingCalculationExceptionTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingCalculationExceptionTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingCalculationExceptionTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,32 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; + +namespace Riskeer.HydraRing.Calculation.Test.Exceptions +{ + [TestFixture] + public class HydraRingCalculationExceptionTest : + CustomExceptionDesignGuidelinesTestFixture {} +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingFileParserExceptionTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingFileParserExceptionTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Exceptions/HydraRingFileParserExceptionTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,32 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; + +namespace Riskeer.HydraRing.Calculation.Test.Exceptions +{ + [TestFixture] + public class HydraRingFileParserExceptionTest : + CustomExceptionDesignGuidelinesTestFixture {} +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,2388 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input.Hydraulics; +using Riskeer.HydraRing.Calculation.Data.Input.Overtopping; +using Riskeer.HydraRing.Calculation.Data.Input.Structures; +using Riskeer.HydraRing.Calculation.Data.Input.WaveConditions; +using Riskeer.HydraRing.Calculation.Data.Settings; +using Riskeer.HydraRing.Calculation.Services; + +namespace Riskeer.HydraRing.Calculation.Test.Integration +{ + [TestFixture] + public class HydraRingConfigurationServiceIntegrationTest + { + private static readonly string hydraRingDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"HydraRing"); + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithAssessmentLevelCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new AssessmentLevelCalculationInput(1, 700004, 1.0 / 10000) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(1.1, 2.2), + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 1, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 9, 26, 0, 0, 0, 0, 1.1, 2.2, 3.71901648545571);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 1, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 1);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithWaveHeightCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new WaveHeightCalculationInput(1, 700004, 1.0 / 10000) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(1.1, 2.2), + NumericsSettings = new Dictionary + { + { + 11, new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 11, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 11, 1, 1, 9, 28, 0, 0, 0, 0, 1.1, 2.2, 3.71901648545571);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 11, 1, 1, 11, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 11, 1, 1, 28, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 11, 1, 1, 11);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithOvertoppingCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + const double dikeHeight = 4.4; + const double modelFactorCriticalOvertopping = 5.5; + const double factorFbMean = 6.6; + const double factorFbStandardDeviation = 7.7; + const double factorFbLowerBoundary = 17.7; + const double factorFbUpperBoundary = 18.8; + const double factorFnMean = 8.8; + const double factorFnStandardDeviation = 9.9; + const double factorFnLowerBoundary = 19.9; + const double factorFnUpperBoundary = 20.0; + const double modelFactorOvertopping = 10.10; + const double criticalOvertoppingMean = 11.11; + const double criticalOvertoppingStandardDeviation = 12.12; + const double modelFactorFrunupMean = 13.13; + const double modelFactorFrunupStandardDeviation = 14.14; + const double modelFactorFrunupLowerBoundary = 21.1; + const double modelFactorFrunupUpperBoundary = 22.2; + const double exponentModelFactorShallowMean = 15.15; + const double exponentModelFactorShallowStandardDeviation = 16.16; + const double exponentModelFactorShallowLowerBoundary = 23.3; + const double exponentModelFactorShallowUpperBoundary = 24.4; + var profilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + var numericsSetting = new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new OvertoppingCalculationInput( + hydraulicBoundaryLocationId, sectionNormal, + profilePoints, forelandPoints, breakWater, + dikeHeight, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(17.17, 18.18), + NumericsSettings = new Dictionary + { + { + 102, numericsSetting + }, + { + 103, numericsSetting + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 101, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 101, 1, 1, 1, 1, 0, 0, 0, 0, 17.17, 18.18, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 102, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 103, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 1, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 8, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 10, 0, 19, 6.6, 7.7, 17.7, 18.8, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 11, 0, 19, 8.8, 9.9, 19.9, 20, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 12, 10.1, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 17, 0, 4, 11.11, 12.12, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 120, 0, 19, 13.13, 14.14, 21.1, 22.2, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 123, 0, 19, 15.15, 16.16, 23.3, 24.4, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 101, 1, 1, 1017);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 102, 94);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 103, 95);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 101, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithDikeHeightCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + const double norm = 1.0 / 1000; + const double modelFactorCriticalOvertopping = 4.4; + const double factorFbMean = 5.5; + const double factorFbStandardDeviation = 6.6; + const double factorFbLowerBoundary = 7.7; + const double factorFbUpperBoundary = 8.8; + const double factorFnMean = 9.9; + const double factorFnStandardDeviation = 10.0; + const double factorFnLowerBoundary = 11.1; + const double factorFnUpperBoundary = 12.2; + const double modelFactorOvertopping = 13.3; + const double criticalOvertoppingMean = 14.4; + const double criticalOvertoppingStandardDeviation = 15.5; + const double modelFactorFrunupMean = 16.6; + const double modelFactorFrunupStandardDeviation = 17.7; + const double modelFactorFrunupLowerBoundary = 18.8; + const double modelFactorFrunupUpperBoundary = 19.9; + const double exponentModelFactorShallowMean = 20.0; + const double exponentModelFactorShallowStandardDeviation = 21.1; + const double exponentModelFactorShallowLowerBoundary = 22.2; + const double exponentModelFactorShallowUpperBoundary = 23.3; + + var profilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + var numericsSetting = new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new DikeHeightCalculationInput(hydraulicBoundaryLocationId, norm, sectionNormal, + profilePoints, forelandPoints, breakWater, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + criticalOvertoppingMean, criticalOvertoppingStandardDeviation, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(16.16, 17.17), + NumericsSettings = new Dictionary + { + { + 102, numericsSetting + }, + { + 103, numericsSetting + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 101, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 101, 1, 1, 9, 1, 0, 0, 0, 0, 16.16, 17.17, 3.09023230616781);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 102, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 103, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 1, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 8, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 10, 0, 19, 5.5, 6.6, 7.7, 8.8, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 11, 0, 19, 9.9, 10, 11.1, 12.2, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 12, 13.3, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 17, 0, 4, 14.4, 15.5, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 120, 0, 19, 16.6, 17.7, 18.8, 19.9, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 123, 0, 19, 20, 21.1, 22.2, 23.3, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 101, 1, 1, 1017);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 102, 94);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 103, 95);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 101, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithOvertoppingRateCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + const double norm = 1.0 / 1000; + const double dikeHeight = 4.4; + const double modelFactorCriticalOvertopping = 5.5; + const double factorFbMean = 6.6; + const double factorFbStandardDeviation = 7.7; + const double factorFbLowerBoundary = 8.8; + const double factorFbUpperBoundary = 9.9; + const double factorFnMean = 10.0; + const double factorFnStandardDeviation = 11.1; + const double factorFnLowerBoundary = 12.2; + const double factorFnUpperBoundary = 13.3; + const double modelFactorOvertopping = 14.4; + const double modelFactorFrunupMean = 15.5; + const double modelFactorFrunupStandardDeviation = 16.6; + const double modelFactorFrunupLowerBoundary = 17.7; + const double modelFactorFrunupUpperBoundary = 18.8; + const double exponentModelFactorShallowMean = 19.9; + const double exponentModelFactorShallowStandardDeviation = 20.0; + const double exponentModelFactorShallowLowerBoundary = 21.1; + const double exponentModelFactorShallowUpperBoundary = 22.2; + + var profilePoints = new List + { + new HydraRingRoughnessProfilePoint(1.1, 2.2, 3.3) + }; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + var numericsSetting = new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new OvertoppingRateCalculationInput(hydraulicBoundaryLocationId, norm, sectionNormal, + profilePoints, forelandPoints, breakWater, + dikeHeight, + modelFactorCriticalOvertopping, + factorFbMean, factorFbStandardDeviation, + factorFbLowerBoundary, factorFbUpperBoundary, + factorFnMean, factorFnStandardDeviation, + factorFnLowerBoundary, factorFnUpperBoundary, + modelFactorOvertopping, + modelFactorFrunupMean, modelFactorFrunupStandardDeviation, + modelFactorFrunupLowerBoundary, modelFactorFrunupUpperBoundary, + exponentModelFactorShallowMean, exponentModelFactorShallowStandardDeviation, + exponentModelFactorShallowLowerBoundary, exponentModelFactorShallowUpperBoundary) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(15.15, 16.16), + NumericsSettings = new Dictionary + { + { + 102, numericsSetting + }, + { + 103, numericsSetting + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 101, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 101, 1, 1, 2, 17, 0, 0, 0, 0, 15.15, 16.16, 3.09023230616781);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 102, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 101, 1, 1, 103, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 1, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 8, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 10, 0, 19, 6.6, 7.7, 8.8, 9.9, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 11, 0, 19, 10, 11.1, 12.2, 13.3, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 12, 14.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 17, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 120, 0, 19, 15.5, 16.6, 17.7, 18.8, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 101, 1, 1, 123, 0, 19, 19.9, 20, 21.1, 22.2, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 101, 1, 1, 1017);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 102, 94);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 103, 95);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 101, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresOvertoppingCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + var numericsSetting = new NumericsSetting(11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6, 6, 25); + + const double gravitationalAcceleration = 4.4; + const double modelFactorOvertoppingMean = 5.5; + const double modelFactorOvertoppingStandardDeviation = 6.6; + const double levelCrestStructureMean = 7.7; + const double levelCrestStructureStandardDeviation = 8.8; + const double structureNormalOrientation = 9.9; + const double modelFactorSuperCriticalFlowMean = 10.10; + const double modelFactorSuperCriticalFlowStandardDeviation = 11.11; + const double allowedLevelIncreaseStorageMean = 12.12; + const double allowedLevelIncreaseStorageStandardDeviation = 13.13; + const double modelFactorStorageVolumeMean = 14.14; + const double modelFactorStorageVolumeStandardDeviation = 15.15; + const double storageStructureAreaMean = 16.16; + const double storageStructureAreaVariation = 17.17; + const double modelFactorInflowVolume = 18.18; + const double flowWidthAtBottomProtectionMean = 19.19; + const double flowWidthAtBottomProtectionStandardDeviation = 20.20; + const double criticalOvertoppingDischargeMean = 21.21; + const double criticalOvertoppingDischargeVariation = 22.22; + const double failureProbabilityStructureWithErosion = 23.23; + const double widthFlowAperturesMean = 24.24; + const double widthFlowAperturesStandardDeviation = 25.25; + const double deviationWaveDirection = 26.26; + const double stormDurationMean = 27.27; + const double stormDurationVariation = 28.28; + + hydraRingConfigurationService.AddHydraRingCalculationInput(new StructuresOvertoppingCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + gravitationalAcceleration, + modelFactorOvertoppingMean, modelFactorOvertoppingStandardDeviation, + levelCrestStructureMean, levelCrestStructureStandardDeviation, + structureNormalOrientation, + modelFactorSuperCriticalFlowMean, modelFactorSuperCriticalFlowStandardDeviation, + allowedLevelIncreaseStorageMean, allowedLevelIncreaseStorageStandardDeviation, + modelFactorStorageVolumeMean, modelFactorStorageVolumeStandardDeviation, + storageStructureAreaMean, storageStructureAreaVariation, + modelFactorInflowVolume, + flowWidthAtBottomProtectionMean, flowWidthAtBottomProtectionStandardDeviation, + criticalOvertoppingDischargeMean, criticalOvertoppingDischargeVariation, + failureProbabilityStructureWithErosion, + widthFlowAperturesMean, widthFlowAperturesStandardDeviation, + deviationWaveDirection, + stormDurationMean, stormDurationVariation) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = new Dictionary + { + { + 421, numericsSetting + }, + { + 422, numericsSetting + }, + { + 423, numericsSetting + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + string expectedCreationScript = + "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 110, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 110, 1, 1, 1, 60, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 110, 1, 1, 421, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 110, 1, 1, 422, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 110, 1, 1, 423, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 58, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 59, 0, 4, 5.5, 6.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 60, 0, 2, 7.7, 8.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 61, 9.9, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 62, 0, 2, 10.1, 11.11, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 94, 0, 4, 12.12, 13.13, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 95, 0, 4, 14.14, 15.15, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 96, 0, 4, 16.16, NULL, NULL, NULL, 0, 17.17, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 97, 18.18, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 103, 0, 4, 19.19, 20.2, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 104, 0, 4, 21.21, NULL, NULL, NULL, 0, 22.22, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 105, 23.23, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 106, 0, 2, 24.24, 25.25, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 107, 26.26, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 110, 1, 1, 108, 0, 4, 27.27, NULL, NULL, NULL, 0, 28.28, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 110, 1, 1, 4404);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 110, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithWaveConditionsCosineCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new WaveConditionsCosineCalculationInput(1, + 56.23, + hydraulicBoundaryLocationId, + 1.0 / 10000, + forelandPoints, + breakWater, + 3.3, + 4.4, + 5.5, + 6.6) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(7.7, 8.8), + NumericsSettings = new Dictionary + { + { + 5, new NumericsSetting(4, 1, 50, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 56.23, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 3, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 3, 1, 1, 8, 114, 0, 0, 0, 0, 7.7, 8.8, 3.71901648545571);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 3, 1, 1, 5, 4, 1, 50, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 4, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 113, 3.3, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 114, 1, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 115, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 116, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 119, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 3, 1, 1, 6);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 4, 1, 1, 10);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 5, 71);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 3, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithWaveConditionsTrapezoidCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new WaveConditionsTrapezoidCalculationInput(1, + 86.48, + hydraulicBoundaryLocationId, + 1.0 / 10000, + forelandPoints, + breakWater, + 3.3, + 4.4, + 5.5, + 6.6, + 7.7) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(8.8, 9.9), + NumericsSettings = new Dictionary + { + { + 5, new NumericsSetting(4, 1, 50, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 86.48, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 3, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 3, 1, 1, 8, 114, 0, 0, 0, 0, 8.8, 9.9, 3.71901648545571);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 3, 1, 1, 5, 4, 1, 50, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 4, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 113, 3.3, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 114, 1, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 115, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 116, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 117, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 3, 1, 1, 118, 7.7, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 3, 1, 1, 6);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 4, 1, 1, 10);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 5, 70);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 3, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresClosureFloodedCulvertCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresClosureFloodedCulvertCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20.0, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresClosureNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 111, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 111, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 426, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 427, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 58, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 63, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 66, 0, 2, 21.1, 22.2, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 67, 0, 4, 23.3, 24.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 68, 3.3, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 69, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 71, 5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 93, 0, 2, 25.5, 26.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 94, 0, 4, 6.6, 7.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 95, 0, 4, 8.8, 9.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 96, 0, 4, 10, NULL, NULL, NULL, 0, 11.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 97, 12.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 103, 0, 4, 13.3, 14.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 104, 0, 4, 15.5, NULL, NULL, NULL, 0, 16.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 105, 17.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 108, 0, 4, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 129, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 111, 1, 1, 4505);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 107);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 113);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 111, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresClosureLowSillCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresClosureLowSillCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20.0, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresClosureNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 111, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 111, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 426, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 427, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 58, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 63, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 65, 0, 2, 21.1, 22.2, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 68, 3.3, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 69, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 71, 5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 93, 0, 2, 23.3, 24.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 94, 0, 4, 6.6, 7.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 95, 0, 4, 8.8, 9.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 96, 0, 4, 10, NULL, NULL, NULL, 0, 11.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 97, 12.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 103, 0, 4, 13.3, 14.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 104, 0, 4, 15.5, NULL, NULL, NULL, 0, 16.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 105, 17.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 106, 0, 2, 25.5, 26.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 108, 0, 4, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 125, 0, 2, 27.7, 28.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 129, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 111, 1, 1, 4505);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 106);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 111);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 111, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresClosureVerticalWallCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresClosureVerticalWallCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20.0, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8, 29.9, 30.0) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresClosureNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 111, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 111, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 426, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 111, 1, 1, 427, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 58, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 59, 0, 4, 21.1, 22.2, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 61, 23.3, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 62, 0, 2, 24.4, 25.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 63, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 68, 3.3, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 69, 4.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 71, 5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 72, 0, 2, 26.6, 27.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 94, 0, 4, 6.6, 7.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 95, 0, 4, 8.8, 9.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 96, 0, 4, 10, NULL, NULL, NULL, 0, 11.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 97, 12.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 103, 0, 4, 13.3, 14.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 104, 0, 4, 15.5, NULL, NULL, NULL, 0, 16.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 105, 17.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 106, 0, 2, 28.8, 29.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 107, 30, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 108, 0, 4, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 111, 1, 1, 129, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 111, 1, 1, 4505);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 105);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 109);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 111, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresStabilityPointFloodedCulvertLinearCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresStabilityPointFloodedCulvertLinearCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5.5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8, 29.9, 30.0, + 31.1, 32.2, 33.3, 34.4, + 35.5, 36.6, 37.7, 38.8, + 39.9, 40.0, 41.1, 42.2, + 43.3, 44.4, 45.5, 46.6, + 47.7, 48.8, 49.9, 50.0, + 51.1, 52.2, 53.3, 54.4, + 55.5, 56.6, 57.7, 58.8, + 59.9) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresStabilityPointNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 112, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 112, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 430, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 431, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 432, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 433, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 434, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 435, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 43, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 58, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 60, 0, 2, 3.3, 4.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 61, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 63, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 65, 0, 2, 7.7, 8.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 66, 0, 2, 52.2, 53.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 67, 0, 4, 54.4, 55.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 80, 0, 4, 56.6, NULL, NULL, NULL, 0, 57.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 82, 0, 2, 9.9, 10, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 83, 0, 4, 58.8, NULL, NULL, NULL, 0, 59.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 85, 11.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 86, 0, 4, 12.2, NULL, NULL, NULL, 0, 13.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 87, 0, 2, 14.4, NULL, NULL, NULL, 0, 15.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 88, 0, 2, 16.6, NULL, NULL, NULL, 0, 17.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 89, 0, 2, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 90, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 91, 21.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 92, 0, 2, 22.2, NULL, NULL, NULL, 0, 23.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 93, 0, 2, 24.4, 25.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 94, 0, 4, 26.6, 27.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 95, 0, 4, 28.8, 29.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 96, 0, 4, 30, NULL, NULL, NULL, 0, 31.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 97, 32.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 103, 0, 4, 33.3, 34.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 104, 0, 4, 35.5, NULL, NULL, NULL, 0, 36.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 105, 37.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 108, 0, 4, 38.8, NULL, NULL, NULL, 0, 39.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 125, 0, 2, 40, 41.1, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 130, 0, 2, 42.2, 43.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 131, 44.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 132, 0, 2, 45.5, 46.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 133, 0, 18, 48.8, 47.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 134, 49.9, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 135, 50, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 136, 51.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 112, 1, 1, 4607);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 107);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 113);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 430, 114);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 435, 116);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 112, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresStabilityPointFloodedCulvertQuadraticCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresStabilityPointFloodedCulvertQuadraticCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5.5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8, 29.9, 30.0, + 31.1, 32.2, 33.3, 34.4, + 35.5, 36.6, 37.7, 38.8, + 39.9, 40.0, 41.1, 42.2, + 43.3, 44.4, 45.5, 46.6, + 47.7, 48.8, 49.9, 50.0, + 51.1, 52.2, 53.3, 54.4, + 55.5, 56.6, 57.7, 58.8, + 59.9) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresStabilityPointNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 112, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 112, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 430, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 431, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 432, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 433, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 434, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 435, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 43, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 58, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 60, 0, 2, 3.3, 4.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 61, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 63, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 65, 0, 2, 7.7, 8.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 66, 0, 2, 52.2, 53.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 67, 0, 4, 54.4, 55.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 81, 0, 4, 56.6, NULL, NULL, NULL, 0, 57.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 82, 0, 2, 9.9, 10, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 84, 0, 4, 58.8, NULL, NULL, NULL, 0, 59.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 85, 11.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 86, 0, 4, 12.2, NULL, NULL, NULL, 0, 13.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 87, 0, 2, 14.4, NULL, NULL, NULL, 0, 15.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 88, 0, 2, 16.6, NULL, NULL, NULL, 0, 17.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 89, 0, 2, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 90, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 91, 21.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 92, 0, 2, 22.2, NULL, NULL, NULL, 0, 23.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 93, 0, 2, 24.4, 25.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 94, 0, 4, 26.6, 27.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 95, 0, 4, 28.8, 29.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 96, 0, 4, 30, NULL, NULL, NULL, 0, 31.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 97, 32.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 103, 0, 4, 33.3, 34.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 104, 0, 4, 35.5, NULL, NULL, NULL, 0, 36.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 105, 37.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 108, 0, 4, 38.8, NULL, NULL, NULL, 0, 39.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 125, 0, 2, 40, 41.1, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 130, 0, 2, 42.2, 43.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 131, 44.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 132, 0, 2, 45.5, 46.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 133, 0, 18, 48.8, 47.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 134, 49.9, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 135, 50, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 136, 51.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 112, 1, 1, 4607);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 107);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 113);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 430, 115);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 435, 117);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 112, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresStabilityPointLowSillLinearCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresStabilityPointLowSillLinearCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5.5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8, 29.9, 30.0, + 31.1, 32.2, 33.3, 34.4, + 35.5, 36.6, 37.7, 38.8, + 39.9, 40.0, 41.1, 42.2, + 43.3, 44.4, 45.5, 46.6, + 47.7, 48.8, 49.9, 50.0, + 51.1, 52.2, 53.3, 54.4, + 55.5, 56.6, 57.7) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresStabilityPointNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 112, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 112, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 430, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 431, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 432, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 433, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 434, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 435, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 43, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 58, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 60, 0, 2, 3.3, 4.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 61, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 63, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 65, 0, 2, 7.7, 8.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 80, 0, 4, 52.2, NULL, NULL, NULL, 0, 53.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 82, 0, 2, 9.9, 10, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 83, 0, 4, 54.4, NULL, NULL, NULL, 0, 55.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 85, 11.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 86, 0, 4, 12.2, NULL, NULL, NULL, 0, 13.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 87, 0, 2, 14.4, NULL, NULL, NULL, 0, 15.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 88, 0, 2, 16.6, NULL, NULL, NULL, 0, 17.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 89, 0, 2, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 90, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 91, 21.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 92, 0, 2, 22.2, NULL, NULL, NULL, 0, 23.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 93, 0, 2, 24.4, 25.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 94, 0, 4, 26.6, 27.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 95, 0, 4, 28.8, 29.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 96, 0, 4, 30, NULL, NULL, NULL, 0, 31.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 97, 32.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 103, 0, 4, 33.3, 34.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 104, 0, 4, 35.5, NULL, NULL, NULL, 0, 36.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 105, 37.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 106, 0, 2, 56.6, 57.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 108, 0, 4, 38.8, NULL, NULL, NULL, 0, 39.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 125, 0, 2, 40, 41.1, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 130, 0, 2, 42.2, 43.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 131, 44.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 132, 0, 2, 45.5, 46.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 133, 0, 18, 48.8, 47.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 134, 49.9, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 135, 50, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 136, 51.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 112, 1, 1, 4607);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 106);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 111);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 430, 114);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 435, 116);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 112, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithStructuresStabilityPointLowSillQuadraticCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + const int hydraulicBoundaryLocationId = 700004; + + const double sectionNormal = 3.3; + var forelandPoints = new List + { + new HydraRingForelandPoint(1.1, 2.2) + }; + var breakWater = new HydraRingBreakWater(1, 2.2); + + hydraRingConfigurationService.AddHydraRingCalculationInput( + new StructuresStabilityPointLowSillQuadraticCalculationInput(hydraulicBoundaryLocationId, + sectionNormal, + forelandPoints, breakWater, + 1.1, 2.2, 3.3, 4.4, 5.5, + 6.6, 7.7, 8.8, 9.9, 10.0, + 11.1, 12.2, 13.3, 14.4, + 15.5, 16.6, 17.7, 18.8, + 19.9, 20, 21.1, 22.2, + 23.3, 24.4, 25.5, 26.6, + 27.7, 28.8, 29.9, 30.0, + 31.1, 32.2, 33.3, 34.4, + 35.5, 36.6, 37.7, 38.8, + 39.9, 40.0, 41.1, 42.2, + 43.3, 44.4, 45.5, 46.6, + 47.7, 48.8, 49.9, 50.0, + 51.1, 52.2, 53.3, 54.4, + 55.5, 56.6, 57.7) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(0, 0), + NumericsSettings = CreateStructuresStabilityPointNumericsSettings(), + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 112, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 112, 1, 1, 1, 58, 0, 0, 0, 0, 0, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 422, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 424, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 425, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 430, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 431, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 432, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 433, 1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 434, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 112, 1, 1, 435, 11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 6, 10000, 40000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 6, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 43, 1.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 58, 2.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 60, 0, 2, 3.3, 4.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 61, 5.5, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 63, 6.6, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 65, 0, 2, 7.7, 8.8, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 81, 0, 4, 52.2, NULL, NULL, NULL, 0, 53.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 82, 0, 2, 9.9, 10, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 84, 0, 4, 54.4, NULL, NULL, NULL, 0, 55.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 85, 11.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 86, 0, 4, 12.2, NULL, NULL, NULL, 0, 13.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 87, 0, 2, 14.4, NULL, NULL, NULL, 0, 15.5, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 88, 0, 2, 16.6, NULL, NULL, NULL, 0, 17.7, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 89, 0, 2, 18.8, NULL, NULL, NULL, 0, 19.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 90, 20, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 91, 21.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 92, 0, 2, 22.2, NULL, NULL, NULL, 0, 23.3, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 93, 0, 2, 24.4, 25.5, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 94, 0, 4, 26.6, 27.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 95, 0, 4, 28.8, 29.9, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 96, 0, 4, 30, NULL, NULL, NULL, 0, 31.1, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 97, 32.2, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 103, 0, 4, 33.3, 34.4, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 104, 0, 4, 35.5, NULL, NULL, NULL, 0, 36.6, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 105, 37.7, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 106, 0, 2, 56.6, 57.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 108, 0, 4, 38.8, NULL, NULL, NULL, 0, 39.9, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 125, 0, 2, 40, 41.1, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 130, 0, 2, 42.2, 43.3, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 131, 44.4, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 132, 0, 2, 45.5, 46.6, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 133, 0, 18, 48.8, 47.7, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 134, 49.9, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 135, 50, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 112, 1, 1, 136, 51.1, 0, 0, NULL, NULL, NULL, 1, 0, 999999);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 112, 1, 1, 4607);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 424, 106);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 425, 111);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 430, 115);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 435, 117);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 112, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 2.2);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_HydraRingConfigurationWithDunesBoundaryConditionsCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.All); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new DunesBoundaryConditionsCalculationInput(1, 700004, 1.0 / 10000) + { + PreprocessorSetting = CreatePreprocessorSetting(runPreprocessor), + DesignTablesSetting = new DesignTablesSetting(1.1, 2.2), + NumericsSettings = new Dictionary + { + { + 6, new NumericsSetting(1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3000, 10000, 0.1, -6, 6, 25) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 0, 0);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 1, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 2, 26, 0, 0, 0, 0, 1.1, 2.2, 3.71901648545571);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 6, 1, 9, 150, 0.15, 0.01, 0.01, 0.01, 2, 3, 3000, 10000, 0.1, -6, 6, 25);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 0, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 8);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + private static PreprocessorSetting CreatePreprocessorSetting(bool runPreprocessor) + { + return runPreprocessor + ? new PreprocessorSetting(1001.1, 1002.2, new NumericsSetting(1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 1016, 1017, 1018.18, 1019.19, 1020.20, 1021)) + : new PreprocessorSetting(); + } + + private static Dictionary CreateStructuresClosureNumericsSettings() + { + var numericsSettingForm = new NumericsSetting(1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6, 6, 25); + var numericsSettingDirs = new NumericsSetting(11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6, 6, 25); + + return new Dictionary + { + { + 422, numericsSettingForm + }, + { + 424, numericsSettingDirs + }, + { + 425, numericsSettingDirs + }, + { + 426, numericsSettingForm + }, + { + 427, numericsSettingForm + } + }; + } + + private static Dictionary CreateStructuresStabilityPointNumericsSettings() + { + var numericsSettingForm = new NumericsSetting(1, 1, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6, 6, 25); + var numericsSettingDir = new NumericsSetting(11, 4, 150, 0.15, 0.005, 0.005, 0.005, 2, 10000, 40000, 0.1, -6, 6, 25); + + return new Dictionary + { + { + 422, numericsSettingForm + }, + { + 424, numericsSettingDir + }, + { + 425, numericsSettingDir + }, + { + 430, numericsSettingDir + }, + { + 431, numericsSettingForm + }, + { + 432, numericsSettingForm + }, + { + 433, numericsSettingForm + }, + { + 434, numericsSettingDir + }, + { + 435, numericsSettingDir + } + }; + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ConvergenceParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ConvergenceParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ConvergenceParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,198 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class ConvergenceParserTest + { + private static readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(ConvergenceParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new ConvergenceParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "InvalidFile"); + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor convergentie gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_WithWorkingDirectoryWithFileWithTrueResultForOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "ConvergenceOnBetaSection2"); + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor convergentie gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ResultNull_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "ConvergenceNull"); + var parser = new ConvergenceParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor convergentie gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + [TestCase("NoConvergenceSection1")] + [TestCase("ConvergenceOnAllButLastIteration")] + public void Parse_WithWorkingDirectoryWithFileWithFalseResult_SetOutputFalse(string testSubDirectory) + { + // Setup + string path = Path.Combine(testDirectory, testSubDirectory); + var parser = new ConvergenceParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.IsFalse(parser.Output); + } + + [Test] + [TestCase("ConvergenceOnBetaSection1")] + [TestCase("ConvergenceOnValueSection1")] + [TestCase("ConvergenceOnValueZeroQVariantSection1")] + [TestCase("ConvergenceOnAllSection1")] + [TestCase("ConvergenceOnBetaAndValueSection1")] + [TestCase("ConvergenceOnBetaAndValueZeroQVariantSection1")] + [TestCase("ConvergenceOnValueAndValueZeroQVariantSection1")] + public void Parse_WithWorkingDirectoryWithFileWithTrueResult_SetOutputTrue(string testSubDirectory) + { + // Setup + string path = Path.Combine(testDirectory, testSubDirectory); + var parser = new ConvergenceParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.IsTrue(parser.Output); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new ConvergenceParser(); + string workingDirectory = Path.Combine(testDirectory, "ValidFile"); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/DunesBoundaryConditionsCalculationParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/DunesBoundaryConditionsCalculationParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/DunesBoundaryConditionsCalculationParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,183 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class DunesBoundaryConditionsCalculationParserTest + { + private const string validFile = "ValidFile"; + + private readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(DunesBoundaryConditionsCalculationParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "InvalidFile"); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende hydraulische belastingen voor duinen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new DunesBoundaryConditionsCalculationParser(); + string workingDirectory = Path.Combine(testDirectory, validFile); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] + [TestCase("ValidFileNoWaveHeight")] + [TestCase("ValidFileNoWavePeriod")] + [TestCase("ValidFileNoWaterLevel")] + [TestCase("ResultsOnAllButLastIteration")] + public void Parse_NotAllColumnsHaveResults_ThrowsHydraRingFileParserException(string subFolder) + { + // Setup + string path = Path.Combine(testDirectory, subFolder); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende hydraulische belastingen voor duinen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ValidDataForOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "OtherSection"); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende hydraulische belastingen voor duinen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ValidData_OutputSet() + { + // Setup + string path = Path.Combine(testDirectory, validFile); + var parser = new DunesBoundaryConditionsCalculationParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.AreEqual(4.29026, parser.Output.WaterLevel); + Assert.AreEqual(10.1528, parser.Output.WaveHeight); + Assert.AreEqual(19.1762, parser.Output.WavePeriod); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ExceedanceProbabilityCalculationParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ExceedanceProbabilityCalculationParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ExceedanceProbabilityCalculationParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,177 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class ExceedanceProbabilityCalculationParserTest + { + private const string validFile = "ValidFile"; + + private readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(ExceedanceProbabilityCalculationParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new ExceedanceProbabilityCalculationParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "InvalidFile"); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de faalkans gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_WithBetaResultOnOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "OtherSection"); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de faalkans gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ValidFileWithBetaResult_OutputSet() + { + // Setup + string path = Path.Combine(testDirectory, validFile); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.AreEqual(3.42848, parser.Output); + } + + [Test] + public void Parse_BetaNull_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "BetaNull"); + var parser = new ExceedanceProbabilityCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de faalkans gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new ExceedanceProbabilityCalculationParser(); + string workingDirectory = Path.Combine(testDirectory, validFile); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/HydraRingDatabaseParseHelperTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/HydraRingDatabaseParseHelperTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/HydraRingDatabaseParseHelperTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,120 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class HydraRingDatabaseParseHelperTest + { + private const string emptyWorkingDirectory = "EmptyWorkingDirectory"; + private const string emptyDatabase = "EmptyDatabase"; + private const string validFile = "ValidFile"; + + private const string query = "SELECT * FROM IterateToGivenBetaConvergence " + + "WHERE OuterIterationId = (SELECT MAX(OuterIterationId) FROM IterateToGivenBetaConvergence);"; + + private static readonly string testDirectory = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, + Path.Combine("Readers", nameof(HydraRingDatabaseParseHelper))); + + [Test] + public void Parse_WorkingDirectoryNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => HydraRingDatabaseParseHelper.ReadSingleLine(null, "", 1, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_QueryNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => HydraRingDatabaseParseHelper.ReadSingleLine("", null, 1, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("query", exception.ParamName); + } + + [Test] + public void Parse_ExceptionMessageNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => HydraRingDatabaseParseHelper.ReadSingleLine("", "", 1, null); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("exceptionMessage", exception.ParamName); + } + + [Test] + public void Parse_ReaderThrowsSQLiteException_ThrowsHydraRingFileParserException() + { + // Setup + string directory = Path.Combine(testDirectory, emptyWorkingDirectory); + + // Call + TestDelegate test = () => HydraRingDatabaseParseHelper.ReadSingleLine(directory, query, 1, ""); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ReaderThrowsSQLiteException_ThrowsHydraRingFileParserExceptionWithCustomMessage() + { + // Setup + const string customMessage = "Exception message"; + string directory = Path.Combine(testDirectory, emptyDatabase); + + // Call + TestDelegate test = () => HydraRingDatabaseParseHelper.ReadSingleLine(directory, query, 1, customMessage); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual(customMessage, exception.Message); + } + + [Test] + public void Parse_ValidData_ReturnResult() + { + // Setup + string directory = Path.Combine(testDirectory, validFile); + + // Call + Dictionary result = HydraRingDatabaseParseHelper.ReadSingleLine(directory, query, 1, ""); + + // Assert + Assert.AreEqual(17, result.Count); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/IllustrationPoints/IllustrationPointsParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/IllustrationPoints/IllustrationPointsParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/IllustrationPoints/IllustrationPointsParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,407 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Data.SQLite; +using System.IO; +using System.Linq; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data.Output.IllustrationPoints; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; +using Riskeer.HydraRing.Calculation.Parsers.IllustrationPoints; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers.IllustrationPoints +{ + [TestFixture] + public class IllustrationPointsParserTest + { + private readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(IllustrationPointsParser)); + + [Test] + public void DefaultConstructor_CreatesNewParserInstance() + { + // Call + var parser = new IllustrationPointsParser(); + + // Assert + Assert.IsInstanceOf(parser); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 0); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er konden geen illustratiepunten worden uitgelezen.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptySchema"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er konden geen illustratiepunten worden uitgelezen.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er konden geen illustratiepunten worden uitgelezen.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + [TestCase("DuplicateBetaSubMechanism")] + [TestCase("DuplicateBetaFaultTree")] + [TestCase("DuplicateBetaGeneralResult")] + public void Parse_MultipleBetaValues_ThrowsHydraRingFileParserException(string workingDirectory) + { + // Setup + string path = Path.Combine(testDirectory, workingDirectory); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Meerdere waarden voor de betrouwbaarheidsindex voor 1 illustratiepunt gevonden in de uitvoer database.", exception.Message); + } + + [Test] + public void Parse_NoGeneralResultBetaValue_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "NoBetaGeneralResult"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Geen waarde voor de betrouwbaarheidsindex voor het algemene resultaat gevonden in de uitvoer database.", exception.Message); + } + + [Test] + public void Parse_NoGoverningWindDirection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "NoGoverningWindDirection"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen maatgevende windrichting gevonden in de uitvoer database.", exception.Message); + } + + [Test] + [TestCase(nameof(IllustrationPointsDatabaseConstants.AlphaValue), IllustrationPointsDatabaseConstants.AlphaValue)] + [TestCase(nameof(IllustrationPointsDatabaseConstants.BetaValue), IllustrationPointsDatabaseConstants.BetaValue)] + [TestCase(nameof(IllustrationPointsDatabaseConstants.Duration), IllustrationPointsDatabaseConstants.Duration)] + [TestCase(nameof(IllustrationPointsDatabaseConstants.IllustrationPointResultValue), IllustrationPointsDatabaseConstants.IllustrationPointResultValue)] + [TestCase(nameof(IllustrationPointsDatabaseConstants.Realization), IllustrationPointsDatabaseConstants.Realization)] + [TestCase(nameof(IllustrationPointsDatabaseConstants.WindDirectionAngle), IllustrationPointsDatabaseConstants.WindDirectionAngle)] + public void Parse_ValueNullInDatabase_ThrowsHydraRingFileParserException(string directoryIdentifier, string identifier) + { + // Setup + string path = Path.Combine(testDirectory, $"Null{directoryIdentifier}"); + var parser = new IllustrationPointsParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual($"Er is geen waarde gevonden voor kolom '{identifier}' tijdens het " + + "uitlezen van de illustratiepunten in de uitvoer database.", exception.Message); + } + + [Test] + public void Parse_ValidStructuresStabilityData_SetsOutputAsExpected() + { + // Setup + string path = Path.Combine(testDirectory, "ValidStructuresStabilityOutputSection1"); + var parser = new IllustrationPointsParser(); + + // Call + parser.Parse(path, 1); + + // Assert + GeneralResult generalResult = parser.Output; + Assert.NotNull(generalResult); + Assert.NotNull(generalResult.GoverningWindDirection); + Assert.AreEqual(30, generalResult.GoverningWindDirection.Angle); + Assert.AreEqual(" 30", generalResult.GoverningWindDirection.Name); + Assert.AreEqual(-3.74187, generalResult.Beta); + Assert.AreEqual(44, generalResult.Stochasts.Count()); + + Dictionary illustrationPointNodes = generalResult.IllustrationPoints; + Assert.AreEqual(12, illustrationPointNodes.Count); + CollectionAssert.AllItemsAreInstancesOfType(illustrationPointNodes.Values.Select(ip => ip.Data), typeof(FaultTreeIllustrationPoint)); + + ICollection faultTrees = new List(); + ICollection subMechanisms = new List(); + GetAllNodes(illustrationPointNodes.Values.First(), faultTrees, subMechanisms); + + Assert.AreEqual(11, faultTrees.Count); + Assert.AreEqual(new[] + { + CombinationType.Or, + CombinationType.Or, + CombinationType.And, + CombinationType.And, + CombinationType.Or, + CombinationType.And, + CombinationType.And, + CombinationType.And, + CombinationType.Or, + CombinationType.And, + CombinationType.And + }, faultTrees.Select(f => f.CombinationType)); + + Assert.AreEqual(12, subMechanisms.Count); + SubMechanismIllustrationPoint subMechanismIllustrationPoint = subMechanisms.First(); + Assert.AreEqual("Bezwijken kunstwerk als gevolg van erosie bodem", subMechanismIllustrationPoint.Name); + Assert.AreEqual(-7.94268, subMechanismIllustrationPoint.Beta); + Assert.AreEqual(new[] + { + Tuple.Create("Faalkans gegeven erosie bodem", -1.0, 4383.0, -7.94268) + }, subMechanismIllustrationPoint.Stochasts.Select(s => Tuple.Create(s.Name, s.Alpha, s.Duration, s.Realization))); + CollectionAssert.IsEmpty(subMechanismIllustrationPoint.Results); + + FaultTreeIllustrationPoint faultTreeIllustrationPoint = faultTrees.First(); + Assert.AreEqual("Bezwijken kunstwerk als gevolg van erosie bodem", subMechanismIllustrationPoint.Name); + Assert.AreEqual(0.508398, faultTreeIllustrationPoint.Beta); + Assert.AreEqual(CombinationType.Or, faultTreeIllustrationPoint.CombinationType); + Assert.AreEqual(44, faultTreeIllustrationPoint.Stochasts.Count()); + Assert.AreEqual(new[] + { + Tuple.Create("Kerende hoogte", 0.0, 4383.0), + Tuple.Create("Modelfactor voor onvolkomen stroming", 0.0, 4383.0), + Tuple.Create("Drempelhoogte", 0.0, 4383.0), + Tuple.Create("Afvoercoefficient", -3.91812E-07, 4383.0), + Tuple.Create("Doorstroomoppervlak", 3.93695E-08, 4383.0), + Tuple.Create("Lineaire belastingschematisering constructieve sterkte", 0.214064, 4383.0) + }, faultTreeIllustrationPoint.Stochasts.Take(6).Select(s => Tuple.Create(s.Name, s.Alpha, s.Duration))); + } + + [Test] + public void Parse_ValidDesignWaterLevelData_SetsGeneralResultAndSubMechanismOutputForAWindDirectionAsExpected() + { + // Setup + string path = Path.Combine(testDirectory, "ValidDesignWaterLevelOutputSection1"); + var parser = new IllustrationPointsParser(); + + // Call + parser.Parse(path, 1); + + // Assert + GeneralResult generalResult = parser.Output; + Assert.NotNull(generalResult); + Assert.NotNull(generalResult.GoverningWindDirection); + Assert.AreEqual(112.5, generalResult.GoverningWindDirection.Angle); + Assert.AreEqual("OZO", generalResult.GoverningWindDirection.Name); + Assert.AreEqual(3.4037, generalResult.Beta); + Assert.AreEqual(6, generalResult.Stochasts.Count()); + Dictionary illustrationPointNodes = generalResult.IllustrationPoints; + Assert.AreEqual(16, illustrationPointNodes.Count); + CollectionAssert.AllItemsAreInstancesOfType(illustrationPointNodes.Values.Select(ip => ip.Data), typeof(SubMechanismIllustrationPoint)); + + ICollection faultTrees = new List(); + ICollection subMechanisms = new List(); + GetAllNodes(illustrationPointNodes.Values.ElementAt(4), faultTrees, subMechanisms); + + CollectionAssert.IsEmpty(faultTrees); + SubMechanismIllustrationPoint subMechanismIllustrationPoint = subMechanisms.Single(); + Assert.AreEqual(5.30273, subMechanismIllustrationPoint.Beta); + Assert.AreEqual("Reference water level", subMechanismIllustrationPoint.Name); + Assert.AreEqual(new[] + { + Tuple.Create("Windrichting", 0.0, 12.0, 0.0), + Tuple.Create("Waterstand IJsselmeer", -0.575813, 96.0, 0.464036), + Tuple.Create("Windsnelheid Schiphol 16 richtingen", -0.749296, 12.0, 19.289), + Tuple.Create("Onzekerheid waterstand IJsselmeer", -0.0695709, 96.0, 0.0146771), + Tuple.Create("Onzekerheid windsnelheid Schiphol 16 richtingen", -0.121567, 12.0, 1.0303), + Tuple.Create("Modelonzekerheid lokale waterstand", -0.295595, 4383.0, 0.235119) + }, subMechanismIllustrationPoint.Stochasts.Select(s => Tuple.Create(s.Name, s.Alpha, s.Duration, s.Realization))); + Assert.AreEqual(new[] + { + Tuple.Create("Z", -0.00136652), + Tuple.Create("Considered water level", 1.24846), + Tuple.Create("Computed local water level", 1.24983) + }, subMechanismIllustrationPoint.Results.Select(s => Tuple.Create(s.Description, s.Value))); + } + + [Test] + public void Parse_ValidFaultTreesMissingWindDirectionClosingSituationCombinations_TreesNotPartOfResult() + { + // Setup + string path = Path.Combine(testDirectory, "MissingWindDirectionClosingSituationFaultTree"); + var parser = new IllustrationPointsParser(); + + // Call + parser.Parse(path, 1); + + // Assert + GeneralResult generalResult = parser.Output; + Assert.NotNull(generalResult); + Assert.NotNull(generalResult.GoverningWindDirection); + Assert.AreEqual(315.0, generalResult.GoverningWindDirection.Angle); + Assert.AreEqual("NW", generalResult.GoverningWindDirection.Name); + Assert.AreEqual(5.98943, generalResult.Beta); + Assert.AreEqual(23, generalResult.Stochasts.Count()); + Dictionary illustrationPointNodes = generalResult.IllustrationPoints; + AssertWindDirectionClosingSituationKeysForAssessmentSection14Dash2(illustrationPointNodes); + } + + [Test] + public void Parse_ValidSubMechanismsMissingWindDirectionClosingSituationCombinations_SubMechanismsNotPartOfResult() + { + // Setup + string path = Path.Combine(testDirectory, "MissingWindDirectionClosingSituationSubMechanism"); + var parser = new IllustrationPointsParser(); + + // Call + parser.Parse(path, 1); + + // Assert + GeneralResult generalResult = parser.Output; + Assert.NotNull(generalResult); + Assert.NotNull(generalResult.GoverningWindDirection); + Assert.AreEqual(315.0, generalResult.GoverningWindDirection.Angle); + Assert.AreEqual("NW", generalResult.GoverningWindDirection.Name); + Assert.AreEqual(4.26568, generalResult.Beta); + Assert.AreEqual(9, generalResult.Stochasts.Count()); + Dictionary illustrationPointNodes = generalResult.IllustrationPoints; + AssertWindDirectionClosingSituationKeysForAssessmentSection14Dash2(illustrationPointNodes); + } + + [Test] + public void Parse_ValidDataForOtherSection_SectionIdIgnoredOutputRead() + { + // Setup + string path = Path.Combine(testDirectory, "ValidStructuresStabilityOutputSection1"); + var parser = new IllustrationPointsParser(); + + // Call + parser.Parse(path, 2); + + // Assert + GeneralResult generalResult = parser.Output; + Assert.NotNull(generalResult); + } + + private static void AssertWindDirectionClosingSituationKeysForAssessmentSection14Dash2(Dictionary illustrationPointNodes) + { + CollectionAssert.AreEqual(new[] + { + new WindDirectionClosingSituation(new WindDirection("N", 0.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("N", 0.0), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("NNO", 22.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("NO", 45.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ONO", 67.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("O", 90.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("OZO", 112.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ZO", 135.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ZZO", 157.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("Z", 180.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ZZW", 202.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ZW", 225.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("ZW", 225.0), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("WZW", 247.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("WZW", 247.5), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("W", 270.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("W", 270.0), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("WNW", 292.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("WNW", 292.5), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("NW", 315.0), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("NW", 315.0), "closed barrier"), + new WindDirectionClosingSituation(new WindDirection("NNW", 337.5), "open barrier"), + new WindDirectionClosingSituation(new WindDirection("NNW", 337.5), "closed barrier") + }, illustrationPointNodes.Keys); + } + + private static void GetAllNodes(IllustrationPointTreeNode tree, ICollection faultTrees, ICollection subMechanisms) + { + var subMechanism = tree.Data as SubMechanismIllustrationPoint; + var faultTree = tree.Data as FaultTreeIllustrationPoint; + if (subMechanism != null) + { + subMechanisms.Add(subMechanism); + } + else if (faultTree != null) + { + faultTrees.Add(faultTree); + } + + foreach (IllustrationPointTreeNode child in tree.Children) + { + GetAllNodes(child, faultTrees, subMechanisms); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/LastErrorFileParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/LastErrorFileParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/LastErrorFileParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,115 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class LastErrorFileParserTest + { + private readonly string noErrorTestDataDirectory = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, + Path.Combine("Parsers", "OutputFileParser")); + + private readonly string lastErrorTestDataDirectory = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, + Path.Combine("Parsers", "LastErrorFileParser")); + + [Test] + public void DefaultConstructor_SetDefaultValues() + { + // Call + var lastErrorFileParser = new LastErrorFileParser(); + + // Assert + Assert.IsInstanceOf(lastErrorFileParser); + } + + [Test] + public void Parse_NotExistingWorkingDirectory_DoesNotThrowException() + { + // Setup + var lastErrorFileParser = new LastErrorFileParser(); + const string nonExistentDirectory = "c:/niet_bestaande_map"; + + // Call + TestDelegate call = () => lastErrorFileParser.Parse(nonExistentDirectory, 1); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void Parse_NotExistingLastErrorOutputFile_DoesNotThrowException() + { + // Setup + var lastErrorFileParser = new LastErrorFileParser(); + + // Call + TestDelegate call = () => lastErrorFileParser.Parse(noErrorTestDataDirectory, 1); + + // Assert + Assert.DoesNotThrow(call); + } + + [Test] + public void Parse_LastErrorFileExists_LastErrorContentSet() + { + // Setup + var lastErrorFileParser = new LastErrorFileParser(); + + // Call + lastErrorFileParser.Parse(lastErrorTestDataDirectory, 1); + + // Assert + string expectedContent = " File not found: D:\\Repos\\Ringtoets\\Ringtoets\\Integration\\test\\Ringtoets.Integra" + + Environment.NewLine + + " tion.Service.Test\\test-data\\HLCD.sqlite" + + Environment.NewLine; + Assert.AreEqual(expectedContent, lastErrorFileParser.ErrorFileContent); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var lastErrorFileParser = new LastErrorFileParser(); + + using (new DirectoryPermissionsRevoker(lastErrorTestDataDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => lastErrorFileParser.Parse(lastErrorTestDataDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + string expectedMessage = $"Kan het Hydra-Ring last_error bestand {HydraRingFileConstants.LastErrorFileName} " + + $"niet lezen uit de map {lastErrorTestDataDirectory}."; + Assert.AreEqual(expectedMessage, exception.Message); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/OvertoppingCalculationWaveHeightParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/OvertoppingCalculationWaveHeightParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/OvertoppingCalculationWaveHeightParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,188 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class OvertoppingCalculationWaveHeightParserTest + { + private const string validFileOvertoppingDominant = "ValidFileOvertoppingDominant"; + + private static readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(OvertoppingCalculationWaveHeightParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + [TestCase("InvalidFile")] + [TestCase("MissingTableDesignBeta")] + [TestCase("MissingTableDesignPointResults")] + [TestCase("MissingTableGoverningWind")] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException(string subFolder) + { + // Setup + string path = Path.Combine(testDirectory, subFolder); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + [TestCase("EmptyDatabase")] + [TestCase("EmptyTableDesignBeta")] + [TestCase("EmptyTableGoverningWind")] + public void Parse_WithDataNotComplete_ThrowsHydraRingFileParserException(string subFolder) + { + // Setup + string path = Path.Combine(testDirectory, subFolder); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor overslag en overloop gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ValidDataForOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "OtherSection"); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor overslag en overloop gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new OvertoppingCalculationWaveHeightParser(); + string workingDirectory = Path.Combine(testDirectory, validFileOvertoppingDominant); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] + [TestCase(validFileOvertoppingDominant, 0.265866, true)] + [TestCase("ValidFileOvertoppingNotDominant", 0.000355406, false)] + public void Parse_ValidData_OutputSet(string file, double expectedWaveHeight, bool expectedOvertoppingDominant) + { + // Setup + string path = Path.Combine(testDirectory, file); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.AreEqual(expectedWaveHeight, parser.Output.WaveHeight, 1e-11); + Assert.AreEqual(expectedOvertoppingDominant, parser.Output.IsOvertoppingDominant); + } + + [Test] + public void Parse_WaveHeightNull_OutputSet() + { + // Setup + string path = Path.Combine(testDirectory, "ValidFileWaveHeightNull"); + var parser = new OvertoppingCalculationWaveHeightParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.IsNaN(parser.Output.WaveHeight); + Assert.IsFalse(parser.Output.IsOvertoppingDominant); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ReliabilityIndexCalculationParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ReliabilityIndexCalculationParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/ReliabilityIndexCalculationParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,180 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class ReliabilityIndexCalculationParserTest + { + private const string validFile = "ValidFile"; + + private readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(ReliabilityIndexCalculationParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new ReliabilityIndexCalculationParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "InvalidFile"); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de berekende kans van voorkomen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_WithBetaAndValueResultOnOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "OtherSection"); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de berekende kans van voorkomen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ValidFileWithResults_OutputSet() + { + // Setup + string path = Path.Combine(testDirectory, validFile); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.AreEqual(1.24846, parser.Output.Result); + Assert.AreEqual(3.4037, parser.Output.CalculatedReliabilityIndex); + } + + [Test] + [TestCase("BetaNull")] + [TestCase("ValueNull")] + public void Parse_BetaOrValueNull_ThrowsHydraRingFileParserException(string subFolder) + { + // Setup + string path = Path.Combine(testDirectory, subFolder); + var parser = new ReliabilityIndexCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er is geen resultaat voor de betrouwbaarheidsindex van de berekende kans van voorkomen gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new ReliabilityIndexCalculationParser(); + string workingDirectory = Path.Combine(testDirectory, validFile); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/WaveConditionsCalculationParserTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/WaveConditionsCalculationParserTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Parsers/WaveConditionsCalculationParserTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,184 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Data.SQLite; +using System.IO; +using System.Security.AccessControl; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Exceptions; +using Riskeer.HydraRing.Calculation.Parsers; + +namespace Riskeer.HydraRing.Calculation.Test.Parsers +{ + [TestFixture] + public class WaveConditionsCalculationParserTest + { + private const string validFile = "ValidFile"; + + private readonly string testDirectory = Path.Combine(TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, "Parsers"), + nameof(WaveConditionsCalculationParser)); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var parser = new WaveConditionsCalculationParser(); + + // Assert + Assert.IsInstanceOf(parser); + Assert.IsNull(parser.Output); + } + + [Test] + public void Parse_WorkingDirectoryNull_ThrowsArgumentNullException() + { + // Setup + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(null, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Parse_WithWorkingDirectoryWithoutExpectedFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyWorkingDirectory"); + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithInvalidOutputFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "InvalidFile"); + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_WithWorkingDirectoryWithEmptyFile_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "EmptyDatabase"); + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende golfcondities gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ErrorWhileReadingFile_ThrowsHydraRingFileParserException() + { + // Setup + var parser = new WaveConditionsCalculationParser(); + string workingDirectory = Path.Combine(testDirectory, validFile); + + using (new DirectoryPermissionsRevoker(testDirectory, FileSystemRights.ReadData)) + { + // Call + TestDelegate call = () => parser.Parse(workingDirectory, 1); + + // Assert + var exception = Assert.Throws(call); + const string expectedMessage = "Er kon geen resultaat gelezen worden uit de Hydra-Ring uitvoerdatabase."; + Assert.AreEqual(expectedMessage, exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + } + + [Test] + [TestCase("ValidFileNoWaveHeight")] + [TestCase("ValidFileNoWavePeriod")] + [TestCase("ValidFileNoWaveDirection")] + [TestCase("ValidFileNoWaveAngle")] + public void Parse_NotAllColumnsHaveResults_ThrowsHydraRingFileParserException(string subFolder) + { + // Setup + string path = Path.Combine(testDirectory, subFolder); + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende golfcondities gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + Assert.IsInstanceOf(exception.InnerException); + } + + [Test] + public void Parse_ResultsOnOtherSection_ThrowsHydraRingFileParserException() + { + // Setup + string path = Path.Combine(testDirectory, "OtherSection"); + var parser = new WaveConditionsCalculationParser(); + + // Call + TestDelegate test = () => parser.Parse(path, 1); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("Er zijn geen berekende golfcondities gevonden in de Hydra-Ring uitvoerdatabase.", exception.Message); + } + + [Test] + public void Parse_ValidData_OutputSet() + { + // Setup + string path = Path.Combine(testDirectory, validFile); + var parser = new WaveConditionsCalculationParser(); + + // Call + parser.Parse(path, 1); + + // Assert + Assert.AreEqual(2.76672, parser.Output.WaveHeight); + Assert.AreEqual(-7.97903, parser.Output.WaveAngle); + Assert.AreEqual(292.021, parser.Output.WaveDirection); + Assert.AreEqual(5.02556, parser.Output.WavePeakPeriod); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Properties/AssemblyInfo.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,25 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Reflection; + +[assembly: AssemblyTitle("Riskeer.HydraRing.Calculation.Test")] +[assembly: AssemblyProduct("Riskeer.HydraRing.Calculation.Test")] \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/FailureMechanismDefaultsProviderTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,119 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Defaults; +using Riskeer.HydraRing.Calculation.Providers; + +namespace Riskeer.HydraRing.Calculation.Test.Providers +{ + [TestFixture] + public class FailureMechanismDefaultsProviderTest + { + [TestCase(HydraRingFailureMechanismType.AssessmentLevel, 1, new[] + { + 1 + }, 1, 9, 1)] + [TestCase(HydraRingFailureMechanismType.WaveHeight, 11, new[] + { + 11 + }, 11, 9, 1)] + [TestCase(HydraRingFailureMechanismType.WavePeakPeriod, 11, new[] + { + 14 + }, 14, 9, 1)] + [TestCase(HydraRingFailureMechanismType.WaveSpectralPeriod, 11, new[] + { + 16 + }, 16, 9, 1)] + [TestCase(HydraRingFailureMechanismType.QVariant, 3, new[] + { + 5 + }, 6, 10, 4)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 101, new[] + { + 102, + 103 + }, 1017, 9, 1)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 101, new[] + { + 102, + 103 + }, 1017, 9, 1)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 110, new[] + { + 421, + 422, + 423 + }, 4404, 9, 1)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 111, new[] + { + 422, + 424, + 425, + 426, + 427 + }, 4505, 9, 1)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 112, new[] + { + 422, + 424, + 425, + 430, + 431, + 432, + 433, + 434, + 435 + }, 4607, 9, 1)] + [TestCase(HydraRingFailureMechanismType.DunesBoundaryConditions, 1, new[] + { + 6 + }, 8, 9, 1)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 101, new[] + { + 102, + 103 + }, 1017, 9, 1)] + public void GetFailureMechanismDefaults_ReturnsExpectedFailureMechanismDefaults(HydraRingFailureMechanismType failureMechanismType, + int expectedMechanismId, + IEnumerable expectedSubMechanismIds, + int expectedFaultTreeModelId, + int expectedPreprocessorFaultTreeModelId, + int expectedPreprocessorMechanismId) + { + // Setup + var failureMechanismDefaultsProvider = new FailureMechanismDefaultsProvider(); + + // Call + FailureMechanismDefaults failureMechanismDefaults = failureMechanismDefaultsProvider.GetFailureMechanismDefaults(failureMechanismType); + + // Assert + Assert.AreEqual(expectedMechanismId, failureMechanismDefaults.MechanismId); + Assert.AreEqual(expectedSubMechanismIds, failureMechanismDefaults.SubMechanismIds); + Assert.AreEqual(expectedFaultTreeModelId, failureMechanismDefaults.FaultTreeModelId); + Assert.AreEqual(expectedPreprocessorFaultTreeModelId, failureMechanismDefaults.PreprocessorFaultTreeModelId); + Assert.AreEqual(expectedPreprocessorMechanismId, failureMechanismDefaults.PreprocessorMechanismId); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Providers/VariableDefaultsProviderTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,159 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Defaults; +using Riskeer.HydraRing.Calculation.Providers; + +namespace Riskeer.HydraRing.Calculation.Test.Providers +{ + [TestFixture] + public class VariableDefaultsProviderTest + { + [TestCase(HydraRingFailureMechanismType.AssessmentLevel, 26, 300)] + [TestCase(HydraRingFailureMechanismType.WaveHeight, 28, 300)] + [TestCase(HydraRingFailureMechanismType.WavePeakPeriod, 29, 300)] + [TestCase(HydraRingFailureMechanismType.WaveSpectralPeriod, 29, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 113, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 114, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 115, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 116, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 117, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 118, 300)] + [TestCase(HydraRingFailureMechanismType.QVariant, 119, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 1, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 8, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 10, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 11, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 12, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 17, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 120, 300)] + [TestCase(HydraRingFailureMechanismType.DikeHeight, 123, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 1, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 8, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 10, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 11, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 12, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 17, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 120, 300)] + [TestCase(HydraRingFailureMechanismType.DikesOvertopping, 123, 300)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 58, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 59, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 60, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 61, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 62, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 94, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 95, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 96, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 97, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 103, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 104, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 105, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 106, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 107, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresOvertopping, 108, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 58, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 59, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 61, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 62, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 63, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 65, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 66, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 67, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 68, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 69, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 71, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 72, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 93, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 94, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 95, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 96, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 97, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 103, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 104, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 105, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 106, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 107, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 108, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 125, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresClosure, 129, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 43, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 58, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 60, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 61, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 63, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 65, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 66, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 67, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 80, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 81, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 82, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 83, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 84, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 85, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 86, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 87, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 88, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 89, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 90, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 91, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 92, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 93, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 94, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 95, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 96, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 97, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 103, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 104, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 105, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 106, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 108, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 125, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 130, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 131, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 132, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 133, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 134, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 135, 999999)] + [TestCase(HydraRingFailureMechanismType.StructuresStructuralFailure, 136, 999999)] + [TestCase(HydraRingFailureMechanismType.DunesBoundaryConditions, 26, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 1, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 8, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 10, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 11, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 12, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 17, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 120, 300)] + [TestCase(HydraRingFailureMechanismType.OvertoppingRate, 123, 300)] + public void GetVariableDefaults_ReturnsExpectedVariableDefaults(HydraRingFailureMechanismType failureMechanismType, int variableId, int expectedCorrelationLength) + { + // Setup + var variableDefaultsProvider = new VariableDefaultsProvider(); + + // Call + VariableDefaults variableDefaults = variableDefaultsProvider.GetVariableDefaults(failureMechanismType, variableId); + + // Assert + Assert.AreEqual(expectedCorrelationLength, variableDefaults.CorrelationLength); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Readers/HydraRingDatabaseReaderTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Readers/HydraRingDatabaseReaderTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Readers/HydraRingDatabaseReaderTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,196 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Data.SQLite; +using System.IO; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Readers; + +namespace Riskeer.HydraRing.Calculation.Test.Readers +{ + [TestFixture] + public class HydraRingDatabaseReaderTest + { + private const string validDatabase = "ValidDatabase"; + private const string invalidDatabase = "InvalidDatabase"; + private const string emptyWorkingDirectory = "EmptyWorkingDirectory"; + private const string emptyDatabase = "EmptyDatabase"; + + private const string query = "SELECT * FROM IterateToGivenBetaConvergence " + + "WHERE OuterIterationId = (SELECT MAX(OuterIterationId) FROM IterateToGivenBetaConvergence);"; + + private static readonly string testDirectory = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.HydraRing.Calculation, + Path.Combine("Readers", nameof(HydraRingDatabaseReader))); + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + string directory = Path.Combine(testDirectory, validDatabase); + + // Call + using (var reader = new HydraRingDatabaseReader(directory, "", 1)) + { + // Assert + Assert.IsInstanceOf(reader); + } + } + + [Test] + public void Constructor_WorkingDirectoryNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new HydraRingDatabaseReader(null, "", 0); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("workingDirectory", exception.ParamName); + } + + [Test] + public void Constructor_QueryNull_ThrowArgumentNullException() + { + // Setup + string directory = Path.Combine(testDirectory, validDatabase); + + // Call + TestDelegate test = () => new HydraRingDatabaseReader(directory, null, 0); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("query", exception.ParamName); + } + + [Test] + [TestCaseSource(typeof(InvalidPathHelper), nameof(InvalidPathHelper.InvalidPaths))] + public void Constructor_WithInvalidWorkingDirectoryPath_ThrowsArgumentException(string invalidPath) + { + // Call + TestDelegate test = () => new HydraRingDatabaseReader(invalidPath, "", 0); + + // Assert + Assert.Throws(test); + } + + [Test] + [TestCase(emptyWorkingDirectory)] + [TestCase(invalidDatabase)] + public void Constructor_EmptyWorkingDirectoryOrInvalidDatabase_ThrowSQLiteException(string path) + { + // Setup + string directory = Path.Combine(testDirectory, path); + + // Call + TestDelegate test = () => + { + using (new HydraRingDatabaseReader(directory, query, 0)) {} + }; + + // Assert + Assert.Throws(test); + } + + [Test] + public void ReadLine_EmptyDatabase_ReturnsNull() + { + // Setup + string directory = Path.Combine(testDirectory, emptyDatabase); + + using (var reader = new HydraRingDatabaseReader(directory, query, 1)) + { + // Call + Dictionary result = reader.ReadLine(); + + // Assert + Assert.IsNull(result); + } + } + + [Test] + public void NextResult_EmptyDatabase_ReturnsFalse() + { + // Setup + string directory = Path.Combine(testDirectory, emptyDatabase); + + using (var reader = new HydraRingDatabaseReader(directory, query, 1)) + { + // Call + bool couldGetNextResult = reader.NextResult(); + + // Assert + Assert.IsFalse(couldGetNextResult); + } + } + + [Test] + public void NextResult_SingleResult_ReturnsFalse() + { + // Setup + string directory = Path.Combine(testDirectory, validDatabase); + + using (var reader = new HydraRingDatabaseReader(directory, query, 1)) + { + // Call + bool couldGetNextResult = reader.NextResult(); + + // Assert + Assert.IsFalse(couldGetNextResult); + } + } + + [Test] + public void NextResult_MultipleResult_ReturnsTrue() + { + // Setup + string directory = Path.Combine(testDirectory, validDatabase); + + using (var reader = new HydraRingDatabaseReader(directory, query + query, 1)) + { + // Call + bool couldGetNextResult = reader.NextResult(); + + // Assert + Assert.IsTrue(couldGetNextResult); + } + } + + [Test] + public void NextResult_MultipleResultProceededToSecondResult_ReturnsFalse() + { + // Setup + string directory = Path.Combine(testDirectory, validDatabase); + + using (var reader = new HydraRingDatabaseReader(directory, query + query, 1)) + { + reader.NextResult(); + + // Call + bool couldGetNextResult = reader.NextResult(); + + // Assert + Assert.IsFalse(couldGetNextResult); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Riskeer.HydraRing.Calculation.Test.csproj =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Riskeer.HydraRing.Calculation.Test.csproj (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Riskeer.HydraRing.Calculation.Test.csproj (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,145 @@ + + + + {175406DB-C0DA-42A7-968C-0C17CF2257B1} + Riskeer.HydraRing.Calculation.Test + Riskeer.HydraRing.Calculation.Test + + + + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + True + + + ..\..\..\..\packages\RhinoMocks.3.6.1\lib\net\Rhino.Mocks.dll + True + + + + + + ..\..\..\..\packages\System.Data.SQLite.Core.1.0.106.0\lib\net40\System.Data.SQLite.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Util + + + {D749EE4C-CE50-4C17-BF01-9A953028C126} + Core.Common.TestUtil + + + {888d4097-8bc2-4703-9fb1-8744c94d525e} + Riskeer.HydraRing.Calculation + + + {74CBA865-9338-447F-BAD9-28312446AE84} + Ringtoets.HydraRing.Calculation.TestUtil + + + + + Copying.licenseheader + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingConfigurationServiceTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,567 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.HydraRing.Calculation.TestUtil; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Data.Settings; +using Riskeer.HydraRing.Calculation.Data.Variables; +using Riskeer.HydraRing.Calculation.Services; + +namespace Riskeer.HydraRing.Calculation.Test.Services +{ + [TestFixture] + public class HydraRingConfigurationServiceTest + { + private static readonly string hydraRingDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"HydraRing"); + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.Model); + + // Assert + Assert.AreEqual(HydraRingUncertaintiesType.Model, hydraRingConfigurationService.UncertaintiesType); + } + + [Test] + public void AddHydraRingCalculationInput_DuplicateSectionId_ThrowsArgumentException() + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.Model); + var calculationInput1 = new HydraRingCalculationInputImplementation(1, 2); + var calculationInput2 = new HydraRingCalculationInputImplementation(1, 3); + + hydraRingConfigurationService.AddHydraRingCalculationInput(calculationInput1); + + // Call + TestDelegate test = () => hydraRingConfigurationService.AddHydraRingCalculationInput(calculationInput2); + + // Assert + const string expectedMessage = "Section id is not unique"; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); + } + + [Test] + public void AddHydraRingCalculationInput_MultipleFailureMechanismTypes_ThrowsNotSupportedException() + { + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.Model); + var calculationInput1 = new HydraRingCalculationInputImplementation(1, 2); + var calculationInput2 = new HydraRingCalculationInputImplementation(2, 3); + calculationInput2.SetFailureMechanismType(HydraRingFailureMechanismType.DikeHeight); + + hydraRingConfigurationService.AddHydraRingCalculationInput(calculationInput1); + + // Call + TestDelegate test = () => hydraRingConfigurationService.AddHydraRingCalculationInput(calculationInput2); + + // Assert + const string expectedMessage = "Running calculations for multiple failure mechanism types is not supported."; + var exception = Assert.Throws(test); + Assert.AreEqual(expectedMessage, exception.Message); + } + + [Test] + public void WriteDatabaseCreationScript_SingleHydraRingCalculationInput_WritesExpectedCreationScript([Values(true, false)] bool withForeland, + [Values(true, false)] bool withBreakWater, + [Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.Model); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new HydraRingCalculationInputImplementation(1, 700004, withForeland, withBreakWater) + { + PreprocessorSetting = runPreprocessor + ? new PreprocessorSetting(1001.1, 1002.2, new NumericsSetting(1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 1016, 1017, 1018.18, 1019.19, 1020.20, 1021)) + : new PreprocessorSetting(), + DesignTablesSetting = new DesignTablesSetting(6.6, 7.7), + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(8, 9, 10, 11.11, 12.12, 13.13, 14.14, 15, 16, 17, 18.18, 19.19, 20.20, 21) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(3) + }); + + string expectedForelandModelsScript = withForeland || withBreakWater + ? "INSERT INTO [ForelandModels] VALUES (1, 1, 3);" + Environment.NewLine + : string.Empty; + string expectedForelandsScript = withForeland + ? "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 2, 2.2, 3.3);" + Environment.NewLine + : string.Empty; + string expectedBreakWatersScript = withBreakWater + ? "INSERT INTO [Breakwaters] VALUES (1, 1, 99.9);" + Environment.NewLine + : string.Empty; + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 2, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 1, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 4, 5, 0, 0, 0, 0, 6.6, 7.7, 1.1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 1, 8, 9, 10, 11.11, 12.12, 13.13, 14.14, 15, 3, 16, 17, 18.18, 19.19, 20.2, 21);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 0, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 2, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 4, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 19, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 18, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 2, 11.1, 22.2, 33.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 1);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 1, 1234);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 2, 11.1, 22.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + expectedForelandModelsScript + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + expectedForelandsScript + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + expectedBreakWatersScript; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + [Test] + public void WriteDatabaseCreationScript_MultipleHydraRingCalculationInputs_WritesExpectedCreationScript([Values(true, false)] bool runPreprocessor) + { + // Setup + var hydraRingConfigurationService = new HydraRingConfigurationService(HydraRingUncertaintiesType.Model); + + hydraRingConfigurationService.AddHydraRingCalculationInput(new HydraRingCalculationInputImplementation(1, 700004) + { + PreprocessorSetting = runPreprocessor + ? new PreprocessorSetting(1001.1, 1002.2, new NumericsSetting(1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 1016, 1017, 1018.18, 1019.19, 1020.20, 1021)) + : new PreprocessorSetting(), + DesignTablesSetting = new DesignTablesSetting(6.6, 7.7), + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(8, 9, 10, 11.11, 12.12, 13.13, 14.14, 15, 16, 17, 18.18, 19.19, 20.20, 21) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(2) + }); + hydraRingConfigurationService.AddHydraRingCalculationInput(new HydraRingCalculationInputImplementation(2, 700005) + { + PreprocessorSetting = runPreprocessor + ? new PreprocessorSetting(2001.1, 2002.2, new NumericsSetting(2008, 2009, 2010, 2011.11, 2012.12, 2013.13, 2014.14, 2015, 2016, 2017, 2018.18, 2019.19, 2020.20, 2021)) + : new PreprocessorSetting(), + DesignTablesSetting = new DesignTablesSetting(8.8, 9.9), + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(108, 109, 110, 111.11, 112.12, 113.13, 114.14, 115, 116, 117, 118.18, 119.19, 120.20, 121) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(3) + }); + hydraRingConfigurationService.AddHydraRingCalculationInput(new HydraRingCalculationInputImplementation(3, 700006) + { + PreprocessorSetting = runPreprocessor + ? new PreprocessorSetting(3001.1, 3002.2, new NumericsSetting(3008, 3009, 3010, 3011.11, 3012.12, 3013.13, 3014.14, 3015, 3016, 3017, 3018.18, 3019.19, 3020.20, 3021)) + : new PreprocessorSetting(), + DesignTablesSetting = new DesignTablesSetting(10.10, 11.11), + NumericsSettings = new Dictionary + { + { + 1, new NumericsSetting(208, 209, 210, 211.11, 212.12, 213.13, 214.14, 215, 216, 217, 218.18, 219.19, 220.20, 221) + } + }, + TimeIntegrationSetting = new TimeIntegrationSetting(1) + }); + + string expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine + + "INSERT INTO [HydraulicModels] VALUES (1, 2, 'WTI 2017');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Sections];" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (1, 1, 1, 1, 1, 0, 0, 0, 0, 700004, 700004, 100, 3.3, 2.2);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (2, 1, 1, 2, 2, 0, 0, 0, 0, 700005, 700005, 100, 3.3, 2.2);" + Environment.NewLine + + "INSERT INTO [Sections] VALUES (3, 1, 1, 3, 3, 0, 0, 0, 0, 700006, 700006, 100, 3.3, 2.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionCalculationSchemes];" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (1, 1, 2);" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (2, 1, 3);" + Environment.NewLine + + "INSERT INTO [SectionCalculationSchemes] VALUES (3, 1, 1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [DesignTables];" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (1, 1, 1, 1, 4, 5, 0, 0, 0, 0, 6.6, 7.7, 1.1);" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (2, 1, 1, 1, 4, 5, 0, 0, 0, 0, 8.8, 9.9, 1.1);" + Environment.NewLine + + "INSERT INTO [DesignTables] VALUES (3, 1, 1, 1, 4, 5, 0, 0, 0, 0, 10.1, 11.11, 1.1);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PreprocessorSettings];" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [PreprocessorSettings] VALUES (1, 1001.1, 1002.2);" + Environment.NewLine + + "INSERT INTO [PreprocessorSettings] VALUES (2, 2001.1, 2002.2);" + Environment.NewLine + + "INSERT INTO [PreprocessorSettings] VALUES (3, 3001.1, 3002.2);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [Numerics];" + Environment.NewLine + + "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 1, 8, 9, 10, 11.11, 12.12, 13.13, 14.14, 15, 3, 16, 17, 18.18, 19.19, 20.2, 21);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (1, 1, 1, 1, 7, 1008, 1009, 1010, 1011.11, 1012.12, 1013.13, 1014.14, 1015, 3, 1016, 1017, 1018.18, 1019.19, 1020.2, 1021);" + Environment.NewLine + : string.Empty) + + "INSERT INTO [Numerics] VALUES (2, 1, 1, 1, 1, 108, 109, 110, 111.11, 112.12, 113.13, 114.14, 115, 3, 116, 117, 118.18, 119.19, 120.2, 121);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (2, 1, 1, 1, 7, 2008, 2009, 2010, 2011.11, 2012.12, 2013.13, 2014.14, 2015, 3, 2016, 2017, 2018.18, 2019.19, 2020.2, 2021);" + Environment.NewLine + : string.Empty) + + "INSERT INTO [Numerics] VALUES (3, 1, 1, 1, 1, 208, 209, 210, 211.11, 212.12, 213.13, 214.14, 215, 3, 216, 217, 218.18, 219.19, 220.2, 221);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [Numerics] VALUES (3, 1, 1, 1, 7, 3008, 3009, 3010, 3011.11, 3012.12, 3013.13, 3014.14, 3015, 3, 3016, 3017, 3018.18, 3019.19, 3020.2, 3021);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [VariableDatas];" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 0, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 2, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 4, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 19, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (1, 1, 1, 1, 26, 0, 18, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 0, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 0, 2, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 0, 4, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 0, 19, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (2, 1, 1, 1, 26, 0, 18, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 0, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 2, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 0, 2, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 4, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 0, 4, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 19, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 0, 19, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 1, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 1.1, 18, 2.2, 3.3, 4.4, 5.5, 0, 6.6, 300);" + Environment.NewLine + + "INSERT INTO [VariableDatas] VALUES (3, 1, 1, 1, 26, 0, 18, 0, NULL, NULL, NULL, 1, 0, 300);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalculationProfiles];" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (1, 2, 11.1, 22.2, 33.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (2, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (2, 2, 11.1, 22.2, 33.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (3, 1, 1.1, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [CalculationProfiles] VALUES (3, 2, 11.1, 22.2, 33.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine + + "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 1);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (1, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + "INSERT INTO [SectionFaultTreeModels] VALUES (2, 1, 1, 1, 1);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (2, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + "INSERT INTO [SectionFaultTreeModels] VALUES (3, 1, 1, 1, 1);" + Environment.NewLine + + (runPreprocessor + ? "INSERT INTO [SectionFaultTreeModels] VALUES (3, 1, 1, 1, 9);" + Environment.NewLine + : string.Empty) + + Environment.NewLine + + "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (1, 1, 1, 1, 1234);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (2, 1, 1, 1, 1234);" + Environment.NewLine + + "INSERT INTO [SectionSubMechanismModels] VALUES (3, 1, 1, 1, 1234);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Fetches];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [AreaPoints];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [PresentationSections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Profiles];" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (1, 2, 11.1, 22.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (2, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (2, 2, 11.1, 22.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (3, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Profiles] VALUES (3, 2, 11.1, 22.2);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ForelandModels];" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (1, 1, 3);" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (2, 1, 3);" + Environment.NewLine + + "INSERT INTO [ForelandModels] VALUES (3, 1, 3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Forelands];" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (1, 2, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (2, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (2, 2, 2.2, 3.3);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (3, 1, 1.1, 2.2);" + Environment.NewLine + + "INSERT INTO [Forelands] VALUES (3, 2, 2.2, 3.3);" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [SetUpHeights];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [CalcWindDirections];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Swells];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [WaveReductions];" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Areas];" + Environment.NewLine + + "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Projects];" + Environment.NewLine + + "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine + + Environment.NewLine + + "DELETE FROM [Breakwaters];" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (1, 1, 99.9);" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (2, 1, 99.9);" + Environment.NewLine + + "INSERT INTO [Breakwaters] VALUES (3, 1, 99.9);" + Environment.NewLine; + + string databaseFilePath = Path.Combine(hydraRingDirectory, "temp.db"); + using (new FileDisposeHelper(databaseFilePath)) + { + // Call + hydraRingConfigurationService.WriteDatabaseCreationScript(databaseFilePath); + + // Assert + string creationScript = File.ReadAllText(databaseFilePath); + Assert.AreEqual(expectedCreationScript, creationScript); + } + } + + private class HydraRingCalculationInputImplementation : HydraRingCalculationInput + { + private readonly int sectionId; + private readonly bool withForeland; + private readonly bool withBreakWater; + private HydraRingFailureMechanismType failureMechanismType; + + public HydraRingCalculationInputImplementation(int sectionId, int hydraulicBoundaryLocationId, bool withForeland = true, bool withBreakWater = true) + : base(hydraulicBoundaryLocationId) + { + this.sectionId = sectionId; + this.withForeland = withForeland; + this.withBreakWater = withBreakWater; + + failureMechanismType = HydraRingFailureMechanismType.AssessmentLevel; + } + + public override HydraRingFailureMechanismType FailureMechanismType + { + get + { + return failureMechanismType; + } + } + + public override int CalculationTypeId + { + get + { + return 4; + } + } + + public override int VariableId + { + get + { + return 5; + } + } + + public override HydraRingSection Section + { + get + { + return new HydraRingSection(sectionId, 2.2, 3.3); + } + } + + public override IEnumerable Variables + { + get + { + yield return new TestHydraRingVariable(26, HydraRingDistributionType.Deterministic, HydraRingDeviationType.Standard, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.Normal, HydraRingDeviationType.Standard, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.Normal, HydraRingDeviationType.Variation, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.Normal, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.LogNormal, HydraRingDeviationType.Standard, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.LogNormal, HydraRingDeviationType.Variation, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.LogNormal, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.TruncatedNormal, HydraRingDeviationType.Standard, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.TruncatedNormal, HydraRingDeviationType.Variation, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.TruncatedNormal, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.RayleighN, HydraRingDeviationType.Standard, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.RayleighN, HydraRingDeviationType.Variation, 1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + yield return new TestHydraRingVariable(26, HydraRingDistributionType.RayleighN, HydraRingDeviationType.Standard, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN); + } + } + + public override IEnumerable ProfilePoints + { + get + { + yield return new HydraRingProfilePointDerivative(1.1, 2.2, 3.3); + yield return new HydraRingProfilePointDerivative(11.1, 22.2, 33.3); + } + } + + public override IEnumerable ForelandsPoints + { + get + { + if (withForeland) + { + yield return new HydraRingForelandPoint(1.1, 2.2); + yield return new HydraRingForelandPoint(2.2, 3.3); + } + } + } + + public override HydraRingBreakWater BreakWater + { + get + { + return withBreakWater + ? new HydraRingBreakWater(1, 99.9) + : null; + } + } + + public override double Beta + { + get + { + return 1.1; + } + } + + public void SetFailureMechanismType(HydraRingFailureMechanismType type) + { + failureMechanismType = type; + } + + public override int? GetSubMechanismModelId(int subMechanismId) + { + return 1234; + } + } + + private class HydraRingProfilePointDerivative : HydraRingProfilePoint + { + public HydraRingProfilePointDerivative(double x, double z, double roughness) + : base(x, z) + { + Roughness = roughness; + } + + public override double Roughness { get; } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingInitializationServiceTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingInitializationServiceTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingInitializationServiceTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,121 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.IO; +using System.Reflection; +using Core.Common.TestUtil; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Data; +using Riskeer.HydraRing.Calculation.Data.Input; +using Riskeer.HydraRing.Calculation.Services; + +namespace Riskeer.HydraRing.Calculation.Test.Services +{ + [TestFixture] + public class HydraRingInitializationServiceTest + { + private readonly string hydraRingDirectory = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), @"HydraRing"); + + [Test] + public void Constructor_SettingsNull_ThrowsArgumentNullException() + { + // Setup + var random = new Random(21); + + // Call + TestDelegate call = () => new HydraRingInitializationService(random.NextEnumValue(), + random.Next(), + "D:\\work", + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("settings", exception.ParamName); + } + + [Test] + public void ParameteredConstructor_ExpectedValues() + { + // Setup + var settings = new HydraRingCalculationSettings("D:\\hlcd\\hlcdFilePath", "D:\\preprocessor"); + + // Call + var hydraRingInitializationService = new HydraRingInitializationService(HydraRingFailureMechanismType.AssessmentLevel, + 700001, + "D:\\work", + settings); + + // Assert + Assert.AreEqual("D:\\work\\700001.ini", hydraRingInitializationService.IniFilePath); + Assert.AreEqual("D:\\work\\700001.sql", hydraRingInitializationService.DatabaseCreationScriptFilePath); + Assert.AreEqual(Path.Combine(hydraRingDirectory, "MechanismComputation.exe"), hydraRingInitializationService.MechanismComputationExeFilePath); + Assert.AreEqual("D:\\work", hydraRingInitializationService.TemporaryWorkingDirectory); + } + + [Test] + [TestCase("")] + [TestCase("D:\\preprocessor")] + public void GenerateInitializationScript_ReturnsExpectedInitializationScript(string preprocessorDirectory) + { + // Setup + const string hlcdFilePath = "D:\\hlcd\\HlcdFile.sqlite"; + + var settings = new HydraRingCalculationSettings(hlcdFilePath, preprocessorDirectory); + var hydraRingInitializationService = new HydraRingInitializationService(HydraRingFailureMechanismType.StructuresStructuralFailure, + 700001, + TestHelper.GetScratchPadPath(), + settings); + + string expectedInitializationScript = "section = 700001" + Environment.NewLine + + "mechanism = 112" + Environment.NewLine + + "alternative = 1" + Environment.NewLine + + "layer = 1" + Environment.NewLine + + "logfile = 700001.log" + Environment.NewLine + + "outputverbosity = basic" + Environment.NewLine + + "outputtofile = file" + Environment.NewLine + + "projectdbfilename = 700001.sql" + Environment.NewLine + + "outputfilename = designTable.txt" + Environment.NewLine + + "configdbfilename = " + Path.Combine(hydraRingDirectory, "config.sqlite") + Environment.NewLine + + "hydraulicdbfilename = " + hlcdFilePath + Environment.NewLine + + "designpointOutput = sqlite"; + + if (preprocessorDirectory != string.Empty) + { + expectedInitializationScript += Environment.NewLine + "preprocessordbdirectory = " + preprocessorDirectory; + } + + try + { + // Call + hydraRingInitializationService.WriteInitializationScript(); + + // Assert + string initializationScript = File.ReadAllText(hydraRingInitializationService.IniFilePath); + Assert.AreEqual(expectedInitializationScript, initializationScript); + } + finally + { + File.Delete(hydraRingInitializationService.IniFilePath); + } + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingProcessFactoryTest.cs =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingProcessFactoryTest.cs (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/Services/HydraRingProcessFactoryTest.cs (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,52 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Diagnostics; +using NUnit.Framework; +using Riskeer.HydraRing.Calculation.Services; + +namespace Riskeer.HydraRing.Calculation.Test.Services +{ + [TestFixture] + public class HydraRingProcessFactoryTest + { + [Test] + public void Create_ReturnsExpectedProcess() + { + // Call + const string iniFilePath = "D:\\iniFile.text"; + const string workingDirectory = "D:\\workingDirectory"; + const string mechanismComputationExeFilePath = "D:\\mechanismComputation.exe"; + + Process process = HydraRingProcessFactory.Create(mechanismComputationExeFilePath, iniFilePath, workingDirectory); + + // Assert + Assert.AreEqual(mechanismComputationExeFilePath, process.StartInfo.FileName); + Assert.AreEqual(iniFilePath, process.StartInfo.Arguments); + Assert.AreEqual(workingDirectory, process.StartInfo.WorkingDirectory); + Assert.IsFalse(process.StartInfo.UseShellExecute); + Assert.IsTrue(process.StartInfo.CreateNoWindow); + Assert.IsTrue(process.StartInfo.RedirectStandardInput); + Assert.IsTrue(process.StartInfo.RedirectStandardOutput); + Assert.IsTrue(process.StartInfo.RedirectStandardError); + } + } +} \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/packages.config =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/packages.config (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/packages.config (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,28 @@ + + + + + + + \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceNull/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnAllButLastIteration/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnAllSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaAndValueSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaAndValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnBetaSection2/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueAndValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/ConvergenceOnValueZeroQVariantSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/InvalidFile/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/InvalidFile/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/InvalidFile/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ConvergenceParser/NoConvergenceSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/InvalidFile/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/InvalidFile/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ResultsOnAllButLastIteration/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWaterLevel/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWaveHeight/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/DunesBoundaryConditionsCalculationParser/ValidFileNoWavePeriod/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/BetaNull/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ExceedanceProbabilityCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaFaultTree/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaGeneralResult/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/DuplicateBetaSubMechanism/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptySchema/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptySchema/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/EmptySchema/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/MissingWindDirectionClosingSituationFaultTree/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/MissingWindDirectionClosingSituationSubMechanism/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaFaultTree/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaGeneralResult/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoBetaSubMechanism/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NoGoverningWindDirection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullAlphaValue/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullBetaValue/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullDuration/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullIllustrationPointResultValue/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullRealization/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/NullWindDirectionAngle/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidDesignWaterLevelOutputSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidStructuresStabilityOutputSection1/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/IllustrationPointsParser/ValidStructuresStabilityOutputSection1/2-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/LastErrorFileParser/last_error.txt =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/LastErrorFileParser/last_error.txt (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/LastErrorFileParser/last_error.txt (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,2 @@ + File not found: D:\Repos\Ringtoets\Ringtoets\Integration\test\Ringtoets.Integra + tion.Service.Test\test-data\HLCD.sqlite Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/1-output.txt =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/1-output.txt (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/1-output.txt (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ +In dit bestand staan veschillende berichten, welke door Hydra-Ring gegenereerd zijn. \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/123.log =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/123.log (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OutputFileParser/123.log (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ +Dit is het log bestand, niet het output bestand. \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyTableDesignBeta/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/EmptyTableGoverningWind/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/InvalidFile/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/InvalidFile/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/InvalidFile/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableDesignBeta/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableDesignPointResults/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/MissingTableGoverningWind/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/OtherSection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileOvertoppingDominant/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileOvertoppingNotDominant/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/OvertoppingCalculationWaveHeightParser/ValidFileWaveHeightNull/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/BetaNull/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/ReliabilityIndexCalculationParser/ValueNull/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/InvalidFile/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/InvalidFile/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/InvalidFile/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/OtherSection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveAngle/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveDirection/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWaveHeight/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Parsers/WaveConditionsCalculationParser/ValidFileNoWavePeriod/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseParseHelper/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseParseHelper/ValidFile/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/EmptyDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/InvalidDatabase/1-output.sqlite =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/InvalidDatabase/1-output.sqlite (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/InvalidDatabase/1-output.sqlite (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1 @@ \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Readers/HydraRingDatabaseReader/ValidDatabase/1-output.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/DesignTablesSettingsTest.csv =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/DesignTablesSettingsTest.csv (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/DesignTablesSettingsTest.csv (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,13 @@ +"TrajectID;""Variabele"";""Min"";""Max""" +"205;""Toetspeil"";5;15" +"205;""Q"";5;15" +"11-1;""Toetspeil"";5;15" +"11-1;""Q"";5;15" +"205;""Hs"";5;15" +"205;""Tp"";5;15" +"205;""Tm-1,0"";5;15" +"205;""HBN"";5;15" +"205;""Gras"";5;15" +"205;""KwHoogte"";5;15" +"205;""KwSluiten"";5;15" +"205;""KwPuntconstructies"";5;15" \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/HydraulicModelsSettingsTest.csv =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/HydraulicModelsSettingsTest.csv (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/HydraulicModelsSettingsTest.csv (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,11 @@ +"TrajectID;""Variabele"";""TimeIntegrationSchemeID""" +"205;""Toetspeil"";1" +"205;""Q"";1" +"205;""Hs"";2" +"205;""Tp"";3" +"205;""Tm-1,0"";1" +"205;""HBN"";1" +"205;""Gras"";1" +"205;""KwHoogte"";1" +"205;""KwSluiten"";2" +"205;""KwPuntconstructies"";2" \ No newline at end of file Index: Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/NumericsSettingsTest.csv =================================================================== diff -u --- Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/NumericsSettingsTest.csv (revision 0) +++ Ringtoets/HydraRing/test/Riskeer.HydraRing.Calculation.Test/test-data/Settings/NumericsSettingsTest.csv (revision c7930c00c8c694260f69119c3ae4687f1297c69a) @@ -0,0 +1,3 @@ +TrajectID;MechanismID;SubMechanismID;Rekenmethode;FORM_StartMethod;FORM_NrIterations;FORM_RelaxationFactor;FORM_EpsBeta;FORM_EpsHOH;FORM_EpsZFunc;Ds_StartMethod;Ds_Min;Ds_Max;Ds_VarCoefficient;NI_UMin;NI_Umax;NI_NumberSteps +205;1;1;1;4;50;0.15;0.01;0.01;0.01;2;20000;100000;0.1;-6;6;25 +205;11;11;2;6;30;0.50;0.06;0.08;0.02;3;1000;2000;0.4;-10;10;14