Index: Ringtoets.sln
===================================================================
diff -u -rbe18637e5ba22a4792cbae854df6161152dfea0b -r2d850ad8de01dd4896ada4999d18f787165ce644
--- Ringtoets.sln (.../Ringtoets.sln) (revision be18637e5ba22a4792cbae854df6161152dfea0b)
+++ Ringtoets.sln (.../Ringtoets.sln) (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -1916,7 +1916,7 @@
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Storage.Core.Test", "Ringtoets\Storage\test\Ringtoets.Storage.Core.Test\Riskeer.Storage.Core.Test.csproj", "{594C5C6D-5833-4E1C-9F30-13A202628EEF}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.Storage.Core.Test", "Ringtoets\Storage\test\Riskeer.Storage.Core.Test\Riskeer.Storage.Core.Test.csproj", "{594C5C6D-5833-4E1C-9F30-13A202628EEF}"
ProjectSection(ProjectDependencies) = postProject
{C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC}
EndProjectSection
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/App.config'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/BackedUpFileWriterTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/BackgroundDataIdentifiersTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/ColorConversionExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/AssessmentSectionCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/BackgroundDataCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/CalculationGroupCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/ClosingStructures/ClosingStructureCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCollectionCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/DuneErosion/DuneLocationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/FailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/FailureMechanismSectionCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/ForeshoreProfileCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeHeightOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionInwards/OvertoppingRateOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HeightStructures/HeightStructureCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCollectionCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HydraulicBoundaryLocationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/HydraulicLocationConfigurationSettingsCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointNodeCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/StochastCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/IllustrationPoints/TopLevelSubMechanismIllustrationPointCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsCalculationScenarioCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilModelCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSurfaceLineCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/PersistenceRegistryTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingSoilLayerCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingStochasticSoilModelCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingStochasticSoilProfileCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/Piping/PipingSurfaceLineCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/RiskeerProjectCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityPointStructures/StabilityPointStructureCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StructuresCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/StructuresOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputCreateExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/DbContext/RiskeerEntitiesTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/DoubleConversionExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Exceptions/CannotDeleteBackupFileExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Exceptions/CannotDetermineFingerprintExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Exceptions/EntityNotFoundExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/FingerprintHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Properties/AssemblyInfo.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/BackgroundDataEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/BackgroundDataMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/CalculationGroupEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ClosingStructures/ClosingStructureEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneErosionFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneErosionSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneLocationCalculationCollectionEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneLocationCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneLocationCalculationOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/DuneErosion/DuneLocationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/FailureMechanismEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/FailureMechanismSectionEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ForeshoreProfileReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/DikeProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsDikeHeightOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsOvertoppingRateOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionInwards/GrassCoverErosionInwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverSlipOffInwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/GrassCoverSlipOffOutwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HeightStructures/HeightStructureEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HeightStructures/HeightStructuresCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HydraulicBoundaryDatabaseEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HydraulicLocationCalculationCollectionEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HydraulicLocationCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HydraulicLocationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/HydraulicLocationOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/FaultTreeIllustrationPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/GeneralResultFaultTreeIllustrationPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/GeneralResultSubMechanismIllustrationPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/IllustrationPointResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/StochastEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/SubMechanismIllustrationPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/SubMechanismIllustrationPointStochastEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/TopLevelFaultTreeIllustrationPointEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/IllustrationPoints/TopLevelSubMechanismIllustrationPointReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsCalculationOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerOneDEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilLayerTwoDEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileOneDEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsSoilProfileTwoDEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityOutwards/MacroStabilityOutwardsFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MacroStabilityOutwards/MacroStabilityOutwardsSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/MicrostabilitySectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingCalculationOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingSoilLayerEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingSoilProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/Piping/PipingStochasticSoilProfileEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/PipingStructure/PipingStructureSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ProjectEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/ReadConversionCollectorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityPointStructures/StabilityPointStructureEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityPointStructures/StabilityPointStructuresCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityPointStructures/StabilityPointStructuresFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityStoneCover/StabilityStoneCoverFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityStoneCover/StabilityStoneCoverSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StabilityStoneCover/StabilityStoneCoverWaveConditionsOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StochasticSoilModelEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StrengthStabilityLengthwiseConstructionSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/StructureCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/SurfaceLineEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/TechnicalInnovationSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/WaterPressureAsphaltCoverSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismMetaEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverSectionResultEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsCalculationEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Read/WaveImpactAsphaltCover/WaveImpactAsphaltCoverWaveConditionsOutputEntityReadExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Riskeer.Storage.Core.Test.csproj'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/RiskeerDatabaseCreatorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/RoundedDoubleConversionExtensionsTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/DataCollectionSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/MacroStabilityInwardsSliceCollectionXmlSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/Point2DCollectionXmlSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/Point3DCollectionXmlSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/RoughnessPointCollectionXmlSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/Serializers/TangentLineCollectionXmlSerializerTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/SqLiteEntityConnectionStringBuilderTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/StorageSqLiteTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/StorageSqliteCreatorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/packages.config'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 2d850ad8de01dd4896ada4999d18f787165ce644 refers to a dead (removed) revision in file `Ringtoets/Storage/test/Ringtoets.Storage.Core.Test/test-data/DatabaseFiles/empty.rtd'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/App.config
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/App.config (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/App.config (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackedUpFileWriterTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackedUpFileWriterTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackedUpFileWriterTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,263 @@
+// 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.Storage.Core.Exceptions;
+
+namespace Riskeer.Storage.Core.Test
+{
+ [TestFixture]
+ public class BackedUpFileWriterTest
+ {
+ private readonly string testWorkDir = TestHelper.GetScratchPadPath(nameof(BackedUpFileWriterTest));
+
+ [Test]
+ [TestCase("")]
+ [TestCase(null)]
+ [TestCase("\"")]
+ [TestCase("/")]
+ public void Constructor_InvalidPath_ThrowsArgumentException(string path)
+ {
+ // Call
+ TestDelegate test = () => new BackedUpFileWriter(path);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Perform_ValidFile_TemporaryFileCreatedFromOriginalAndDeletedAfterwards()
+ {
+ // Setup
+ string writableDirectory = Path.Combine(testWorkDir, nameof(Perform_ValidFile_TemporaryFileCreatedFromOriginalAndDeletedAfterwards));
+ string filePath = Path.Combine(writableDirectory, "iDoExist.txt");
+ string temporaryFilePath = filePath + "~";
+ const string testContent = "Some test text to write into file.";
+
+ using (new DirectoryDisposeHelper(testWorkDir, nameof(Perform_ValidFile_TemporaryFileCreatedFromOriginalAndDeletedAfterwards)))
+ using (new FileDisposeHelper(filePath))
+ using (new FileDisposeHelper(temporaryFilePath))
+ {
+ File.WriteAllText(filePath, testContent);
+
+ var writer = new BackedUpFileWriter(filePath);
+
+ // Call
+ writer.Perform(() =>
+ {
+ // Assert
+ Assert.IsFalse(File.Exists(filePath));
+ Assert.IsTrue(File.Exists(temporaryFilePath));
+ Assert.AreEqual(testContent, File.ReadAllText(temporaryFilePath));
+ });
+ Assert.False(File.Exists(temporaryFilePath));
+ }
+ }
+
+ [Test]
+ public void Perform_ActionThrowsExceptionValidPathFileExists_OriginalFileRevertedAndExceptionThrown()
+ {
+ // Setup
+ string writableDirectory = Path.Combine(testWorkDir, nameof(Perform_ActionThrowsExceptionValidPathFileExists_OriginalFileRevertedAndExceptionThrown));
+ string filePath = Path.Combine(writableDirectory, "iDoExist.txt");
+ string temporaryFilePath = filePath + "~";
+ const string testContent = "Some test text to write into file.";
+
+ using (new DirectoryDisposeHelper(testWorkDir, nameof(Perform_ActionThrowsExceptionValidPathFileExists_OriginalFileRevertedAndExceptionThrown)))
+ {
+ File.WriteAllText(filePath, testContent);
+
+ var writer = new BackedUpFileWriter(filePath);
+ var exception = new IOException();
+
+ // Precondition
+ Assert.IsTrue(File.Exists(filePath));
+
+ // Call
+ TestDelegate test = () => writer.Perform(() => { throw exception; });
+
+ Exception actualException = Assert.Throws(exception.GetType(), test);
+ Assert.AreSame(exception, actualException);
+
+ Assert.IsFalse(File.Exists(temporaryFilePath));
+ Assert.IsTrue(File.Exists(filePath));
+ Assert.AreEqual(testContent, File.ReadAllText(filePath));
+ }
+ }
+
+ [Test]
+ public void Perform_ValidPathFileExistsTemporaryFileExistsAndCannotBeDeleted_ThrowsIOException()
+ {
+ // Setup
+ string filePath = Path.Combine(testWorkDir, "iDoExist.txt");
+ string temporaryFilePath = filePath + "~";
+
+ using (new FileDisposeHelper(filePath))
+ using (var tempFileHelper = new FileDisposeHelper(temporaryFilePath))
+ {
+ tempFileHelper.LockFiles();
+
+ var writer = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => writer.Perform(() => {});
+
+ // Assert
+ string message = Assert.Throws(test).Message;
+ string expectedMessage = $"Er bestaat al een tijdelijk bestand ({temporaryFilePath}) dat niet verwijderd kan worden. Dit bestand dient handmatig verwijderd te worden.";
+ Assert.AreEqual(message, expectedMessage);
+ }
+ }
+
+ [Test]
+ public void Perform_ValidPathFileExistsDirectoryNotWritable_ThrowsIOException()
+ {
+ // Setup
+ string notWritableDirectory = Path.Combine(testWorkDir, nameof(Perform_ValidPathFileExistsDirectoryNotWritable_ThrowsIOException));
+ string filePath = Path.Combine(notWritableDirectory, "iDoExist.txt");
+
+ using (var directoryHelper = new DirectoryDisposeHelper(testWorkDir, nameof(Perform_ValidPathFileExistsDirectoryNotWritable_ThrowsIOException)))
+ using (new FileDisposeHelper(filePath))
+ {
+ var writer = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => writer.Perform(() => {});
+
+ directoryHelper.LockDirectory(FileSystemRights.Write);
+ // Assert
+ string expectedMessage = $"Kan geen tijdelijk bestand maken van het originele bestand ({filePath}).";
+ string message = Assert.Throws(test).Message;
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+
+ [Test]
+ public void Perform_TargetFileDoesNotExistDeleteRightsRevoked_DoesNotThrow()
+ {
+ // Setup
+ string noAccessDirectory = Path.Combine(testWorkDir, nameof(Perform_TargetFileDoesNotExistDeleteRightsRevoked_DoesNotThrow));
+ string filePath = Path.Combine(noAccessDirectory, "iDoNotExist.txt");
+
+ using (var directoryHelper = new DirectoryDisposeHelper(testWorkDir, nameof(Perform_TargetFileDoesNotExistDeleteRightsRevoked_DoesNotThrow)))
+ {
+ var helper = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => helper.Perform(() => {});
+
+ directoryHelper.LockDirectory(FileSystemRights.Delete);
+ // Assert
+ Assert.DoesNotThrow(test);
+ }
+ }
+
+ [Test]
+ public void Perform_TargetFileExistsCannotDeleteFile_ThrowsCannotDeleteBackupFileException()
+ {
+ // Setup
+ string filePath = Path.Combine(testWorkDir, nameof(Perform_TargetFileExistsCannotDeleteFile_ThrowsCannotDeleteBackupFileException));
+ string temporaryFilePath = filePath + "~";
+
+ using (new FileDisposeHelper(filePath))
+ using (var temporaryFileHelper = new FileDisposeHelper(temporaryFilePath))
+ {
+ var helper = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => helper.Perform(() => temporaryFileHelper.LockFiles());
+
+ // Assert
+ string expectedMessage = $"Kan het tijdelijke bestand ({temporaryFilePath}) niet opruimen. Het tijdelijke bestand dient handmatig verwijderd te worden.";
+ string message = Assert.Throws(test).Message;
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+
+ [Test]
+ public void Perform_ActionThrowsExceptionTargetFileExistsCannotDeleteFile_ThrowsIOException()
+ {
+ // Setup
+ string filePath = Path.Combine(testWorkDir, nameof(Perform_ActionThrowsExceptionTargetFileExistsCannotDeleteFile_ThrowsIOException));
+ string temporaryFilePath = filePath + "~";
+
+ using (new FileDisposeHelper(filePath))
+ using (var temporaryFileHelper = new FileDisposeHelper(temporaryFilePath))
+ {
+ var helper = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => helper.Perform(() =>
+ {
+ temporaryFileHelper.LockFiles();
+ throw new Exception();
+ });
+
+ // Assert
+ string expectedMessage = $"Kan het originele bestand ({filePath}) niet herstellen. Het tijdelijke bestand dient handmatig hersteld te worden.";
+ string message = Assert.Throws(test).Message;
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+
+ [Test]
+ public void Perform_ActionThrowsExceptionTargetFileExistsCannotMoveFile_ThrowsIOException()
+ {
+ // Setup
+ string noAccessDirectory = Path.Combine(testWorkDir, nameof(Perform_ActionThrowsExceptionTargetFileExistsCannotMoveFile_ThrowsIOException));
+ string filePath = Path.Combine(noAccessDirectory, "iDoExist.txt");
+
+ using (var directoryHelper = new DirectoryDisposeHelper(testWorkDir, nameof(Perform_ActionThrowsExceptionTargetFileExistsCannotMoveFile_ThrowsIOException)))
+ using (new FileDisposeHelper(filePath))
+ {
+ var helper = new BackedUpFileWriter(filePath);
+
+ // Call
+ TestDelegate test = () => helper.Perform(() =>
+ {
+ directoryHelper.LockDirectory(FileSystemRights.FullControl);
+ throw new Exception();
+ });
+
+ // Assert
+ string expectedMessage = $"Kan het originele bestand ({filePath}) niet herstellen. Het tijdelijke bestand dient handmatig hersteld te worden.";
+ string message = Assert.Throws(test).Message;
+ Assert.AreEqual(expectedMessage, message);
+ }
+ }
+
+ [OneTimeSetUp]
+ public void SetUpFixture()
+ {
+ Directory.CreateDirectory(testWorkDir);
+ }
+
+ [OneTimeTearDown]
+ public void TearDownFixture()
+ {
+ Directory.Delete(testWorkDir, true);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackgroundDataIdentifiersTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackgroundDataIdentifiersTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/BackgroundDataIdentifiersTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,39 @@
+// 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;
+
+namespace Riskeer.Storage.Core.Test
+{
+ [TestFixture]
+ public class BackgroundDataIdentifiersTest
+ {
+ [Test]
+ public void BackgroundDataIdentifiers_ExpectedValues()
+ {
+ Assert.AreEqual("IsConfigured", BackgroundDataIdentifiers.IsConfigured);
+ Assert.AreEqual("SourceCapabilitiesUrl", BackgroundDataIdentifiers.SourceCapabilitiesUrl);
+ Assert.AreEqual("SelectedCapabilityIdentifier", BackgroundDataIdentifiers.SelectedCapabilityIdentifier);
+ Assert.AreEqual("PreferredFormat", BackgroundDataIdentifiers.PreferredFormat);
+ Assert.AreEqual("WellKnownTileSource", BackgroundDataIdentifiers.WellKnownTileSource);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/ColorConversionExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/ColorConversionExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/ColorConversionExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 System.Drawing;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+
+namespace Riskeer.Storage.Core.Test
+{
+ [TestFixture]
+ public class ColorConversionExtensionsTest
+ {
+ [Test]
+ public void ToInt64_WithColor_ReturnsArgbValue()
+ {
+ // Setup
+ const int argb = 123;
+ Color color = Color.FromArgb(argb);
+
+ // Call
+ long? result = color.ToInt64();
+
+ // Assert
+ Assert.AreEqual(argb, result);
+ }
+
+ [Test]
+ public void ToInt64_WithEmptyColor_ReturnsNull()
+ {
+ // Call
+ long? result = Color.Empty.ToInt64();
+
+ // Assert
+ Assert.IsNull(result);
+ }
+
+ [Test]
+ public void ToColor_WithValue_ReturnsColor()
+ {
+ // Setup
+ long? argb = 123;
+
+ // Call
+ Color color = argb.ToColor();
+
+ // Assert
+ Assert.AreEqual(Color.FromArgb(Convert.ToInt32(argb)), color);
+ }
+
+ [Test]
+ public void ToColor_ArgbNull_ReturnsEmptyColor()
+ {
+ // Call
+ Color color = ColorConversionExtensions.ToColor(null);
+
+ // Assert
+ Assert.AreEqual(Color.Empty, color);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(ColorsToTest))]
+ public void GivenColor_WhenConversionRoundtrip_ThenSameColor(Color color)
+ {
+ // When
+ long? intValue = color.ToInt64();
+ Color colorValue = intValue.ToColor();
+
+ // Then
+ Assert.AreEqual(color.ToArgb(), colorValue.ToArgb());
+ }
+
+ private static IEnumerable ColorsToTest()
+ {
+ var random = new Random(31);
+ yield return Color.Black;
+ yield return Color.White;
+ yield return Color.Empty;
+ yield return Color.Transparent;
+ yield return Color.FromArgb(random.Next());
+ yield return Color.FromKnownColor(random.NextEnumValue());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/AssessmentSectionCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/AssessmentSectionCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/AssessmentSectionCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,340 @@
+// 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.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Contribution;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Integration.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class AssessmentSectionCreateExtensionsTest
+ {
+ [Test]
+ [TestCase(AssessmentSectionComposition.Dike)]
+ [TestCase(AssessmentSectionComposition.DikeAndDune)]
+ [TestCase(AssessmentSectionComposition.Dune)]
+ public void Create_WithoutCollector_ThrowsArgumentNullException(AssessmentSectionComposition assessmentSectionComposition)
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(assessmentSectionComposition);
+
+ // Call
+ TestDelegate test = () => assessmentSection.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ [TestCase(AssessmentSectionComposition.Dike)]
+ [TestCase(AssessmentSectionComposition.DikeAndDune)]
+ [TestCase(AssessmentSectionComposition.Dune)]
+ public void Create_WithCollector_ReturnsAssessmentSectionEntityWithCompositionAndFailureMechanisms(AssessmentSectionComposition assessmentSectionComposition)
+ {
+ // Setup
+ const string testId = "testId";
+ const string testName = "testName";
+ const string comments = "Some text";
+ const double lowerLimitNorm = 0.05;
+ const double signalingNorm = 0.02;
+ var random = new Random(65);
+ int order = random.Next();
+
+ const string mapDataName = "map data name";
+ const double transparency = 0.3;
+ const bool isVisible = true;
+ const BackgroundDataType backgroundType = BackgroundDataType.Wmts;
+ var normativeNorm = random.NextEnumValue();
+ var assessmentSection = new AssessmentSection(assessmentSectionComposition)
+ {
+ Id = testId,
+ Name = testName,
+ Comments =
+ {
+ Body = comments
+ },
+ FailureMechanismContribution =
+ {
+ LowerLimitNorm = lowerLimitNorm,
+ SignalingNorm = signalingNorm,
+ NormativeNorm = normativeNorm
+ },
+ BackgroundData =
+ {
+ Name = mapDataName,
+ Transparency = (RoundedDouble) transparency,
+ IsVisible = isVisible,
+ Configuration = new WmtsBackgroundDataConfiguration(false, null, null, null)
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ AssessmentSectionEntity entity = assessmentSection.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(Convert.ToByte(assessmentSectionComposition), entity.Composition);
+ Assert.AreEqual(testId, entity.Id);
+ Assert.AreEqual(testName, entity.Name);
+ Assert.AreEqual(comments, entity.Comments);
+ Assert.AreEqual(lowerLimitNorm, entity.LowerLimitNorm);
+ Assert.AreEqual(signalingNorm, entity.SignalingNorm);
+ Assert.AreEqual(Convert.ToByte(normativeNorm), entity.NormativeNormType);
+ Assert.AreEqual(18, entity.FailureMechanismEntities.Count);
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.Piping));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.GrassRevetmentTopErosionAndInwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.MacroStabilityInwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.MacroStabilityOutwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.Microstability));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StabilityStoneRevetment));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.WaveImpactOnAsphaltRevetment));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.WaterOverpressureAsphaltRevetment));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.GrassRevetmentErosionOutwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.GrassRevetmentSlidingOutwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.GrassRevetmentSlidingInwards));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StructureHeight));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.ReliabilityClosingOfStructure));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.PipingAtStructure));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StabilityPointStructures));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.StrengthAndStabilityParallelConstruction));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.DuneErosion));
+ Assert.IsNotNull(entity.FailureMechanismEntities.SingleOrDefault(fme => fme.FailureMechanismType == (short) FailureMechanismType.TechnicalInnovations));
+ Assert.AreEqual(order, entity.Order);
+
+ Assert.IsNull(entity.ReferenceLinePointXml);
+
+ Assert.AreEqual(1, entity.BackgroundDataEntities.Count);
+ BackgroundDataEntity backgroundDataEntity = entity.BackgroundDataEntities.Single();
+ Assert.IsNotNull(backgroundDataEntity);
+ Assert.AreEqual(mapDataName, backgroundDataEntity.Name);
+ Assert.AreEqual(transparency, backgroundDataEntity.Transparency);
+ Assert.AreEqual(Convert.ToByte(isVisible), backgroundDataEntity.IsVisible);
+ Assert.AreEqual(Convert.ToByte(backgroundType), backgroundDataEntity.BackgroundDataType);
+
+ Assert.AreEqual(1, backgroundDataEntity.BackgroundDataMetaEntities.Count);
+ BackgroundDataMetaEntity isConfiguredMetaEntity = backgroundDataEntity.BackgroundDataMetaEntities.First();
+ Assert.AreEqual("IsConfigured", isConfiguredMetaEntity.Key);
+ Assert.AreEqual("0", isConfiguredMetaEntity.Value);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalName = "name";
+ const string originalComments = "comments";
+
+ var section = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ Name = originalName,
+ Comments =
+ {
+ Body = originalComments
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ AssessmentSectionEntity entity = section.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(originalName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreNotSame(originalComments, entity.Comments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+
+ Assert.AreEqual(originalName, entity.Name);
+ Assert.AreEqual(originalComments, entity.Comments);
+ }
+
+ [Test]
+ public void Create_HydraulicBoundaryDatabaseNotLinked_SetsExpectedPropertiesToEntity()
+ {
+ // Setup
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ assessmentSection.SetHydraulicBoundaryLocationCalculations(assessmentSection.HydraulicBoundaryDatabase.Locations);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ AssessmentSectionEntity entity = assessmentSection.Create(registry, 0);
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.HydraulicBoundaryDatabaseEntities);
+ CollectionAssert.IsEmpty(entity.HydraulicLocationEntities);
+
+ AssertHydraulicLocationCalculationCollectionEntities(assessmentSection, entity);
+ }
+
+ [Test]
+ public void Create_HydraulicBoundaryDatabaseLinked_SetsExpectedPropertiesToEntity()
+ {
+ // Setup
+ const string testFilePath = "path";
+ const string testVersion = "1";
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike)
+ {
+ HydraulicBoundaryDatabase =
+ {
+ FilePath = testFilePath,
+ Version = testVersion,
+ Locations =
+ {
+ new HydraulicBoundaryLocation(-1, "name", 1, 2)
+ }
+ }
+ };
+ assessmentSection.SetHydraulicBoundaryLocationCalculations(assessmentSection.HydraulicBoundaryDatabase.Locations);
+ SetHydraulicBoundaryLocationCalculationInputsOfAssessmentSection(assessmentSection);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ AssessmentSectionEntity entity = assessmentSection.Create(registry, 0);
+
+ // Assert
+ HydraulicBoundaryDatabaseEntity hydraulicBoundaryDatabaseEntity = entity.HydraulicBoundaryDatabaseEntities.Single();
+
+ HydraulicBoundaryDatabase hydraulicBoundaryDatabase = assessmentSection.HydraulicBoundaryDatabase;
+ Assert.AreEqual(hydraulicBoundaryDatabase.FilePath, hydraulicBoundaryDatabaseEntity.FilePath);
+ Assert.AreEqual(hydraulicBoundaryDatabase.Version, hydraulicBoundaryDatabaseEntity.Version);
+
+ HydraulicLocationConfigurationSettings settings = hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings;
+ Assert.AreEqual(settings.FilePath, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsFilePath);
+ Assert.AreEqual(settings.ScenarioName, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsScenarioName);
+ Assert.AreEqual(settings.Year, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsYear);
+ Assert.AreEqual(settings.Scope, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsScope);
+ Assert.AreEqual(settings.SeaLevel, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsSeaLevel);
+ Assert.AreEqual(settings.RiverDischarge, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsRiverDischarge);
+ Assert.AreEqual(settings.LakeLevel, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsLakeLevel);
+ Assert.AreEqual(settings.WindDirection, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsWindDirection);
+ Assert.AreEqual(settings.WindSpeed, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsWindSpeed);
+ Assert.AreEqual(settings.Comment, hydraulicBoundaryDatabaseEntity.HydraulicLocationConfigurationSettingsComment);
+
+ int expectedNrOfHydraulicBoundaryLocations = hydraulicBoundaryDatabase.Locations.Count;
+ Assert.AreEqual(expectedNrOfHydraulicBoundaryLocations, entity.HydraulicLocationEntities.Count);
+
+ AssertHydraulicLocationCalculationCollectionEntities(assessmentSection, entity);
+ }
+
+ [Test]
+ public void Create_WithReferenceLine_AddsReferenceLinePointEntities()
+ {
+ // Setup
+ var points = new[]
+ {
+ new Point2D(1, 0),
+ new Point2D(2, 3),
+ new Point2D(5, 3)
+ };
+
+ var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike);
+ assessmentSection.ReferenceLine.SetGeometry(points);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ AssessmentSectionEntity entity = assessmentSection.Create(registry, 0);
+
+ // Assert
+ string expectedXml = new Point2DCollectionXmlSerializer().ToXml(points);
+ Assert.AreEqual(expectedXml, entity.ReferenceLinePointXml);
+ }
+
+ private static void AssertHydraulicLocationCalculationCollectionEntities(AssessmentSection assessmentSection, AssessmentSectionEntity entity)
+ {
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm,
+ entity.HydraulicLocationCalculationCollectionEntity);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaveHeightCalculationsForLowerLimitNorm,
+ entity.HydraulicLocationCalculationCollectionEntity1);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaveHeightCalculationsForSignalingNorm,
+ entity.HydraulicLocationCalculationCollectionEntity2);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm,
+ entity.HydraulicLocationCalculationCollectionEntity3);
+
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm,
+ entity.HydraulicLocationCalculationCollectionEntity4);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaterLevelCalculationsForLowerLimitNorm,
+ entity.HydraulicLocationCalculationCollectionEntity5);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaterLevelCalculationsForSignalingNorm,
+ entity.HydraulicLocationCalculationCollectionEntity6);
+ AssertHydraulicLocationCalculationCollectionEntity(assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm,
+ entity.HydraulicLocationCalculationCollectionEntity7);
+ }
+
+ private static void SetHydraulicBoundaryLocationCalculationInputsOfAssessmentSection(AssessmentSection assessmentSection)
+ {
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaterLevelCalculationsForFactorizedSignalingNorm, 1);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaterLevelCalculationsForSignalingNorm, 2);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaterLevelCalculationsForLowerLimitNorm, 3);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaterLevelCalculationsForFactorizedLowerLimitNorm, 4);
+
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaveHeightCalculationsForFactorizedSignalingNorm, 5);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaterLevelCalculationsForSignalingNorm, 6);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaveHeightCalculationsForLowerLimitNorm, 7);
+ SetHydraulicBoundaryLocationCalculationInputs(assessmentSection.WaveHeightCalculationsForFactorizedLowerLimitNorm, 8);
+ }
+
+ private static void SetHydraulicBoundaryLocationCalculationInputs(IEnumerable calculations,
+ int seed)
+ {
+ var random = new Random(seed);
+ foreach (HydraulicBoundaryLocationCalculation calculation in calculations)
+ {
+ calculation.InputParameters.ShouldIllustrationPointsBeCalculated = random.NextBoolean();
+ }
+ }
+
+ private static void AssertHydraulicLocationCalculationCollectionEntity(IEnumerable expectedCalculations,
+ HydraulicLocationCalculationCollectionEntity actualCollectionEntity)
+ {
+ Assert.IsNotNull(actualCollectionEntity);
+
+ ICollection hydraulicLocationCalculationEntities = actualCollectionEntity.HydraulicLocationCalculationEntities;
+ Assert.AreEqual(expectedCalculations.Count(), hydraulicLocationCalculationEntities.Count);
+
+ var i = 0;
+ foreach (HydraulicLocationCalculationEntity actualCalculationEntity in hydraulicLocationCalculationEntities)
+ {
+ HydraulicBoundaryLocationCalculation expectedCalculation = expectedCalculations.ElementAt(i);
+ Assert.AreEqual(Convert.ToByte(expectedCalculation.InputParameters.ShouldIllustrationPointsBeCalculated),
+ actualCalculationEntity.ShouldIllustrationPointsBeCalculated);
+ i++;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/BackgroundDataCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/BackgroundDataCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/BackgroundDataCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,179 @@
+// 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.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.AssessmentSection;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class BackgroundDataCreateExtensionsTest
+ {
+ [Test]
+ public void Create_BackgroundDataNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((BackgroundData) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("backgroundData", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_BackgroundDataContainsConfiguredWMTSConfiguration_ReturnsBackgroundDataEntity()
+ {
+ // Setup
+ const string name = "background";
+ const string sourceCapabilitiesUrl = "//url";
+ const string selectedCapabilityName = "selectedName";
+ const string preferredFormat = "image/png";
+ const bool isVisible = true;
+ const bool isConfigured = true;
+ var transparancy = (RoundedDouble) 0.3;
+
+ var configuration = new WmtsBackgroundDataConfiguration(isConfigured,
+ sourceCapabilitiesUrl,
+ selectedCapabilityName,
+ preferredFormat);
+
+ var backgroundData = new BackgroundData(configuration)
+ {
+ IsVisible = isVisible,
+ Transparency = transparancy,
+ Name = name
+ };
+
+ // Call
+ BackgroundDataEntity entity = backgroundData.Create();
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible);
+ Assert.AreEqual(transparancy, entity.Transparency);
+
+ var expectedKeyValuePairs = new Dictionary
+ {
+ {
+ BackgroundDataIdentifiers.IsConfigured, Convert.ToByte(isConfigured).ToString()
+ },
+ {
+ BackgroundDataIdentifiers.SourceCapabilitiesUrl, sourceCapabilitiesUrl
+ },
+ {
+ BackgroundDataIdentifiers.SelectedCapabilityIdentifier, selectedCapabilityName
+ },
+ {
+ BackgroundDataIdentifiers.PreferredFormat, preferredFormat
+ }
+ };
+
+ IEnumerable> actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select(
+ metaEntity => new KeyValuePair(metaEntity.Key, metaEntity.Value));
+ CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs);
+ }
+
+ [Test]
+ public void Create_BackgroundDataContainsUnconfiguredWMTSConfiguration_ReturnsBackgroundDataEntity()
+ {
+ // Setup
+ const string name = "background";
+ const bool isVisible = true;
+ const bool isConfigured = false;
+ var transparancy = (RoundedDouble) 0.3;
+
+ var configuration = new WmtsBackgroundDataConfiguration();
+
+ var backgroundData = new BackgroundData(configuration)
+ {
+ IsVisible = isVisible,
+ Transparency = transparancy,
+ Name = name
+ };
+
+ // Call
+ BackgroundDataEntity entity = backgroundData.Create();
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible);
+ Assert.AreEqual(transparancy, entity.Transparency);
+
+ var expectedKeyValuePairs = new Dictionary
+ {
+ {
+ BackgroundDataIdentifiers.IsConfigured, Convert.ToByte(isConfigured).ToString()
+ }
+ };
+
+ IEnumerable> actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select(
+ metaEntity => new KeyValuePair(metaEntity.Key, metaEntity.Value));
+ CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs);
+ }
+
+ [Test]
+ public void Create_BackgroundDataContainsWellKnownConfiguration_ReturnsBackgroundDataEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var wellKnownTileSource = random.NextEnumValue();
+
+ const string name = "background";
+ const bool isVisible = true;
+ const BackgroundDataType backgroundDataType = BackgroundDataType.WellKnown;
+ var transparancy = (RoundedDouble) 0.3;
+
+ var configuration = new WellKnownBackgroundDataConfiguration(wellKnownTileSource);
+ var backgroundData = new BackgroundData(configuration)
+ {
+ IsVisible = isVisible,
+ Transparency = transparancy,
+ Name = name
+ };
+
+ // Call
+ BackgroundDataEntity entity = backgroundData.Create();
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible);
+ Assert.AreEqual(transparancy, entity.Transparency);
+ Assert.AreEqual(Convert.ToByte(backgroundDataType), entity.BackgroundDataType);
+
+ var expectedKeyValuePairs = new Dictionary
+ {
+ {
+ BackgroundDataIdentifiers.WellKnownTileSource, ((int) wellKnownTileSource).ToString()
+ }
+ };
+ IEnumerable> actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select(
+ metaEntity => new KeyValuePair(metaEntity.Key, metaEntity.Value));
+ CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/CalculationGroupCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/CalculationGroupCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/CalculationGroupCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,1005 @@
+// 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.Linq;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.Piping.Data;
+using Ringtoets.StabilityPointStructures.Data;
+using Ringtoets.StabilityStoneCover.Data;
+using Ringtoets.WaveImpactAsphaltCover.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class CalculationGroupCreateExtensionsTest
+ {
+ [Test]
+ public void Create_RegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var group = new CalculationGroup();
+
+ // Call
+ TestDelegate call = () => group.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(123)]
+ public void Create_GroupWithoutChildren_CreateEntity(int order)
+ {
+ // Setup
+ const string name = "blaballab";
+ var group = new CalculationGroup
+ {
+ Name = name
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(order, entity.Order);
+
+ CollectionAssert.IsEmpty(entity.CalculationGroupEntity1);
+ CollectionAssert.IsEmpty(entity.FailureMechanismEntities);
+ Assert.IsNull(entity.ParentCalculationGroupEntityId);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "original";
+ var group = new CalculationGroup
+ {
+ Name = name
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(name, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(name, entity.Name);
+ }
+
+ [Test]
+ public void Create_GroupWithChildren_CreateEntities()
+ {
+ // Setup
+ const string name = "blaballab";
+ var group = new CalculationGroup
+ {
+ Name = name
+ };
+ group.Children.Add(new CalculationGroup
+ {
+ Name = "A",
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "AA"
+ },
+ new CalculationGroup
+ {
+ Name = "AB"
+ }
+ }
+ });
+ group.Children.Add(new CalculationGroup
+ {
+ Name = "B"
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(0, entity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ Assert.AreEqual(2, childEntity1.CalculationGroupEntity1.Count);
+ CalculationGroupEntity childEntity1ChildEntity1 = childEntity1.CalculationGroupEntity1.ElementAt(0);
+ Assert.AreEqual("AA", childEntity1ChildEntity1.Name);
+ Assert.AreEqual(0, childEntity1ChildEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1ChildEntity1.CalculationGroupEntity1);
+ CalculationGroupEntity childEntity1ChildEntity2 = childEntity1.CalculationGroupEntity1.ElementAt(1);
+ Assert.AreEqual("AB", childEntity1ChildEntity2.Name);
+ Assert.AreEqual(1, childEntity1ChildEntity2.Order);
+ CollectionAssert.IsEmpty(childEntity1ChildEntity2.CalculationGroupEntity1);
+
+ CalculationGroupEntity childEntity2 = childGroupEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ CollectionAssert.IsEmpty(childEntity2.CalculationGroupEntity1);
+ }
+
+ [Test]
+ public void Create_GroupWithChildPipingCalculations_CreateEntities()
+ {
+ // Setup
+ var generalInputParameters = new GeneralPipingInput();
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new PipingCalculationScenario(generalInputParameters)
+ {
+ Name = "A"
+ },
+ new PipingCalculationScenario(generalInputParameters)
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ PipingCalculationEntity[] childCalculationEntities = entity.PipingCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ PipingCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ PipingCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildPipingCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var generalInputParameters = new GeneralPipingInput();
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new PipingCalculationScenario(generalInputParameters)
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new PipingCalculationScenario(generalInputParameters)
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ PipingCalculationEntity[] childCalculationEntities = entity.PipingCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ PipingCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ PipingCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithMacroStabilityInwardsCalculations_CreatesEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new MacroStabilityInwardsCalculationScenario
+ {
+ Name = "A"
+ },
+ new MacroStabilityInwardsCalculationScenario
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ MacroStabilityInwardsCalculationEntity[] childCalculationEntities = entity.MacroStabilityInwardsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ MacroStabilityInwardsCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+
+ MacroStabilityInwardsCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildMacroStabilityInwardsCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new MacroStabilityInwardsCalculationScenario
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new MacroStabilityInwardsCalculationScenario
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ MacroStabilityInwardsCalculationEntity[] childCalculationEntities = entity.MacroStabilityInwardsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ MacroStabilityInwardsCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ MacroStabilityInwardsCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildGrassCoverErosionInwardsCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new GrassCoverErosionInwardsCalculation
+ {
+ Name = "A"
+ },
+ new GrassCoverErosionInwardsCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ GrassCoverErosionInwardsCalculationEntity[] childCalculationEntities = entity.GrassCoverErosionInwardsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ GrassCoverErosionInwardsCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ GrassCoverErosionInwardsCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildGrassCoverErosionInwardCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new GrassCoverErosionInwardsCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new GrassCoverErosionInwardsCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ GrassCoverErosionInwardsCalculationEntity[] childCalculationEntities = entity.GrassCoverErosionInwardsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ GrassCoverErosionInwardsCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ GrassCoverErosionInwardsCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildGrassCoverErosionOutwardsWaveConditionsCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "A"
+ },
+ new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity[] childCalculationEntities = entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildGrassCoverErosionOutwardsWaveConditionsCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity[] childCalculationEntities = entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildHeightStructuresCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new StructuresCalculation
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ HeightStructuresCalculationEntity[] childCalculationEntities = entity.HeightStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ HeightStructuresCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ HeightStructuresCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildHeightStructuresCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new StructuresCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ HeightStructuresCalculationEntity[] childCalculationEntities = entity.HeightStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ HeightStructuresCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ HeightStructuresCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildStabilityStoneCoverWaveConditionsCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ },
+ new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ StabilityStoneCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.StabilityStoneCoverWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ StabilityStoneCoverWaveConditionsCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ StabilityStoneCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildStabilityStoneCoverWaveConditionsCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new StabilityStoneCoverWaveConditionsCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ StabilityStoneCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.StabilityStoneCoverWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ StabilityStoneCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ StabilityStoneCoverWaveConditionsCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildWaveImpactAsphaltCoverWaveConditionsCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "A"
+ },
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildWaveImpactAsphaltCoverWaveConditionsCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new WaveImpactAsphaltCoverWaveConditionsCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity[] childCalculationEntities = entity.WaveImpactAsphaltCoverWaveConditionsCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ WaveImpactAsphaltCoverWaveConditionsCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildClosingStructuresCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new StructuresCalculation
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ ClosingStructuresCalculationEntity[] childCalculationEntities = entity.ClosingStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ ClosingStructuresCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ ClosingStructuresCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildClosingStructuresCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new StructuresCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ ClosingStructuresCalculationEntity[] childCalculationEntities = entity.ClosingStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ ClosingStructuresCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ ClosingStructuresCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildStabilityPointStructuresCalculations_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new StructuresCalculation
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ StabilityPointStructuresCalculationEntity[] childCalculationEntities = entity.StabilityPointStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ StabilityPointStructuresCalculationEntity childEntity1 = childCalculationEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ StabilityPointStructuresCalculationEntity childEntity2 = childCalculationEntities[1];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+ }
+
+ [Test]
+ public void Create_GroupWithChildStabilityPointStructuresCalculationsAndChildCalculationGroups_CreateEntities()
+ {
+ // Setup
+ var group = new CalculationGroup
+ {
+ Children =
+ {
+ new CalculationGroup
+ {
+ Name = "A"
+ },
+ new StructuresCalculation
+ {
+ Name = "B"
+ },
+ new CalculationGroup
+ {
+ Name = "C"
+ },
+ new StructuresCalculation
+ {
+ Name = "D"
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ CalculationGroupEntity entity = group.Create(registry, 0);
+
+ // Assert
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity1.ToArray();
+ StabilityPointStructuresCalculationEntity[] childCalculationEntities = entity.StabilityPointStructuresCalculationEntities.ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual(2, childCalculationEntities.Length);
+
+ CalculationGroupEntity childEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childEntity1.Name);
+ Assert.AreEqual(0, childEntity1.Order);
+ CollectionAssert.IsEmpty(childEntity1.CalculationGroupEntity1);
+
+ StabilityPointStructuresCalculationEntity childEntity2 = childCalculationEntities[0];
+ Assert.AreEqual("B", childEntity2.Name);
+ Assert.AreEqual(1, childEntity2.Order);
+
+ CalculationGroupEntity childEntity3 = childGroupEntities[1];
+ Assert.AreEqual("C", childEntity3.Name);
+ Assert.AreEqual(2, childEntity3.Order);
+ CollectionAssert.IsEmpty(childEntity3.CalculationGroupEntity1);
+
+ StabilityPointStructuresCalculationEntity childEntity4 = childCalculationEntities[1];
+ Assert.AreEqual("D", childEntity4.Name);
+ Assert.AreEqual(3, childEntity4.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructureCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructureCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructureCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,208 @@
+// 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.Base.Data;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.ClosingStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.ClosingStructures
+{
+ [TestFixture]
+ public class ClosingStructureCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowArgumentNullException()
+ {
+ // Setup
+ ClosingStructure structure = new TestClosingStructure();
+
+ // Call
+ TestDelegate call = () => structure.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_ValidStructure_ReturnEntity()
+ {
+ // Setup
+ ClosingStructure structure = new TestClosingStructure();
+ var registry = new PersistenceRegistry();
+
+ const int order = 4;
+
+ // Call
+ ClosingStructureEntity entity = structure.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(structure.Name, entity.Name);
+ Assert.AreNotSame(structure.Name, entity.Name);
+ Assert.AreEqual(structure.Id, entity.Id);
+ Assert.AreNotSame(structure.Id, entity.Id);
+ Assert.AreEqual(structure.Location.X, entity.X);
+ Assert.AreEqual(structure.Location.Y, entity.Y);
+ Assert.AreEqual(structure.StructureNormalOrientation.Value, entity.StructureNormalOrientation);
+
+ Assert.AreEqual(structure.StorageStructureArea.Mean.Value, entity.StorageStructureAreaMean);
+ Assert.AreEqual(structure.StorageStructureArea.CoefficientOfVariation.Value, entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.AreEqual(structure.AllowedLevelIncreaseStorage.Mean.Value, entity.AllowedLevelIncreaseStorageMean);
+ Assert.AreEqual(structure.AllowedLevelIncreaseStorage.StandardDeviation.Value, entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.AreEqual(structure.WidthFlowApertures.Mean.Value, entity.WidthFlowAperturesMean);
+ Assert.AreEqual(structure.WidthFlowApertures.StandardDeviation.Value, entity.WidthFlowAperturesStandardDeviation);
+ Assert.AreEqual(structure.LevelCrestStructureNotClosing.Mean.Value, entity.LevelCrestStructureNotClosingMean);
+ Assert.AreEqual(structure.LevelCrestStructureNotClosing.StandardDeviation.Value, entity.LevelCrestStructureNotClosingStandardDeviation);
+ Assert.AreEqual(structure.InsideWaterLevel.Mean.Value, entity.InsideWaterLevelMean);
+ Assert.AreEqual(structure.InsideWaterLevel.StandardDeviation.Value, entity.InsideWaterLevelStandardDeviation);
+ Assert.AreEqual(structure.ThresholdHeightOpenWeir.Mean.Value, entity.ThresholdHeightOpenWeirMean);
+ Assert.AreEqual(structure.ThresholdHeightOpenWeir.StandardDeviation.Value, entity.ThresholdHeightOpenWeirStandardDeviation);
+ Assert.AreEqual(structure.AreaFlowApertures.Mean.Value, entity.AreaFlowAperturesMean);
+ Assert.AreEqual(structure.AreaFlowApertures.StandardDeviation.Value, entity.AreaFlowAperturesStandardDeviation);
+ Assert.AreEqual(structure.CriticalOvertoppingDischarge.Mean.Value, entity.CriticalOvertoppingDischargeMean);
+ Assert.AreEqual(structure.CriticalOvertoppingDischarge.CoefficientOfVariation.Value, entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.AreEqual(structure.FlowWidthAtBottomProtection.Mean.Value, entity.FlowWidthAtBottomProtectionMean);
+ Assert.AreEqual(structure.FlowWidthAtBottomProtection.StandardDeviation.Value, entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.AreEqual(structure.ProbabilityOpenStructureBeforeFlooding, entity.ProbabilityOpenStructureBeforeFlooding);
+ Assert.AreEqual(structure.FailureProbabilityOpenStructure, entity.FailureProbabilityOpenStructure);
+ Assert.AreEqual(structure.IdenticalApertures, entity.IdenticalApertures);
+ Assert.AreEqual(structure.FailureProbabilityReparation, entity.FailureProbabilityReparation);
+ Assert.AreEqual(Convert.ToByte(structure.InflowModelType), entity.InflowModelType);
+ Assert.AreEqual(order, entity.Order);
+
+ Assert.IsTrue(registry.Contains(structure));
+ }
+
+ [Test]
+ public void Create_NaNValue_ReturnEntityWithNullValue()
+ {
+ // Setup
+ var structure = new ClosingStructure(new ClosingStructure.ConstructionProperties
+ {
+ Name = "A",
+ Id = "B",
+ Location = new Point2D(double.NaN, double.NaN),
+ StructureNormalOrientation = RoundedDouble.NaN,
+ StorageStructureArea =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ WidthFlowApertures =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ LevelCrestStructureNotClosing =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ InsideWaterLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ ThresholdHeightOpenWeir =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ AreaFlowApertures =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ CriticalOvertoppingDischarge =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ FlowWidthAtBottomProtection =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ ProbabilityOpenStructureBeforeFlooding = double.NaN,
+ FailureProbabilityOpenStructure = double.NaN,
+ FailureProbabilityReparation = double.NaN
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ClosingStructureEntity entity = structure.Create(registry, 0);
+
+ // Assert
+ Assert.IsNull(entity.X);
+ Assert.IsNull(entity.Y);
+ Assert.IsNull(entity.StructureNormalOrientation);
+ Assert.IsNull(entity.StorageStructureAreaMean);
+ Assert.IsNull(entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageMean);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.IsNull(entity.WidthFlowAperturesMean);
+ Assert.IsNull(entity.WidthFlowAperturesStandardDeviation);
+ Assert.IsNull(entity.LevelCrestStructureNotClosingMean);
+ Assert.IsNull(entity.LevelCrestStructureNotClosingStandardDeviation);
+ Assert.IsNull(entity.InsideWaterLevelMean);
+ Assert.IsNull(entity.InsideWaterLevelStandardDeviation);
+ Assert.IsNull(entity.ThresholdHeightOpenWeirMean);
+ Assert.IsNull(entity.ThresholdHeightOpenWeirStandardDeviation);
+ Assert.IsNull(entity.AreaFlowAperturesMean);
+ Assert.IsNull(entity.AreaFlowAperturesStandardDeviation);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeMean);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionMean);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.IsNull(entity.ProbabilityOpenStructureBeforeFlooding);
+ Assert.IsNull(entity.FailureProbabilityOpenStructure);
+ Assert.IsNull(entity.FailureProbabilityReparation);
+ }
+
+ [Test]
+ public void Create_StructureAlreadyRegistered_ReturnRegisteredEntity()
+ {
+ // Setup
+ ClosingStructure structure = new TestClosingStructure();
+
+ var registeredEntity = new ClosingStructureEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(registeredEntity, structure);
+
+ // Call
+ ClosingStructureEntity entity = structure.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(registeredEntity, entity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,263 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.ClosingStructures.Data;
+using Ringtoets.ClosingStructures.Data.TestUtil;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.ClosingStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.ClosingStructures
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ GeneralInput =
+ {
+ N2A = new Random().Next(0, 40)
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.ReliabilityClosingOfStructure, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ ClosingStructuresFailureMechanismMetaEntity metaEntity = entity.ClosingStructuresFailureMechanismMetaEntities.Single();
+ Assert.AreEqual(failureMechanism.GeneralInput.N2A, metaEntity.N2A);
+ Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath);
+ Assert.IsNull(metaEntity.ClosingStructureCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new ClosingStructuresFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.ClosingStructuresSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithForeshoreProfiles_ForeshoreProfileEntitiesCreated()
+ {
+ // Setup
+ var profile = new TestForeshoreProfile();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ const string filePath = "some/file/path/foreshoreProfiles";
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ profile
+ }, filePath);
+
+ var persistenceRegistry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(persistenceRegistry);
+
+ // Assert
+ Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count);
+ Assert.IsTrue(persistenceRegistry.Contains(profile));
+
+ ClosingStructuresFailureMechanismMetaEntity metaEntity =
+ entity.ClosingStructuresFailureMechanismMetaEntities.Single();
+ string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithClosingStructures_ClosingStructureEntitiesCreated()
+ {
+ // Setup
+ ClosingStructure structure = new TestClosingStructure();
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ const string filePath = "some path";
+ failureMechanism.ClosingStructures.AddRange(new[]
+ {
+ structure
+ }, filePath);
+
+ var persistenceRegistry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(persistenceRegistry);
+
+ // Assert
+ Assert.AreEqual(1, entity.ClosingStructureEntities.Count);
+ Assert.IsTrue(persistenceRegistry.Contains(structure));
+
+ ClosingStructuresFailureMechanismMetaEntity metaEntity =
+ entity.ClosingStructuresFailureMechanismMetaEntities.Single();
+ string entitySourcePath = metaEntity.ClosingStructureCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(filePath, entitySourcePath);
+ }
+
+ [Test]
+ public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities()
+ {
+ // Setup
+ StructuresCalculation calculation = new TestClosingStructuresCalculation();
+ calculation.InputParameters.Structure = null;
+ calculation.InputParameters.HydraulicBoundaryLocation = null;
+
+ var failureMechanism = new ClosingStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
+ {
+ Name = "A"
+ });
+ failureMechanism.CalculationsGroup.Children.Add(calculation);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
+ Assert.AreEqual(0, entity.CalculationGroupEntity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
+ .OrderBy(cge => cge.Order)
+ .ToArray();
+ Assert.AreEqual(1, childGroupEntities.Length);
+ CalculationGroupEntity childGroupEntity = childGroupEntities[0];
+ Assert.AreEqual("A", childGroupEntity.Name);
+ Assert.AreEqual(0, childGroupEntity.Order);
+
+ ClosingStructuresCalculationEntity[] calculationEntities = entity.CalculationGroupEntity.ClosingStructuresCalculationEntities
+ .OrderBy(ce => ce.Order)
+ .ToArray();
+ ClosingStructuresCalculationEntity calculationEntity = calculationEntities[0];
+ Assert.AreEqual("Nieuwe berekening", calculationEntity.Name);
+ Assert.AreEqual(1, calculationEntity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,137 @@
+// 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 Ringtoets.ClosingStructures.Data;
+using Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.ClosingStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.ClosingStructures
+{
+ [TestFixture]
+ public class ClosingStructuresFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((ClosingStructuresFailureMechanismSectionResult) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistencyRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double tailorMadeAssessmentProbability = random.NextDouble();
+ bool useManualAssembly = random.NextBoolean();
+ double manualAssemblyProbability = random.NextDouble();
+
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ TailorMadeAssessmentProbability = tailorMadeAssessmentProbability,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyProbability = manualAssemblyProbability
+ };
+
+ // Call
+ ClosingStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(tailorMadeAssessmentProbability, entity.TailorMadeAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(manualAssemblyProbability, entity.ManualAssemblyProbability);
+ Assert.IsNull(entity.ClosingStructuresCalculationEntityId);
+ }
+
+ [Test]
+ public void Create_SectionResultWithNaNValues_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ TailorMadeAssessmentProbability = double.NaN,
+ ManualAssemblyProbability = double.NaN
+ };
+
+ // Call
+ ClosingStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNull(entity.TailorMadeAssessmentProbability);
+ Assert.IsNull(entity.ManualAssemblyProbability);
+ }
+
+ [Test]
+ public void Create_CalculationSet_ReturnEntityWithCalculationEntity()
+ {
+ // Setup
+ var calculation = new StructuresCalculation();
+ var sectionResult = new ClosingStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ Calculation = calculation
+ };
+
+ var registry = new PersistenceRegistry();
+ var calculationEntity = new ClosingStructuresCalculationEntity();
+ registry.Register(calculationEntity, calculation);
+
+ // Call
+ ClosingStructuresSectionResultEntity entity = sectionResult.Create(registry);
+
+ // Assert
+ Assert.AreSame(calculationEntity, entity.ClosingStructuresCalculationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,278 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data;
+using Ringtoets.DuneErosion.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneErosionFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ IsRelevant = random.NextBoolean(),
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ GeneralInput =
+ {
+ N = random.NextRoundedDouble(1, 20)
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.DuneErosion, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ DuneErosionFailureMechanismMetaEntity metaEntity = entity.DuneErosionFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N, failureMechanism.GeneralInput.N.GetAccuracy());
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new DuneErosionFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new DuneErosionFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.DuneErosionSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithoutDuneLocations_ReturnsEntityWithoutDuneLocations()
+ {
+ // Setup
+ var failureMechanism = new DuneErosionFailureMechanism();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.DuneLocationEntities);
+
+ DuneErosionFailureMechanismMetaEntity metaEntity = entity.DuneErosionFailureMechanismMetaEntities.Single();
+ AssertDuneLocationCalculationCollectionEntities(failureMechanism, registry, metaEntity);
+ }
+
+ [Test]
+ public void Create_WithDuneLocations_ReturnsEntityWithDuneLocations()
+ {
+ // Setup
+ var duneLocation = new TestDuneLocation();
+ var failureMechanism = new DuneErosionFailureMechanism();
+ failureMechanism.SetDuneLocations(new[]
+ {
+ duneLocation
+ });
+ SetDuneLocationCalculationOutput(failureMechanism);
+
+ var duneLocationEntity = new DuneLocationEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(duneLocationEntity, duneLocation);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ DuneLocationEntity actualDuneLocationEntity = entity.DuneLocationEntities.Single();
+ Assert.AreSame(duneLocationEntity, actualDuneLocationEntity);
+
+ DuneErosionFailureMechanismMetaEntity metaEntity = entity.DuneErosionFailureMechanismMetaEntities.Single();
+ AssertDuneLocationCalculationCollectionEntities(failureMechanism, registry, metaEntity);
+ }
+
+ private static void AssertDuneLocationCalculationCollectionEntities(DuneErosionFailureMechanism failureMechanism,
+ PersistenceRegistry registry,
+ DuneErosionFailureMechanismMetaEntity metaEntity)
+ {
+ AssertDuneLocationCalculationCollectionEntity(failureMechanism.CalculationsForFactorizedLowerLimitNorm,
+ registry,
+ metaEntity.DuneLocationCalculationCollectionEntity);
+ AssertDuneLocationCalculationCollectionEntity(failureMechanism.CalculationsForLowerLimitNorm,
+ registry,
+ metaEntity.DuneLocationCalculationCollectionEntity1);
+ AssertDuneLocationCalculationCollectionEntity(failureMechanism.CalculationsForMechanismSpecificLowerLimitNorm,
+ registry,
+ metaEntity.DuneLocationCalculationCollectionEntity2);
+ AssertDuneLocationCalculationCollectionEntity(failureMechanism.CalculationsForMechanismSpecificSignalingNorm,
+ registry,
+ metaEntity.DuneLocationCalculationCollectionEntity3);
+ AssertDuneLocationCalculationCollectionEntity(failureMechanism.CalculationsForMechanismSpecificFactorizedSignalingNorm,
+ registry,
+ metaEntity.DuneLocationCalculationCollectionEntity4);
+ }
+
+ private static void SetDuneLocationCalculationOutput(DuneErosionFailureMechanism failureMechanism)
+ {
+ SetDuneLocationCalculationOutput(failureMechanism.CalculationsForMechanismSpecificFactorizedSignalingNorm, 1);
+ SetDuneLocationCalculationOutput(failureMechanism.CalculationsForMechanismSpecificSignalingNorm, 2);
+ SetDuneLocationCalculationOutput(failureMechanism.CalculationsForMechanismSpecificLowerLimitNorm, 3);
+ SetDuneLocationCalculationOutput(failureMechanism.CalculationsForLowerLimitNorm, 4);
+ SetDuneLocationCalculationOutput(failureMechanism.CalculationsForFactorizedLowerLimitNorm, 5);
+ }
+
+ private static void SetDuneLocationCalculationOutput(IEnumerable calculations,
+ int seed)
+ {
+ var random = new Random(seed);
+ foreach (DuneLocationCalculation calculation in calculations)
+ {
+ calculation.Output = random.NextBoolean()
+ ? new TestDuneLocationCalculationOutput()
+ : null;
+ }
+ }
+
+ private static void AssertDuneLocationCalculationCollectionEntity(IEnumerable expectedCalculations,
+ PersistenceRegistry registry,
+ DuneLocationCalculationCollectionEntity actualCollectionEntity)
+ {
+ Assert.IsNotNull(actualCollectionEntity);
+ ICollection duneLocationCalculationEntities = actualCollectionEntity.DuneLocationCalculationEntities;
+ Assert.AreEqual(expectedCalculations.Count(), duneLocationCalculationEntities.Count);
+
+ var i = 0;
+ foreach (DuneLocationCalculationEntity duneLocationCalculationEntity in duneLocationCalculationEntities)
+ {
+ DuneLocationCalculation expectedDuneLocationCalculation = expectedCalculations.ElementAt(i);
+ DuneLocation expectedDuneLocation = expectedDuneLocationCalculation.DuneLocation;
+ Assert.AreSame(registry.Get(expectedDuneLocation), duneLocationCalculationEntity.DuneLocationEntity);
+
+ DuneLocationCalculationOutputEntity actualOutput = duneLocationCalculationEntity.DuneLocationCalculationOutputEntities.SingleOrDefault();
+ if (expectedDuneLocationCalculation.Output != null)
+ {
+ Assert.IsNotNull(actualOutput);
+ }
+ else
+ {
+ Assert.IsNull(actualOutput);
+ }
+
+ i++;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.DuneErosion.Data;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneErosionFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((DuneErosionFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue();
+
+ var sectionResult = new DuneErosionFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResultForFactorizedSignalingNorm = detailedAssessmentResultForFactorizedSignalingNorm,
+ DetailedAssessmentResultForSignalingNorm = detailedAssessmentResultForSignalingNorm,
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = detailedAssessmentResultForMechanismSpecificLowerLimitNorm,
+ DetailedAssessmentResultForLowerLimitNorm = detailedAssessmentResultForLowerLimitNorm,
+ DetailedAssessmentResultForFactorizedLowerLimitNorm = detailedAssessmentResultForFactorizedLowerLimitNorm,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyCategoryGroup = manualAssemblyCategoryGroup
+ };
+
+ // Call
+ DuneErosionSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForFactorizedSignalingNorm), entity.DetailedAssessmentResultForFactorizedSignalingNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForSignalingNorm), entity.DetailedAssessmentResultForSignalingNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForMechanismSpecificLowerLimitNorm), entity.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForLowerLimitNorm), entity.DetailedAssessmentResultForLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForFactorizedLowerLimitNorm), entity.DetailedAssessmentResultForFactorizedLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(Convert.ToByte(manualAssemblyCategoryGroup), entity.ManualAssemblyCategoryGroup);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCollectionCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCollectionCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCollectionCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 NUnit.Framework;
+using Ringtoets.DuneErosion.Data;
+using Ringtoets.DuneErosion.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneLocationCalculationCollectionCreateExtensionsTest
+ {
+ [Test]
+ public void Create_CalculationsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () =>
+ ((IEnumerable) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculations", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_RegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ IEnumerable calculations =
+ Enumerable.Empty();
+
+ // Call
+ TestDelegate call = () => calculations.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithValidCollectionAndArguments_ReturnsEntity()
+ {
+ // Setup
+ var duneLocation = new TestDuneLocation();
+ var calculation = new DuneLocationCalculation(duneLocation);
+ DuneLocationCalculation[] calculations =
+ {
+ calculation
+ };
+
+ var duneLocationEntity = new DuneLocationEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(duneLocationEntity, duneLocation);
+
+ // Call
+ DuneLocationCalculationCollectionEntity entity = calculations.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+
+ DuneLocationCalculationEntity calculationEntity = entity.DuneLocationCalculationEntities.Single();
+ Assert.AreSame(duneLocationEntity, calculationEntity.DuneLocationEntity);
+ CollectionAssert.IsEmpty(calculationEntity.DuneLocationCalculationOutputEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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;
+using System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data;
+using Ringtoets.DuneErosion.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneLocationCalculationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((DuneLocationCalculation) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculation", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculation = new DuneLocationCalculation(new TestDuneLocation());
+
+ // Call
+ TestDelegate call = () => calculation.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_CalculationWithoutOutput_ReturnsDuneLocationCalculationEntity()
+ {
+ // Setup
+ var duneLocation = new TestDuneLocation();
+ var calculation = new DuneLocationCalculation(duneLocation);
+
+ var registry = new PersistenceRegistry();
+ var duneLocationEntity = new DuneLocationEntity();
+ registry.Register(duneLocationEntity, duneLocation);
+
+ // Call
+ DuneLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ CollectionAssert.IsEmpty(entity.DuneLocationCalculationOutputEntities);
+ }
+
+ [Test]
+ public void Create_CalculationWithOutput_ReturnsDuneLocationCalculationEntityWithOutput()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DuneLocationCalculationOutput(random.NextEnumValue(), new DuneLocationCalculationOutput.ConstructionProperties
+ {
+ WaterLevel = random.NextDouble(),
+ WaveHeight = random.NextDouble(),
+ WavePeriod = random.NextDouble(),
+ CalculatedProbability = random.NextDouble(),
+ CalculatedReliability = random.NextDouble(),
+ TargetProbability = random.NextDouble(),
+ TargetReliability = random.NextDouble()
+ });
+
+ var duneLocation = new TestDuneLocation();
+ var calculation = new DuneLocationCalculation(duneLocation)
+ {
+ Output = output
+ };
+
+ var registry = new PersistenceRegistry();
+ var duneLocationEntity = new DuneLocationEntity();
+ registry.Register(duneLocationEntity, duneLocation);
+
+ // Call
+ DuneLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+
+ DuneLocationCalculationOutputEntity outputEntity = entity.DuneLocationCalculationOutputEntities.Single();
+ Assert.AreEqual(output.WaterLevel, outputEntity.WaterLevel, output.WaterLevel.GetAccuracy());
+ Assert.AreEqual(output.WaveHeight, outputEntity.WaveHeight, output.WaveHeight.GetAccuracy());
+ Assert.AreEqual(output.WavePeriod, outputEntity.WavePeriod, output.WavePeriod.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, outputEntity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, outputEntity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, outputEntity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, outputEntity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(output.CalculationConvergence), outputEntity.CalculationConvergence);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadyRegisteredDuneLocation_ReturnsEntityWithDuneLocationEntity()
+ {
+ // Setup
+ var duneLocation = new TestDuneLocation();
+ var calculation = new DuneLocationCalculation(duneLocation);
+
+ var registry = new PersistenceRegistry();
+ var duneLocationEntity = new DuneLocationEntity();
+ registry.Register(duneLocationEntity, duneLocation);
+
+ // Call
+ DuneLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreSame(duneLocationEntity, entity.DuneLocationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCalculationOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,109 @@
+// 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 Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneLocationCalculationOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_DuneLocationCalculationOutputNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((DuneLocationCalculationOutput) null).Create();
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("output", paramName);
+ }
+
+ [Test]
+ public void Create_WithValidParameters_ReturnsDuneLocationCalculationOutputEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DuneLocationCalculationOutput(random.NextEnumValue(), new DuneLocationCalculationOutput.ConstructionProperties
+ {
+ WaterLevel = random.NextDouble(),
+ WaveHeight = random.NextDouble(),
+ WavePeriod = random.NextDouble(),
+ TargetProbability = random.NextDouble(),
+ TargetReliability = random.NextDouble(),
+ CalculatedProbability = random.NextDouble(),
+ CalculatedReliability = random.NextDouble()
+ });
+
+ // Call
+ DuneLocationCalculationOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(output.WaterLevel, entity.WaterLevel, output.WaterLevel.GetAccuracy());
+ Assert.AreEqual(output.WaveHeight, entity.WaveHeight, output.WaveHeight.GetAccuracy());
+ Assert.AreEqual(output.WavePeriod, entity.WavePeriod, output.WavePeriod.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, entity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, entity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, entity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, entity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(output.CalculationConvergence), entity.CalculationConvergence);
+ }
+
+ [Test]
+ public void Create_WithNaNParameters_ReturnsDuneLocationCalculationOutputEntityWithNullValues()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DuneLocationCalculationOutput(random.NextEnumValue(), new DuneLocationCalculationOutput.ConstructionProperties
+ {
+ WaterLevel = double.NaN,
+ WaveHeight = double.NaN,
+ WavePeriod = double.NaN,
+ TargetProbability = double.NaN,
+ TargetReliability = double.NaN,
+ CalculatedProbability = double.NaN,
+ CalculatedReliability = double.NaN
+ });
+
+ // Call
+ DuneLocationCalculationOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.WaterLevel);
+ Assert.IsNull(entity.WaveHeight);
+ Assert.IsNull(entity.WavePeriod);
+ Assert.IsNull(entity.TargetProbability);
+ Assert.IsNull(entity.TargetReliability);
+ Assert.IsNull(entity.CalculatedProbability);
+ Assert.IsNull(entity.CalculatedReliability);
+ Assert.AreEqual(Convert.ToByte(output.CalculationConvergence), entity.CalculationConvergence);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/DuneErosion/DuneLocationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.DuneErosion.Data;
+using Ringtoets.DuneErosion.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.DuneErosion;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.DuneErosion
+{
+ [TestFixture]
+ public class DuneLocationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_DuneLocationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((DuneLocation) null).Create(new PersistenceRegistry(), 0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("location", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var location = new TestDuneLocation();
+
+ // Call
+ TestDelegate test = () => location.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_WithPersistenceRegistry_ReturnsDuneLocationEntityWithPropertiesSet()
+ {
+ // Setup
+ const string testName = "testName";
+ var random = new Random(21);
+ double coordinateX = random.NextDouble();
+ double coordinateY = random.NextDouble();
+ int id = random.Next(0, 150);
+ int order = random.Next();
+ var registry = new PersistenceRegistry();
+
+ var location = new DuneLocation(id, testName, new Point2D(coordinateX, coordinateY),
+ new DuneLocation.ConstructionProperties
+ {
+ CoastalAreaId = random.Next(),
+ Offset = random.NextDouble(),
+ Orientation = random.NextDouble(),
+ D50 = random.NextDouble()
+ });
+
+ // Call
+ DuneLocationEntity entity = location.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(id, entity.LocationId);
+ Assert.AreEqual(testName, entity.Name);
+ Assert.AreEqual(coordinateX, entity.LocationX);
+ Assert.AreEqual(coordinateY, entity.LocationY);
+ Assert.AreEqual(location.CoastalAreaId, entity.CoastalAreaId);
+ Assert.AreEqual(location.Offset, entity.Offset, location.Offset.GetAccuracy());
+ Assert.AreEqual(location.Orientation, entity.Orientation, location.Orientation.GetAccuracy());
+ Assert.AreEqual(location.D50, entity.D50, location.D50.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_WithNaNValues_ReturnsDuneLocationEntityWithNullPropertiesSet()
+ {
+ // Setup
+ var random = new Random(28);
+ int id = random.Next(0, 150);
+ int order = random.Next();
+ var registry = new PersistenceRegistry();
+
+ var location = new DuneLocation(id, string.Empty, new Point2D(double.NaN, double.NaN),
+ new DuneLocation.ConstructionProperties
+ {
+ Offset = double.NaN,
+ Orientation = double.NaN,
+ D50 = double.NaN
+ });
+
+ // Call
+ DuneLocationEntity entity = location.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(id, entity.LocationId);
+ Assert.IsEmpty(entity.Name);
+ Assert.IsNull(entity.LocationX);
+ Assert.IsNull(entity.LocationY);
+ Assert.IsNull(entity.Offset);
+ Assert.IsNull(entity.Orientation);
+ Assert.IsNull(entity.D50);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReferences()
+ {
+ // Setup
+ const string testName = "original name";
+ var location = new DuneLocation(1, testName, new Point2D(0, 0), new DuneLocation.ConstructionProperties());
+ var registry = new PersistenceRegistry();
+
+ // Call
+ DuneLocationEntity entity = location.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreNotSame(testName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(testName, entity.Name);
+ }
+
+ [Test]
+ public void Create_DuneLocationSavedMultipleTimes_ReturnSameEntity()
+ {
+ // Setup
+ var location = new TestDuneLocation();
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ DuneLocationEntity entity1 = location.Create(registry, 0);
+ DuneLocationEntity entity2 = location.Create(registry, 1);
+
+ // Assert
+ Assert.AreSame(entity1, entity2);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,124 @@
+// 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 Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class FailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void AddEntitiesForFailureMechanismSections_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.AddEntitiesForFailureMechanismSections(null, new FailureMechanismEntity());
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void AddEntitiesForFailureMechanismSections_WithoutEntity_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.AddEntitiesForFailureMechanismSections(new PersistenceRegistry(), null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("entity", paramName);
+ }
+
+ [Test]
+ public void AddEntitiesForFailureMechanismSections_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+ var failureMechanismEntity = new FailureMechanismEntity();
+
+ // Call
+ failureMechanism.AddEntitiesForFailureMechanismSections(new PersistenceRegistry(), failureMechanismEntity);
+
+ // Assert
+ CollectionAssert.IsEmpty(failureMechanismEntity.FailureMechanismSectionEntities);
+ }
+
+ [Test]
+ public void AddEntitiesForFailureMechanismSections_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ var failureMechanism = new TestFailureMechanism();
+ FailureMechanismTestHelper.SetSections(failureMechanism, new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ });
+ var failureMechanismEntity = new FailureMechanismEntity();
+
+ // Call
+ failureMechanism.AddEntitiesForFailureMechanismSections(new PersistenceRegistry(), failureMechanismEntity);
+
+ // Assert
+ Assert.AreEqual(1, failureMechanismEntity.FailureMechanismSectionEntities.Count);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ const string failureMechanismSectionsSourcePath = "File\\Path";
+ IFailureMechanism failureMechanism = new TestFailureMechanism("a", "cool");
+ failureMechanism.InputComments.Body = originalInput;
+ failureMechanism.OutputComments.Body = originalOutput;
+ failureMechanism.NotRelevantComments.Body = originalNotRelevantText;
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, failureMechanismSectionsSourcePath);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(FailureMechanismType.DuneErosion, registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.FailureMechanismSectionSourcePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismSectionCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismSectionCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/FailureMechanismSectionCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,95 @@
+// 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.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class FailureMechanismSectionCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ FailureMechanismSection failureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+
+ // Call
+ TestDelegate test = () => failureMechanismSection.Create(null);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_WithCollectorAndGeometry_ReturnsFailureMechanismSectionWithGeometryStringSet()
+ {
+ // Setup
+ const string testName = "testName";
+ var geometryPoints = new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(0, 0)
+ };
+ var failureMechanismSection = new FailureMechanismSection(testName, geometryPoints);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismSectionEntity entity = failureMechanismSection.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(testName, entity.Name);
+ string expectedXml = new Point2DCollectionXmlSerializer().ToXml(geometryPoints);
+ Assert.AreEqual(expectedXml, entity.FailureMechanismSectionPointXml);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string testName = "original name";
+ var geometryPoints = new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(0, 0)
+ };
+ var failureMechanismSection = new FailureMechanismSection(testName, geometryPoints);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismSectionEntity entity = failureMechanismSection.Create(registry);
+
+ // Assert
+ Assert.AreNotSame(testName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(testName, entity.Name);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ForeshoreProfileCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ForeshoreProfileCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/ForeshoreProfileCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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.Linq;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class ForeshoreProfileCreateExtensionsTest
+ {
+ [Test]
+ public void Create_WithoutCollector_ThrowsArgumentNullException()
+ {
+ // Setup
+ var foreshoreProfile = new TestForeshoreProfile();
+
+ // Call
+ TestDelegate test = () => foreshoreProfile.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_WithSimpleProperties_ReturnsForeshoreProfileWithSimplePropertiesSet()
+ {
+ // Setup
+ const string name = "testName";
+ const string id = "fpid";
+ var random = new Random(21);
+ int order = random.Next();
+ double orientation = random.NextDouble();
+ double x0 = random.NextDouble();
+
+ var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0), Enumerable.Empty(), null, new ForeshoreProfile.ConstructionProperties
+ {
+ Id = id,
+ Name = name,
+ Orientation = orientation,
+ X0 = x0
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(order, entity.Order);
+ Assert.AreEqual(id, entity.Id);
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(orientation, entity.Orientation, foreshoreProfile.Orientation.GetAccuracy());
+ Assert.AreEqual(x0, entity.X0);
+ Assert.IsNull(entity.BreakWaterType);
+ Assert.IsNull(entity.BreakWaterHeight);
+ }
+
+ [Test]
+ public void Create_WithNaNProperties_ReturnsForeshoreProfileWithPropertiesSetToNaN()
+ {
+ // Setup
+ var foreshoreProfile = new ForeshoreProfile(
+ new Point2D(0, 0),
+ Enumerable.Empty(),
+ new BreakWater(BreakWaterType.Caisson, double.NaN),
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = "id",
+ Orientation = double.NaN,
+ X0 = double.NaN
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNaN(entity.Orientation);
+ Assert.IsNaN(entity.X0);
+ Assert.IsNaN(entity.BreakWaterHeight);
+ }
+
+ [Test]
+ public void Create_WithGeometry_ReturnsForeshoreProfileWithGeometryStringSet()
+ {
+ // Setup
+ int order = new Random(21).Next();
+ var geometryPoints = new[]
+ {
+ new Point2D(0, 0),
+ new Point2D(0, 0)
+ };
+ var foreshoreProfile = new TestForeshoreProfile(geometryPoints);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ string expectedXml = new Point2DCollectionXmlSerializer().ToXml(geometryPoints);
+ Assert.AreEqual(expectedXml, entity.GeometryXml);
+ }
+
+ [Test]
+ public void Create_WithBreakWater_ReturnsForeshoreProfileWithBreakWaterPropertiesSet()
+ {
+ // Setup
+ double height = new Random(21).NextDouble();
+ const BreakWaterType breakWaterType = BreakWaterType.Caisson;
+ var foreshoreProfile = new TestForeshoreProfile(new BreakWater(breakWaterType, height));
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((int) breakWaterType, entity.BreakWaterType);
+ Assert.AreEqual(height, entity.BreakWaterHeight, foreshoreProfile.BreakWater.Height.GetAccuracy());
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string testName = "original name";
+ const string testId = "test id";
+ var foreshoreProfile = new ForeshoreProfile(new Point2D(0, 0),
+ Enumerable.Empty(),
+ null,
+ new ForeshoreProfile.ConstructionProperties
+ {
+ Id = testId,
+ Name = testName
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ ForeshoreProfileEntity entity = foreshoreProfile.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(testName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(testName, entity.Name);
+ Assert.AreNotSame(testId, entity.Id,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(testId, entity.Id);
+ }
+
+ [Test]
+ public void Create_ForeshoreProfileAlreadyRegistered_ReturnRegisteredEntity()
+ {
+ // Setup
+ var foreshoreProfile = new TestForeshoreProfile();
+ var registry = new PersistenceRegistry();
+
+ ForeshoreProfileEntity entity1 = foreshoreProfile.Create(registry, 0);
+
+ // Precondition:
+ Assert.IsTrue(registry.Contains(foreshoreProfile));
+
+ // Call
+ ForeshoreProfileEntity entity2 = foreshoreProfile.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(entity1, entity2);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeHeightOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeHeightOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeHeightOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.Storage.Core.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class DikeHeightOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_OutputNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((DikeHeightOutput) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithValidParameters_ReturnsGrassCoverErosionInwardsDikeHeightOutputEntityWithOutputSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DikeHeightOutput(
+ random.NextDouble(), random.NextDouble(), random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextEnumValue(), null);
+
+ // Call
+ GrassCoverErosionInwardsDikeHeightOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(output.DikeHeight, entity.DikeHeight, output.DikeHeight.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, entity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, entity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, entity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, entity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+
+ [Test]
+ public void Create_WithNaNParameters_ReturnsGrassCoverErosionInwardsDikeHeightOutputEntityWithOutputNull()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DikeHeightOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(), null);
+
+ // Call
+ GrassCoverErosionInwardsDikeHeightOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.DikeHeight);
+ Assert.IsNull(entity.TargetProbability);
+ Assert.IsNull(entity.TargetReliability);
+ Assert.IsNull(entity.CalculatedProbability);
+ Assert.IsNull(entity.CalculatedReliability);
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+
+ [Test]
+ public void Create_WithGeneralResult_ReturnsGrassCoverErosionInwardsDikeHeightOutputEntityWithGeneralResultEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new DikeHeightOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(),
+ new TestGeneralResultFaultTreeIllustrationPoint());
+
+ // Call
+ GrassCoverErosionInwardsDikeHeightOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,197 @@
+// 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.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class DikeProfileCreateExtensionsTest
+ {
+ [Test]
+ public void Create_RegistryIsNull_ThrowArgumentNullException()
+ {
+ // Setup
+ DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile();
+
+ // Call
+ TestDelegate call = () => dikeProfile.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_WithoutBreakWater_ReturnEntityWithNullBreakWaterProperties()
+ {
+ // Setup
+ int order = new Random(22).Next();
+ var dikeProfile = new DikeProfile(new Point2D(1.1, 2.2),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(3.3, 4.4), 0.75),
+ new RoughnessPoint(new Point2D(5.5, 6.6), 0.75)
+ },
+ new[]
+ {
+ new Point2D(7.7, 8.8),
+ new Point2D(9.9, 10.10)
+ },
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "no_breakwater",
+ Name = "Dike profile without break water.",
+ DikeHeight = 11.11,
+ Orientation = 12.12,
+ X0 = 13.13
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ DikeProfileEntity entity = dikeProfile.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(dikeProfile.WorldReferencePoint.X, entity.X);
+ Assert.AreEqual(dikeProfile.WorldReferencePoint.Y, entity.Y);
+ Assert.AreEqual(dikeProfile.X0, entity.X0);
+ Assert.AreEqual(order, entity.Order);
+ string convertedDikeGeometry = new RoughnessPointCollectionXmlSerializer().ToXml(dikeProfile.DikeGeometry);
+ Assert.AreEqual(convertedDikeGeometry, entity.DikeGeometryXml);
+ string convertedForeshoreGeometry = new Point2DCollectionXmlSerializer().ToXml(dikeProfile.ForeshoreGeometry);
+ Assert.AreEqual(convertedForeshoreGeometry, entity.ForeshoreXml);
+ Assert.AreEqual(dikeProfile.Orientation.Value, entity.Orientation);
+ Assert.AreEqual(dikeProfile.DikeHeight.Value, entity.DikeHeight);
+ Assert.AreEqual(dikeProfile.Id, entity.Id);
+ Assert.AreEqual(dikeProfile.Name, entity.Name);
+
+ Assert.IsNull(entity.BreakWaterHeight);
+ Assert.IsNull(entity.BreakWaterType);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalId = "no_breakwater";
+ const string originalName = "Dike profile without break water.";
+ var dikeProfile = new DikeProfile(new Point2D(1.1, 2.2),
+ new RoughnessPoint[0],
+ new Point2D[0],
+ null,
+ new DikeProfile.ConstructionProperties
+ {
+ Id = originalId,
+ Name = originalName
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ DikeProfileEntity entity = dikeProfile.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(originalName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(originalName, entity.Name);
+ Assert.AreNotSame(originalId, entity.Id,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(originalId, entity.Id);
+ }
+
+ [Test]
+ [TestCase(BreakWaterType.Caisson, 1.1)]
+ [TestCase(BreakWaterType.Dam, 2.2)]
+ [TestCase(BreakWaterType.Wall, -3.3)]
+ public void Create_WithBreakWater_ReturnEntity(BreakWaterType type, double height)
+ {
+ // Setup
+ int order = new Random(42).Next();
+ var dikeProfile = new DikeProfile(new Point2D(1234.4567, 5678.432),
+ new[]
+ {
+ new RoughnessPoint(new Point2D(-6.6, -3.3), 0.75),
+ new RoughnessPoint(new Point2D(4.4, 5.5), 0.75)
+ },
+ new[]
+ {
+ new Point2D(-12.12, -13.13),
+ new Point2D(-6.6, -3.3)
+ },
+ new BreakWater(type, height),
+ new DikeProfile.ConstructionProperties
+ {
+ Id = "no_breakwater",
+ Name = "Dike profile without break water.",
+ DikeHeight = 98.76,
+ Orientation = 76.54,
+ X0 = -12.34
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ DikeProfileEntity entity = dikeProfile.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(dikeProfile.WorldReferencePoint.X, entity.X);
+ Assert.AreEqual(dikeProfile.WorldReferencePoint.Y, entity.Y);
+ Assert.AreEqual(dikeProfile.X0, entity.X0);
+ Assert.AreEqual(order, entity.Order);
+ string convertedDikeGeometry = new RoughnessPointCollectionXmlSerializer().ToXml(dikeProfile.DikeGeometry);
+ Assert.AreEqual(convertedDikeGeometry, entity.DikeGeometryXml);
+ string convertedForeshoreGeometry = new Point2DCollectionXmlSerializer().ToXml(dikeProfile.ForeshoreGeometry);
+ Assert.AreEqual(convertedForeshoreGeometry, entity.ForeshoreXml);
+ Assert.AreEqual(dikeProfile.Orientation.Value, entity.Orientation);
+ Assert.AreEqual(dikeProfile.DikeHeight.Value, entity.DikeHeight);
+ Assert.AreEqual(dikeProfile.Id, entity.Id);
+ Assert.AreEqual(dikeProfile.Name, entity.Name);
+
+ Assert.AreEqual((byte) type, entity.BreakWaterType);
+ Assert.AreEqual(height, entity.BreakWaterHeight);
+ }
+
+ [Test]
+ public void Create_DikeProfileAlreadyRegistered_ReturnRegisteredEntity()
+ {
+ // Setup
+ DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile();
+ var registry = new PersistenceRegistry();
+ DikeProfileEntity entity1 = dikeProfile.Create(registry, 0);
+
+ // Precondition:
+ Assert.IsTrue(registry.Contains(dikeProfile));
+
+ // Call
+ DikeProfileEntity entity2 = dikeProfile.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(entity1, entity2);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsCalculationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsCalculationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,269 @@
+// 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.Linq;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.DikeProfiles;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsCalculationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionInwardsCalculation();
+
+ // Call
+ TestDelegate call = () => calculation.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase("I am comment")]
+ [TestCase(null)]
+ public void Create_ValidCalculation_ReturnEntity(string comment)
+ {
+ // Setup
+ var random = new Random(12);
+ int order = random.Next();
+ const string name = "GrassCoverErosionInwardsCalculation Name";
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = name,
+ Comments =
+ {
+ Body = comment
+ },
+ InputParameters =
+ {
+ DikeProfile = null,
+ HydraulicBoundaryLocation = null,
+ DikeHeight = (RoundedDouble) 1.1,
+ Orientation = (RoundedDouble) 2.2,
+ BreakWater =
+ {
+ Height = (RoundedDouble) 3.3,
+ Type = BreakWaterType.Dam
+ },
+ DikeHeightCalculationType = random.NextEnumValue(),
+ OvertoppingRateCalculationType = random.NextEnumValue(),
+ CriticalFlowRate =
+ {
+ Mean = (RoundedDouble) 4.4,
+ StandardDeviation = (RoundedDouble) 5.5
+ },
+ UseBreakWater = true,
+ UseForeshore = false,
+ ShouldDikeHeightIllustrationPointsBeCalculated = random.NextBoolean(),
+ ShouldOvertoppingOutputIllustrationPointsBeCalculated = random.NextBoolean(),
+ ShouldOvertoppingRateIllustrationPointsBeCalculated = random.NextBoolean()
+ },
+ Output = null
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(name, entity.Name);
+ Assert.AreEqual(comment, entity.Comments);
+ Assert.AreEqual(order, entity.Order);
+
+ Assert.IsNull(entity.DikeProfileEntity);
+ Assert.IsNull(entity.HydraulicLocationEntity);
+
+ GrassCoverErosionInwardsInput input = calculation.InputParameters;
+ Assert.AreEqual(input.BreakWater.Height.Value, entity.BreakWaterHeight);
+ Assert.AreEqual((short) input.BreakWater.Type, entity.BreakWaterType);
+ Assert.AreEqual(Convert.ToByte(input.UseBreakWater), entity.UseBreakWater);
+ Assert.AreEqual(input.CriticalFlowRate.Mean.Value, entity.CriticalFlowRateMean);
+ Assert.AreEqual(input.CriticalFlowRate.StandardDeviation.Value, entity.CriticalFlowRateStandardDeviation);
+ Assert.AreEqual(input.Orientation.Value, entity.Orientation);
+ Assert.AreEqual(Convert.ToByte(input.DikeHeightCalculationType), entity.DikeHeightCalculationType);
+ Assert.AreEqual(Convert.ToByte(input.OvertoppingRateCalculationType), entity.OvertoppingRateCalculationType);
+ Assert.AreEqual(input.DikeHeight.Value, entity.DikeHeight);
+ Assert.AreEqual(Convert.ToByte(input.UseForeshore), entity.UseForeshore);
+
+ Assert.AreEqual(Convert.ToByte(input.ShouldDikeHeightIllustrationPointsBeCalculated),
+ entity.ShouldDikeHeightIllustrationPointsBeCalculated);
+ Assert.AreEqual(Convert.ToByte(input.ShouldOvertoppingOutputIllustrationPointsBeCalculated),
+ entity.ShouldOvertoppingOutputIllustrationPointsBeCalculated);
+ Assert.AreEqual(Convert.ToByte(input.ShouldOvertoppingRateIllustrationPointsBeCalculated),
+ entity.ShouldOvertoppingRateIllustrationPointsBeCalculated);
+
+ Assert.IsFalse(entity.GrassCoverErosionInwardsOutputEntities.Any());
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "A";
+ const string comment = "B";
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Name = name,
+ Comments =
+ {
+ Body = comment
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreNotSame(name, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(name, entity.Name);
+
+ Assert.AreNotSame(comment, entity.Comments,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(comment, entity.Comments);
+ }
+
+ [Test]
+ public void Create_NaNParameters_EntityWithNullFields()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ Orientation = RoundedDouble.NaN,
+ CriticalFlowRate =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ DikeHeight = RoundedDouble.NaN,
+ BreakWater =
+ {
+ Height = RoundedDouble.NaN
+ }
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNull(entity.Orientation);
+ Assert.IsNull(entity.CriticalFlowRateMean);
+ Assert.IsNull(entity.CriticalFlowRateStandardDeviation);
+ Assert.IsNull(entity.DikeHeight);
+ Assert.IsNull(entity.BreakWaterHeight);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadySavedDikeProfile_ReturnEntityWithDikeProfileEntity()
+ {
+ // Setup
+ DikeProfile dikeProfile = DikeProfileTestFactory.CreateDikeProfile();
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ DikeProfile = dikeProfile
+ }
+ };
+
+ var dikeProfileEntity = new DikeProfileEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(dikeProfileEntity, dikeProfile);
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(dikeProfileEntity, entity.DikeProfileEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadySavedHydraulicBoundaryLocation_ReturnEntityWithHydraulicLocationEntity()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 1, 1);
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation
+ }
+ };
+
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithOutput_ReturnEntity()
+ {
+ // Setup
+ var random = new Random(456);
+ var overtoppingOutput = new OvertoppingOutput(random.NextDouble(), false, random.NextDouble(), null);
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, null, null);
+
+ var calculation = new GrassCoverErosionInwardsCalculation
+ {
+ Output = output
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionInwardsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ GrassCoverErosionInwardsOutputEntity outputEntity = entity.GrassCoverErosionInwardsOutputEntities.Single();
+ Assert.AreEqual(overtoppingOutput.WaveHeight, outputEntity.WaveHeight);
+ Assert.AreEqual(overtoppingOutput.Reliability, outputEntity.Reliability);
+ Assert.IsNull(outputEntity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,242 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ GeneralInput =
+ {
+ N = new Random().NextRoundedDouble(1, 20)
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.GrassRevetmentTopErosionAndInwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ Assert.AreEqual(1, entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Count);
+ GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionInwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithoutDikeProfiles_EmptyDikeProfileEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.DikeProfileEntities);
+
+ GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity =
+ entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single();
+ Assert.IsNull(generalInputEntity.DikeProfileCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithDikeProfiles_AddDikeProfileEntities()
+ {
+ // Setup
+ const string filePath = "some/path/to/my/dikeprofiles";
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ failureMechanism.DikeProfiles.AddRange(new[]
+ {
+ DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id1"),
+ DikeProfileTestFactory.CreateDikeProfile(string.Empty, "id2")
+ }, filePath);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.AreEqual(2, entity.DikeProfileEntities.Count);
+
+ GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity =
+ entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single();
+ TestHelper.AssertAreEqualButNotSame(filePath, generalInputEntity.DikeProfileCollectionSourcePath);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
+ {
+ Name = "A"
+ });
+ failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
+ {
+ Name = "B"
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
+ Assert.AreEqual(0, entity.CalculationGroupEntity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
+ .OrderBy(cge => cge.Order)
+ .ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual("A", childGroupEntities[0].Name);
+ Assert.AreEqual(0, childGroupEntities[0].Order);
+ Assert.AreEqual("B", childGroupEntities[1].Name);
+ Assert.AreEqual(1, childGroupEntities[1].Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,137 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GrassCoverErosionInwardsFailureMechanismSectionResult) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistencyRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double tailorMadeAssessmentProbability = random.NextDouble();
+ bool useManualAssembly = random.NextBoolean();
+ double manualAssemblyProbability = random.NextDouble();
+
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ TailorMadeAssessmentProbability = tailorMadeAssessmentProbability,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyProbability = manualAssemblyProbability
+ };
+
+ // Call
+ GrassCoverErosionInwardsSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(tailorMadeAssessmentProbability, entity.TailorMadeAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(manualAssemblyProbability, entity.ManualAssemblyProbability);
+
+ Assert.IsNull(entity.GrassCoverErosionInwardsCalculationEntity);
+ }
+
+ [Test]
+ public void Create_SectionResultWithNaNValues_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ TailorMadeAssessmentProbability = double.NaN,
+ ManualAssemblyProbability = double.NaN
+ };
+
+ // Call
+ GrassCoverErosionInwardsSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNull(entity.TailorMadeAssessmentProbability);
+ Assert.IsNull(entity.ManualAssemblyProbability);
+ }
+
+ [Test]
+ public void Create_CalculationSet_ReturnEntityWithCalculationEntity()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionInwardsCalculation();
+ var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ Calculation = calculation
+ };
+
+ var registry = new PersistenceRegistry();
+ var calculationEntity = new GrassCoverErosionInwardsCalculationEntity();
+ registry.Register(calculationEntity, calculation);
+
+ // Call
+ GrassCoverErosionInwardsSectionResultEntity entity = sectionResult.Create(registry);
+
+ // Assert
+ Assert.AreSame(calculationEntity, entity.GrassCoverErosionInwardsCalculationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,168 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Data.TestUtil;
+using Ringtoets.Storage.Core.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_ValidInput_ReturnGrassCoverErosionInwardsOutputEntity()
+ {
+ // Setup
+ var random = new Random(456);
+ var overtoppingOutput = new OvertoppingOutput(random.NextDouble(), false, random.NextDouble(), null);
+
+ var dikeHeightConvergence = random.NextEnumValue();
+ var overtoppingRateConvergence = random.NextEnumValue();
+
+ var dikeHeightOutput = new DikeHeightOutput(random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), dikeHeightConvergence, null);
+ var overtoppingRateOutput = new OvertoppingRateOutput(random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), overtoppingRateConvergence, null);
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, overtoppingRateOutput);
+
+ // Call
+ GrassCoverErosionInwardsOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.AreEqual(overtoppingOutput.WaveHeight.Value, entity.WaveHeight);
+ Assert.AreEqual(Convert.ToByte(overtoppingOutput.IsOvertoppingDominant), entity.IsOvertoppingDominant);
+ Assert.AreEqual(overtoppingOutput.Reliability, entity.Reliability);
+
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+
+ GrassCoverErosionInwardsDikeHeightOutputEntity dikeHeightEntity = entity.GrassCoverErosionInwardsDikeHeightOutputEntities.First();
+ Assert.AreEqual(dikeHeightOutput.DikeHeight, dikeHeightEntity.DikeHeight, dikeHeightOutput.DikeHeight.GetAccuracy());
+ Assert.AreEqual(dikeHeightOutput.TargetProbability, dikeHeightEntity.TargetProbability);
+ Assert.AreEqual(dikeHeightOutput.TargetReliability, dikeHeightEntity.TargetReliability, dikeHeightOutput.TargetReliability.GetAccuracy());
+ Assert.AreEqual(dikeHeightOutput.CalculatedProbability, dikeHeightEntity.CalculatedProbability);
+ Assert.AreEqual(dikeHeightOutput.CalculatedReliability, dikeHeightEntity.CalculatedReliability, dikeHeightOutput.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual((byte) dikeHeightOutput.CalculationConvergence, dikeHeightEntity.CalculationConvergence);
+
+ GrassCoverErosionInwardsOvertoppingRateOutputEntity overtoppingRateEntity = entity.GrassCoverErosionInwardsOvertoppingRateOutputEntities.First();
+ Assert.AreEqual(overtoppingRateOutput.OvertoppingRate, overtoppingRateEntity.OvertoppingRate, overtoppingRateOutput.OvertoppingRate.GetAccuracy());
+ Assert.AreEqual(overtoppingRateOutput.TargetProbability, overtoppingRateEntity.TargetProbability);
+ Assert.AreEqual(overtoppingRateOutput.TargetReliability, overtoppingRateEntity.TargetReliability, overtoppingRateOutput.TargetReliability.GetAccuracy());
+ Assert.AreEqual(overtoppingRateOutput.CalculatedProbability, overtoppingRateEntity.CalculatedProbability);
+ Assert.AreEqual(overtoppingRateOutput.CalculatedReliability, overtoppingRateEntity.CalculatedReliability, overtoppingRateOutput.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual((byte) overtoppingRateOutput.CalculationConvergence, overtoppingRateEntity.CalculationConvergence);
+ }
+
+ [Test]
+ public void Create_NaNValues_ReturnGrassCoverErosionInwardsOutputEntity()
+ {
+ // Setup
+ var overtoppingOutput = new OvertoppingOutput(double.NaN, true, double.NaN, null);
+ var dikeHeightOutput = new TestDikeHeightOutput(double.NaN, CalculationConvergence.CalculatedConverged);
+ var overtoppingRateOutput = new TestOvertoppingRateOutput(double.NaN, CalculationConvergence.CalculatedConverged);
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, overtoppingRateOutput);
+
+ // Call
+ GrassCoverErosionInwardsOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNull(entity.WaveHeight);
+ Assert.AreEqual(Convert.ToByte(overtoppingOutput.IsOvertoppingDominant), entity.IsOvertoppingDominant);
+ Assert.IsNull(entity.Reliability);
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+
+ GrassCoverErosionInwardsDikeHeightOutputEntity dikeHeightEntity = entity.GrassCoverErosionInwardsDikeHeightOutputEntities.First();
+ Assert.IsNull(dikeHeightEntity.DikeHeight);
+ Assert.IsNull(dikeHeightEntity.TargetProbability);
+ Assert.IsNull(dikeHeightEntity.TargetReliability);
+ Assert.IsNull(dikeHeightEntity.CalculatedProbability);
+ Assert.IsNull(dikeHeightEntity.CalculatedReliability);
+ Assert.AreEqual((byte) dikeHeightOutput.CalculationConvergence, dikeHeightEntity.CalculationConvergence);
+
+ GrassCoverErosionInwardsOvertoppingRateOutputEntity overtoppingRateEntity = entity.GrassCoverErosionInwardsOvertoppingRateOutputEntities.First();
+ Assert.IsNull(overtoppingRateEntity.OvertoppingRate);
+ Assert.IsNull(overtoppingRateEntity.TargetProbability);
+ Assert.IsNull(overtoppingRateEntity.TargetReliability);
+ Assert.IsNull(overtoppingRateEntity.CalculatedProbability);
+ Assert.IsNull(overtoppingRateEntity.CalculatedReliability);
+ Assert.AreEqual((byte) overtoppingRateOutput.CalculationConvergence, overtoppingRateEntity.CalculationConvergence);
+ }
+
+ [Test]
+ public void Create_DikeHeightOutputIsNull_NoDikeHeightOutputEntityCreated()
+ {
+ // Setup
+ var overtoppingOutput = new TestOvertoppingOutput(1);
+ var overtoppingRateOutput = new TestOvertoppingRateOutput(double.NaN, CalculationConvergence.CalculatedConverged);
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, null, overtoppingRateOutput);
+
+ // Call
+ GrassCoverErosionInwardsOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsFalse(entity.GrassCoverErosionInwardsDikeHeightOutputEntities.Any());
+ }
+
+ [Test]
+ public void Create_OvertoppingRateOutputIsNull_NoOvertoppingRateOutputEntityCreated()
+ {
+ // Setup
+ var overtoppingOutput = new TestOvertoppingOutput(1);
+ var dikeHeightOutput = new TestDikeHeightOutput(double.NaN, CalculationConvergence.CalculatedConverged);
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, dikeHeightOutput, null);
+
+ // Call
+ GrassCoverErosionInwardsOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsFalse(entity.GrassCoverErosionInwardsOvertoppingRateOutputEntities.Any());
+ }
+
+ [Test]
+ public void Create_WithGeneralResult_ReturnsGrassCoverErosionInwardsOutputEntityWithGeneralResultEntity()
+ {
+ // Setup
+ var overtoppingOutput = new OvertoppingOutput(double.NaN,
+ true,
+ double.NaN,
+ new TestGeneralResultFaultTreeIllustrationPoint());
+
+ var output = new GrassCoverErosionInwardsOutput(overtoppingOutput, null, null);
+
+ // Call
+ GrassCoverErosionInwardsOutputEntity entity = output.Create();
+
+ // Assert
+ GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.OvertoppingOutput.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/OvertoppingRateOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/OvertoppingRateOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionInwards/OvertoppingRateOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.Storage.Core.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.GrassCoverErosionInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionInwards
+{
+ [TestFixture]
+ public class OvertoppingRateOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_OutputNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((OvertoppingRateOutput) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithValidParameters_ReturnsGrassCoverErosionInwardsOvertoppingRateOutputEntityWithOutputSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new OvertoppingRateOutput(
+ random.NextDouble(), random.NextDouble(), random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextEnumValue(), null);
+
+ // Call
+ GrassCoverErosionInwardsOvertoppingRateOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(output.OvertoppingRate, entity.OvertoppingRate, output.OvertoppingRate.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, entity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, entity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, entity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, entity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+
+ [Test]
+ public void Create_WithNaNParameters_ReturnsGrassCoverErosionInwardsOvertoppingRateOutputEntityWithOutputNull()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new OvertoppingRateOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(), null);
+
+ // Call
+ GrassCoverErosionInwardsOvertoppingRateOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.OvertoppingRate);
+ Assert.IsNull(entity.TargetProbability);
+ Assert.IsNull(entity.TargetReliability);
+ Assert.IsNull(entity.CalculatedProbability);
+ Assert.IsNull(entity.CalculatedReliability);
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+ Assert.IsNull(entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+
+ [Test]
+ public void Create_WithGeneralResult_ReturnsGrassCoverErosionInwardsDikeHeightOutputEntityWithGeneralResultEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new OvertoppingRateOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(),
+ new TestGeneralResultFaultTreeIllustrationPoint());
+
+ // Call
+ GrassCoverErosionInwardsOvertoppingRateOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ GeneralResultEntityTestHelper.AssertGeneralResultPropertyValues(output.GeneralResult, entity.GeneralResultFaultTreeIllustrationPointEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,352 @@
+// 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 Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ GeneralInput =
+ {
+ N = new Random(39).NextRoundedDouble(1, 20)
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.GrassRevetmentErosionOutwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ Assert.AreEqual(1, entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Count);
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ const string filePath = "failureMechanismSections/file/path";
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionOutwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.FailureMechanismSectionSourcePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithoutForeshoreProfiles_EmptyForeshoreProfilesEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.ForeshoreProfileEntities);
+
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity =
+ entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single();
+ Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithForeshoreProfiles_ForeshoreProfilesEntitiesCreated()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ const string filePath = "some/path/to/foreshoreProfiles";
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ new TestForeshoreProfile()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count);
+
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity =
+ entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single();
+ string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath);
+ }
+
+ [Test]
+ [TestCase(true, TestName = "Create_WithCalculationGroup_ReturnFMEntityWithCalculationGroupEntities(true)")]
+ [TestCase(false, TestName = "Create_WithCalculationGroup_ReturnFMEntityWithCalculationGroupEntities(false)")]
+ public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup
+ {
+ Name = "A"
+ });
+ failureMechanism.WaveConditionsCalculationGroup.Children.Add(new CalculationGroup
+ {
+ Name = "B"
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(failureMechanism.WaveConditionsCalculationGroup.Name, entity.CalculationGroupEntity.Name);
+ Assert.AreEqual(0, entity.CalculationGroupEntity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
+ .OrderBy(cge => cge.Order)
+ .ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ Assert.AreEqual("A", childGroupEntities[0].Name);
+ Assert.AreEqual(0, childGroupEntities[0].Order);
+ Assert.AreEqual("B", childGroupEntities[1].Name);
+ Assert.AreEqual(1, childGroupEntities[1].Order);
+ }
+
+ [Test]
+ public void Create_WithoutHydraulicBoundaryLocationCalculations_ReturnsFailureMechanismWithoutHydraulicLocationCalculationEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity =
+ entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single();
+
+ AssertHydraulicLocationCalculationCollectionEntities(failureMechanism, registry, metaEntity);
+ }
+
+ [Test]
+ public void Create_WithHydraulicBoundaryLocationCalculations_ReturnsFailureMechanismWithHydraulicLocationCalculationEntities()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "A", 0, 0);
+ var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism();
+ failureMechanism.SetHydraulicBoundaryLocationCalculations(new[]
+ {
+ hydraulicBoundaryLocation
+ });
+ SetHydraulicBoundaryLocationCalculationInputsOfFailureMechanism(failureMechanism);
+
+ var registry = new PersistenceRegistry();
+ registry.Register(new HydraulicLocationEntity(), hydraulicBoundaryLocation);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity =
+ entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single();
+
+ AssertHydraulicLocationCalculationCollectionEntities(failureMechanism, registry, metaEntity);
+ }
+
+ private static void AssertHydraulicLocationCalculationCollectionEntities(GrassCoverErosionOutwardsFailureMechanism expectedFailureMechanism,
+ PersistenceRegistry registry,
+ GrassCoverErosionOutwardsFailureMechanismMetaEntity actualEntity)
+ {
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity);
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity1);
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity2);
+
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity3);
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity4);
+ AssertHydraulicLocationCalculationCollectionEntity(expectedFailureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm,
+ registry,
+ actualEntity.HydraulicLocationCalculationCollectionEntity5);
+ }
+
+ private static void SetHydraulicBoundaryLocationCalculationInputsOfFailureMechanism(GrassCoverErosionOutwardsFailureMechanism failureMechanism)
+ {
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaterLevelCalculationsForMechanismSpecificFactorizedSignalingNorm, 1);
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaterLevelCalculationsForMechanismSpecificSignalingNorm, 2);
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaterLevelCalculationsForMechanismSpecificLowerLimitNorm, 3);
+
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaveHeightCalculationsForMechanismSpecificFactorizedSignalingNorm, 4);
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaveHeightCalculationsForMechanismSpecificSignalingNorm, 5);
+ SetHydraulicBoundaryLocationCalculationInputs(failureMechanism.WaveHeightCalculationsForMechanismSpecificLowerLimitNorm, 6);
+ }
+
+ private static void SetHydraulicBoundaryLocationCalculationInputs(IEnumerable calculations,
+ int seed)
+ {
+ var random = new Random(seed);
+ foreach (HydraulicBoundaryLocationCalculation calculation in calculations)
+ {
+ calculation.InputParameters.ShouldIllustrationPointsBeCalculated = random.NextBoolean();
+ }
+ }
+
+ private static void AssertHydraulicLocationCalculationCollectionEntity(IEnumerable expectedCalculations,
+ PersistenceRegistry registry,
+ HydraulicLocationCalculationCollectionEntity actualCollectionEntity)
+ {
+ Assert.IsNotNull(actualCollectionEntity);
+
+ HydraulicBoundaryLocationCalculation[] expectedCalculationsArray = expectedCalculations.ToArray();
+ ICollection hydraulicLocationCalculationEntities = actualCollectionEntity.HydraulicLocationCalculationEntities;
+ Assert.AreEqual(expectedCalculationsArray.Length, hydraulicLocationCalculationEntities.Count);
+
+ var i = 0;
+ foreach (HydraulicLocationCalculationEntity actualCalculationEntity in hydraulicLocationCalculationEntities)
+ {
+ HydraulicBoundaryLocationCalculation expectedCalculation = expectedCalculationsArray[i];
+ HydraulicBoundaryLocation expectedLocation = expectedCalculation.HydraulicBoundaryLocation;
+ Assert.AreSame(registry.Get(expectedLocation), actualCalculationEntity.HydraulicLocationEntity);
+
+ Assert.AreEqual(Convert.ToByte(expectedCalculation.InputParameters.ShouldIllustrationPointsBeCalculated),
+ actualCalculationEntity.ShouldIllustrationPointsBeCalculated);
+ i++;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.AssemblyTool.Data;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Riskeer.Storage.Core.Create.GrassCoverErosionOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GrassCoverErosionOutwardsFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResultForFactorizedSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForSignalingNorm = random.NextEnumValue();
+ var detailedAssessmentResultForMechanismSpecificLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForLowerLimitNorm = random.NextEnumValue();
+ var detailedAssessmentResultForFactorizedLowerLimitNorm = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue();
+
+ var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResultForFactorizedSignalingNorm = detailedAssessmentResultForFactorizedSignalingNorm,
+ DetailedAssessmentResultForSignalingNorm = detailedAssessmentResultForSignalingNorm,
+ DetailedAssessmentResultForMechanismSpecificLowerLimitNorm = detailedAssessmentResultForMechanismSpecificLowerLimitNorm,
+ DetailedAssessmentResultForLowerLimitNorm = detailedAssessmentResultForLowerLimitNorm,
+ DetailedAssessmentResultForFactorizedLowerLimitNorm = detailedAssessmentResultForFactorizedLowerLimitNorm,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyCategoryGroup = manualAssemblyCategoryGroup
+ };
+
+ // Call
+ GrassCoverErosionOutwardsSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForFactorizedSignalingNorm), entity.DetailedAssessmentResultForFactorizedSignalingNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForSignalingNorm), entity.DetailedAssessmentResultForSignalingNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForMechanismSpecificLowerLimitNorm), entity.DetailedAssessmentResultForMechanismSpecificLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForLowerLimitNorm), entity.DetailedAssessmentResultForLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResultForFactorizedLowerLimitNorm), entity.DetailedAssessmentResultForFactorizedLowerLimitNorm);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(Convert.ToByte(manualAssemblyCategoryGroup), entity.ManualAssemblyCategoryGroup);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,238 @@
+// 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.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.GrassCoverErosionOutwards.Data;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Data.TestUtil;
+using Ringtoets.Storage.Core.TestUtil.Hydraulics;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverErosionOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsWaveConditionsCalculationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GrassCoverErosionOutwardsWaveConditionsCalculation) null).Create(new PersistenceRegistry(), 0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculation", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowArgumentNullException()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation();
+
+ // Call
+ TestDelegate call = () => calculation.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual(paramName, "registry");
+ }
+
+ [Test]
+ public void Create_CalculationWithPropertiesSet_ReturnCalculationEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ int order = random.Next();
+
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ Orientation = random.NextRoundedDouble(0, 360),
+ UseBreakWater = random.NextBoolean(),
+ UseForeshore = random.NextBoolean(),
+ UpperBoundaryRevetment = (RoundedDouble) 6.10,
+ LowerBoundaryRevetment = (RoundedDouble) 3.58,
+ UpperBoundaryWaterLevels = (RoundedDouble) 5.88,
+ LowerBoundaryWaterLevels = (RoundedDouble) 3.40,
+ StepSize = random.NextEnumValue(),
+ CategoryType = random.NextEnumValue()
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, order);
+
+ // Assert
+ FailureMechanismCategoryWaveConditionsInput input = calculation.InputParameters;
+ Assert.AreEqual(input.Orientation, entity.Orientation, input.Orientation.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(input.UseBreakWater), entity.UseBreakWater);
+ Assert.AreEqual(Convert.ToByte(input.UseForeshore), entity.UseForeshore);
+ Assert.AreEqual(input.UpperBoundaryRevetment, entity.UpperBoundaryRevetment, input.UpperBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(input.LowerBoundaryRevetment, entity.LowerBoundaryRevetment, input.LowerBoundaryRevetment.GetAccuracy());
+ Assert.AreEqual(input.UpperBoundaryWaterLevels, entity.UpperBoundaryWaterLevels, input.UpperBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(input.LowerBoundaryWaterLevels, entity.LowerBoundaryWaterLevels, input.LowerBoundaryWaterLevels.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(input.StepSize), entity.StepSize);
+ Assert.AreEqual(Convert.ToByte(input.CategoryType), entity.CategoryType);
+
+ Assert.AreEqual(order, entity.Order);
+ Assert.IsNull(entity.CalculationGroupEntity);
+ CollectionAssert.IsEmpty(entity.GrassCoverErosionOutwardsWaveConditionsOutputEntities);
+ Assert.IsNull(entity.ForeshoreProfileEntity);
+ Assert.IsNull(entity.HydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithNaNProperties_ReturnCalculationEntity()
+ {
+ // Setup
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ Orientation = RoundedDouble.NaN,
+ UpperBoundaryRevetment = RoundedDouble.NaN,
+ LowerBoundaryRevetment = RoundedDouble.NaN,
+ UpperBoundaryWaterLevels = RoundedDouble.NaN,
+ LowerBoundaryWaterLevels = RoundedDouble.NaN,
+ BreakWater =
+ {
+ Height = RoundedDouble.NaN
+ }
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 1234);
+
+ // Assert
+ Assert.IsNull(entity.Orientation);
+ Assert.IsNull(entity.UpperBoundaryRevetment);
+ Assert.IsNull(entity.LowerBoundaryRevetment);
+ Assert.IsNull(entity.UpperBoundaryWaterLevels);
+ Assert.IsNull(entity.LowerBoundaryWaterLevels);
+ Assert.IsNull(entity.BreakWaterHeight);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "A";
+ const string comments = "B";
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Name = name,
+ Comments =
+ {
+ Body = comments
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(calculation.Name, entity.Name);
+ TestHelper.AssertAreEqualButNotSame(calculation.Comments.Body, entity.Comments);
+ }
+
+ [Test]
+ public void Create_GrassCoverErosionOutwardsHydraulicLocationEntity_EntityHasGrassCoverErosionOutwardsHydraulicLocationEntity()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 2.3, 4.5);
+
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation
+ }
+ };
+
+ HydraulicLocationEntity hydraulicLocationEntity = HydraulicLocationEntityTestFactory.CreateHydraulicLocationEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_HasForeshoreProfile_EntityHasForeshoreProfileEntity()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ InputParameters =
+ {
+ ForeshoreProfile = new TestForeshoreProfile()
+ }
+ };
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity.ForeshoreProfileEntity);
+ }
+
+ [Test]
+ public void Create_HasCalculationOutput_EntityHasCalculationOutputEntity()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation
+ {
+ Output = new GrassCoverErosionOutwardsWaveConditionsOutput(new[]
+ {
+ new TestWaveConditionsOutput()
+ })
+ };
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsCalculationEntity entity = calculation.Create(registry, 0);
+
+ // Assert
+ Assert.AreEqual(1, entity.GrassCoverErosionOutwardsWaveConditionsOutputEntities.Count);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsWaveConditionsOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,84 @@
+// 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.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Revetment.Data;
+using Ringtoets.Revetment.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverErosionOutwards
+{
+ [TestFixture]
+ public class GrassCoverErosionOutwardsWaveConditionsOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_AllOutputValuesSet_ReturnEntity()
+ {
+ // Setup
+ var output = new TestWaveConditionsOutput();
+ const int order = 22;
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsOutputEntity entity = output.CreateGrassCoverErosionOutwardsWaveConditionsOutputEntity(order);
+
+ // Assert
+ Assert.AreEqual(output.WaterLevel, entity.WaterLevel, output.WaterLevel.GetAccuracy());
+ Assert.AreEqual(output.WaveHeight, entity.WaveHeight, output.WaveHeight.GetAccuracy());
+ Assert.AreEqual(output.WavePeakPeriod, entity.WavePeakPeriod, output.WavePeakPeriod.GetAccuracy());
+ Assert.AreEqual(output.WaveAngle, entity.WaveAngle, output.WaveAngle.GetAccuracy());
+ Assert.AreEqual(output.WaveDirection, entity.WaveDirection, output.WaveDirection.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, entity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, entity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, entity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, entity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculationConvergence, (CalculationConvergence) entity.CalculationConvergence);
+
+ Assert.IsNull(entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntity);
+ }
+
+ [Test]
+ public void Create_AllOutputValuesNaN_ReturnEntityWithNullValues()
+ {
+ // Setup
+ var output = new WaveConditionsOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, double.NaN, CalculationConvergence.NotCalculated);
+
+ // Call
+ GrassCoverErosionOutwardsWaveConditionsOutputEntity entity = output.CreateGrassCoverErosionOutwardsWaveConditionsOutputEntity(1);
+
+ // Assert
+ Assert.IsNull(entity.WaterLevel);
+ Assert.IsNull(entity.WaveHeight);
+ Assert.IsNull(entity.WavePeakPeriod);
+ Assert.IsNull(entity.WaveAngle);
+ Assert.IsNull(entity.WaveDirection);
+ Assert.IsNull(entity.TargetProbability);
+ Assert.IsNull(entity.TargetReliability);
+ Assert.IsNull(entity.CalculatedProbability);
+ Assert.IsNull(entity.CalculatedReliability);
+
+ Assert.IsNull(entity.GrassCoverErosionOutwardsWaveConditionsCalculationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,154 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverSlipOffInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverSlipOffInwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.GrassRevetmentSlidingInwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffInwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,78 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Riskeer.Storage.Core.Create.GrassCoverSlipOffInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverSlipOffInwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GrassCoverSlipOffInwardsFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue();
+
+ var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyCategoryGroup = manualAssemblyCategoryGroup
+ };
+
+ // Call
+ GrassCoverSlipOffInwardsSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(Convert.ToByte(manualAssemblyCategoryGroup), entity.ManualAssemblyCategoryGroup);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,154 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.GrassCoverSlipOffOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverSlipOffOutwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.GrassRevetmentSlidingOutwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(failureMechanism.FailureMechanismSectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffOutwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,78 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Riskeer.Storage.Core.Create.GrassCoverSlipOffOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.GrassCoverSlipOffOutwards
+{
+ [TestFixture]
+ public class GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GrassCoverSlipOffOutwardsFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue();
+
+ var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyCategoryGroup = manualAssemblyCategoryGroup
+ };
+
+ // Call
+ GrassCoverSlipOffOutwardsSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(Convert.ToByte(manualAssemblyCategoryGroup), entity.ManualAssemblyCategoryGroup);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructureCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructureCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructureCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,172 @@
+// 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.Base.Data;
+using Core.Common.Base.Geometry;
+using NUnit.Framework;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.HeightStructures.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.HeightStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.HeightStructures
+{
+ [TestFixture]
+ public class HeightStructureCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowArgumentNullException()
+ {
+ // Setup
+ HeightStructure structure = new TestHeightStructure();
+
+ // Call
+ TestDelegate call = () => structure.Create(null, 0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_ValidStructure_ReturnEntity()
+ {
+ // Setup
+ HeightStructure structure = new TestHeightStructure();
+ var registry = new PersistenceRegistry();
+
+ const int order = 4;
+
+ // Call
+ HeightStructureEntity entity = structure.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(structure.Name, entity.Name);
+ Assert.AreNotSame(structure.Name, entity.Name);
+ Assert.AreEqual(structure.Id, entity.Id);
+ Assert.AreNotSame(structure.Id, entity.Id);
+ Assert.AreEqual(structure.Location.X, entity.X);
+ Assert.AreEqual(structure.Location.Y, entity.Y);
+ Assert.AreEqual(structure.StructureNormalOrientation.Value, entity.StructureNormalOrientation);
+ Assert.AreEqual(structure.AllowedLevelIncreaseStorage.Mean.Value, entity.AllowedLevelIncreaseStorageMean);
+ Assert.AreEqual(structure.AllowedLevelIncreaseStorage.StandardDeviation.Value, entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.AreEqual(structure.CriticalOvertoppingDischarge.Mean.Value, entity.CriticalOvertoppingDischargeMean);
+ Assert.AreEqual(structure.CriticalOvertoppingDischarge.CoefficientOfVariation.Value, entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.AreEqual(structure.FailureProbabilityStructureWithErosion, entity.FailureProbabilityStructureWithErosion);
+ Assert.AreEqual(structure.FlowWidthAtBottomProtection.Mean.Value, entity.FlowWidthAtBottomProtectionMean);
+ Assert.AreEqual(structure.FlowWidthAtBottomProtection.StandardDeviation.Value, entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.AreEqual(structure.LevelCrestStructure.Mean.Value, entity.LevelCrestStructureMean);
+ Assert.AreEqual(structure.LevelCrestStructure.StandardDeviation.Value, entity.LevelCrestStructureStandardDeviation);
+ Assert.AreEqual(structure.StorageStructureArea.Mean.Value, entity.StorageStructureAreaMean);
+ Assert.AreEqual(structure.StorageStructureArea.CoefficientOfVariation.Value, entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.AreEqual(structure.WidthFlowApertures.Mean.Value, entity.WidthFlowAperturesMean);
+ Assert.AreEqual(structure.WidthFlowApertures.StandardDeviation.Value, entity.WidthFlowAperturesStandardDeviation);
+ Assert.AreEqual(order, entity.Order);
+
+ Assert.IsTrue(registry.Contains(structure));
+ }
+
+ [Test]
+ public void Create_NaNValue_ReturnEntityWithNullValue()
+ {
+ // Setup
+ var structure = new HeightStructure(new HeightStructure.ConstructionProperties
+ {
+ Name = "A",
+ Id = "B",
+ Location = new Point2D(double.NaN, double.NaN),
+ StructureNormalOrientation = RoundedDouble.NaN,
+ AllowedLevelIncreaseStorage =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ CriticalOvertoppingDischarge =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ FailureProbabilityStructureWithErosion = double.NaN,
+ FlowWidthAtBottomProtection =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ LevelCrestStructure =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ },
+ StorageStructureArea =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ WidthFlowApertures =
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN
+ }
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ HeightStructureEntity entity = structure.Create(registry, 0);
+
+ // Assert
+ Assert.IsNull(entity.X);
+ Assert.IsNull(entity.Y);
+ Assert.IsNull(entity.StructureNormalOrientation);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageMean);
+ Assert.IsNull(entity.AllowedLevelIncreaseStorageStandardDeviation);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeMean);
+ Assert.IsNull(entity.CriticalOvertoppingDischargeCoefficientOfVariation);
+ Assert.IsNull(entity.FailureProbabilityStructureWithErosion);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionMean);
+ Assert.IsNull(entity.FlowWidthAtBottomProtectionStandardDeviation);
+ Assert.IsNull(entity.LevelCrestStructureMean);
+ Assert.IsNull(entity.LevelCrestStructureStandardDeviation);
+ Assert.IsNull(entity.StorageStructureAreaMean);
+ Assert.IsNull(entity.StorageStructureAreaCoefficientOfVariation);
+ Assert.IsNull(entity.WidthFlowAperturesMean);
+ Assert.IsNull(entity.WidthFlowAperturesStandardDeviation);
+ }
+
+ [Test]
+ public void Create_StructureAlreadyRegistered_ReturnRegisteredEntity()
+ {
+ // Setup
+ var structure = new TestHeightStructure();
+
+ var registeredEntity = new HeightStructureEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(registeredEntity, structure);
+
+ // Call
+ HeightStructureEntity entity = structure.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(registeredEntity, entity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,277 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.HeightStructures.Data;
+using Ringtoets.HeightStructures.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.HeightStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.HeightStructures
+{
+ [TestFixture]
+ public class HeightStructuresFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ GeneralInput =
+ {
+ N = new Random().NextRoundedDouble(1, 20)
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.StructureHeight, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ HeightStructuresFailureMechanismMetaEntity metaEntity = entity.HeightStructuresFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N);
+ Assert.AreEqual(failureMechanism.HeightStructures.SourcePath, metaEntity.HeightStructureCollectionSourcePath);
+ Assert.AreEqual(failureMechanism.ForeshoreProfiles.SourcePath, metaEntity.ForeshoreProfileCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.HeightStructuresSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.FailureMechanismSectionSourcePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithForeshoreProfiles_ForeshoreProfileEntitiesCreated()
+ {
+ // Setup
+ var profile = new TestForeshoreProfile();
+
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ const string filePath = "some/path/to/foreshoreProfiles";
+ failureMechanism.ForeshoreProfiles.AddRange(new[]
+ {
+ profile
+ }, filePath);
+
+ var persistenceRegistry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(persistenceRegistry);
+
+ // Assert
+ Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count);
+ Assert.IsTrue(persistenceRegistry.Contains(profile));
+
+ HeightStructuresFailureMechanismMetaEntity metaEntity =
+ entity.HeightStructuresFailureMechanismMetaEntities.Single();
+ string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithoutHeightStructures_EmptyHeightStructureEntities()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+
+ var persistenceRegistry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(persistenceRegistry);
+
+ // Assert
+ Assert.AreEqual(0, entity.HeightStructureEntities.Count);
+
+ HeightStructuresFailureMechanismMetaEntity metaEntity =
+ entity.HeightStructuresFailureMechanismMetaEntities.Single();
+ Assert.IsNull(metaEntity.HeightStructureCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithHeightStructures_HeightStructureEntitiesCreated()
+ {
+ // Setup
+ HeightStructure structure = new TestHeightStructure();
+
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ const string filePath = "some/path/to/structures";
+ failureMechanism.HeightStructures.AddRange(new[]
+ {
+ structure
+ }, filePath);
+
+ var persistenceRegistry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(persistenceRegistry);
+
+ // Assert
+ Assert.AreEqual(1, entity.HeightStructureEntities.Count);
+ Assert.IsTrue(persistenceRegistry.Contains(structure));
+
+ HeightStructuresFailureMechanismMetaEntity metaEntity =
+ entity.HeightStructuresFailureMechanismMetaEntities.Single();
+ string metaEntityHeightStructureCollectionSourcePath = metaEntity.HeightStructureCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(filePath, metaEntityHeightStructureCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities()
+ {
+ // Setup
+ var failureMechanism = new HeightStructuresFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
+ {
+ Name = "A"
+ });
+ failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup
+ {
+ Name = "B"
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
+ Assert.AreEqual(0, entity.CalculationGroupEntity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
+ .OrderBy(cge => cge.Order)
+ .ToArray();
+ Assert.AreEqual(2, childGroupEntities.Length);
+ CalculationGroupEntity childGroupEntity1 = childGroupEntities[0];
+ Assert.AreEqual("A", childGroupEntity1.Name);
+ Assert.AreEqual(0, childGroupEntity1.Order);
+ CalculationGroupEntity childGroupEntity2 = childGroupEntities[1];
+ Assert.AreEqual("B", childGroupEntity2.Name);
+ Assert.AreEqual(1, childGroupEntity2.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,137 @@
+// 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 Ringtoets.Common.Data.Structures;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.HeightStructures.Data;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.HeightStructures;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.HeightStructures
+{
+ [TestFixture]
+ public class HeightStructuresFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_FailureMechanismSectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => HeightStructuresFailureMechanismSectionResultCreateExtensions.Create(null, new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection());
+
+ // Call
+ TestDelegate test = () => sectionResult.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double tailorMadeAssessmentProbability = random.NextDouble();
+ bool useManualAssembly = random.NextBoolean();
+ double manualAssemblyProbability = random.NextDouble();
+
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ TailorMadeAssessmentProbability = tailorMadeAssessmentProbability,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyProbability = manualAssemblyProbability
+ };
+
+ // Call
+ HeightStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(tailorMadeAssessmentProbability, entity.TailorMadeAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(manualAssemblyProbability, entity.ManualAssemblyProbability);
+ Assert.IsNull(entity.HeightStructuresCalculationEntityId);
+ }
+
+ [Test]
+ public void Create_SectionResultWithNaNValues_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ TailorMadeAssessmentProbability = double.NaN,
+ ManualAssemblyProbability = double.NaN
+ };
+
+ // Call
+ HeightStructuresSectionResultEntity entity = sectionResult.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNull(entity.TailorMadeAssessmentProbability);
+ Assert.IsNull(entity.ManualAssemblyProbability);
+ }
+
+ [Test]
+ public void Create_CalculationSet_ReturnEntityWithCalculationEntity()
+ {
+ // Setup
+ var calculation = new StructuresCalculation();
+ var sectionResult = new HeightStructuresFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ Calculation = calculation
+ };
+
+ var registry = new PersistenceRegistry();
+ var calculationEntity = new HeightStructuresCalculationEntity();
+ registry.Register(calculationEntity, calculation);
+
+ // Call
+ HeightStructuresSectionResultEntity entity = sectionResult.Create(registry);
+
+ // Assert
+ Assert.AreSame(calculationEntity, entity.HeightStructuresCalculationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCollectionCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCollectionCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCollectionCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,102 @@
+// 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.Base;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationCollectionCreateExtensionsTest
+ {
+ [Test]
+ public void Create_CalculationsNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () =>
+ ((IEnumerable) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculations", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ IEnumerable calculations =
+ Enumerable.Empty();
+
+ // Call
+ TestDelegate call = () => calculations.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithValidCollection_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ var calculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
+ {
+ InputParameters =
+ {
+ ShouldIllustrationPointsBeCalculated = random.NextBoolean()
+ }
+ };
+
+ var calculationCollection = new ObservableList
+ {
+ calculation
+ };
+
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ var registry = new PersistenceRegistry();
+ registry.Register(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ HydraulicLocationCalculationCollectionEntity entity = calculationCollection.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+
+ HydraulicLocationCalculationEntity hydraulicLocationCalculationEntity = entity.HydraulicLocationCalculationEntities.Single();
+ Assert.AreSame(hydraulicLocationEntity, hydraulicLocationCalculationEntity.HydraulicLocationEntity);
+ Assert.AreEqual(Convert.ToByte(calculation.InputParameters.ShouldIllustrationPointsBeCalculated),
+ hydraulicLocationCalculationEntity.ShouldIllustrationPointsBeCalculated);
+ CollectionAssert.IsEmpty(hydraulicLocationCalculationEntity.HydraulicLocationOutputEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,153 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_RegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var calculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation());
+
+ // Call
+ TestDelegate call = () => calculation.Create(null);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_CalculationNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((HydraulicBoundaryLocationCalculation) null).Create(new PersistenceRegistry());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("calculation", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_CalculationWithoutOutput_ReturnsHydraulicLocationCalculationEntity()
+ {
+ // Setup
+ var random = new Random(33);
+ bool shouldIllustrationPointsBeCalculated = random.NextBoolean();
+
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ var calculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
+ {
+ InputParameters =
+ {
+ ShouldIllustrationPointsBeCalculated = shouldIllustrationPointsBeCalculated
+ },
+ Output = null
+ };
+
+ var registry = new PersistenceRegistry();
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ registry.Register(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ HydraulicLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(Convert.ToByte(shouldIllustrationPointsBeCalculated), entity.ShouldIllustrationPointsBeCalculated);
+ Assert.IsEmpty(entity.HydraulicLocationOutputEntities);
+ }
+
+ [Test]
+ public void Create_CalculationWithOutput_ReturnsHydraulicLocationCalculationEntityWithOutput()
+ {
+ // Setup
+ var random = new Random(33);
+ bool shouldIllustrationPointsBeCalculated = random.NextBoolean();
+
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ var calculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation)
+ {
+ InputParameters =
+ {
+ ShouldIllustrationPointsBeCalculated = shouldIllustrationPointsBeCalculated
+ },
+ Output = new HydraulicBoundaryLocationCalculationOutput(
+ random.NextDouble(), random.NextDouble(), random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextEnumValue(),
+ null)
+ };
+
+ var registry = new PersistenceRegistry();
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ registry.Register(hydraulicLocationEntity, hydraulicBoundaryLocation);
+
+ // Call
+ HydraulicLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(Convert.ToByte(shouldIllustrationPointsBeCalculated), entity.ShouldIllustrationPointsBeCalculated);
+
+ HydraulicLocationOutputEntity outputEntity = entity.HydraulicLocationOutputEntities.Single();
+
+ HydraulicBoundaryLocationCalculationOutput expectedOutput = calculation.Output;
+ Assert.AreEqual(expectedOutput.CalculatedProbability, outputEntity.CalculatedProbability);
+ Assert.AreEqual(expectedOutput.CalculatedReliability, outputEntity.CalculatedReliability);
+ Assert.AreEqual(expectedOutput.TargetReliability, outputEntity.TargetReliability);
+ Assert.AreEqual(expectedOutput.TargetProbability, outputEntity.TargetProbability);
+ Assert.IsNull(outputEntity.GeneralResultSubMechanismIllustrationPointEntity);
+ Assert.AreEqual(Convert.ToByte(expectedOutput.CalculationConvergence), outputEntity.CalculationConvergence);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadyCreatedHydraulicBoundaryLocation_ReturnsEntityWithHydraulicBoundaryLocationEntity()
+ {
+ // Setup
+ var hydraulicLocation = new TestHydraulicBoundaryLocation();
+
+ var registry = new PersistenceRegistry();
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ registry.Register(hydraulicLocationEntity, hydraulicLocation);
+
+ var calculation = new HydraulicBoundaryLocationCalculation(hydraulicLocation);
+
+ // Call
+ HydraulicLocationCalculationEntity entity = calculation.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCalculationOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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;
+using System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCalculationOutputCreateExtensionsTest
+ {
+ [Test]
+ public void CreateHydraulicLocationOutputEntity_HydraulicBoundaryLocationCalculationOutputNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((HydraulicBoundaryLocationCalculationOutput) null).CreateHydraulicLocationOutputEntity();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateHydraulicLocationOutputEntity_WithValidParameters_ReturnsHydraulicLocationEntityWithOutputSet()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new HydraulicBoundaryLocationCalculationOutput(
+ random.NextDouble(), random.NextDouble(), random.NextDouble(), random.NextDouble(),
+ random.NextDouble(), random.NextEnumValue(), null);
+
+ // Call
+ HydraulicLocationOutputEntity entity = output.CreateHydraulicLocationOutputEntity();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(output.Result, entity.Result, output.Result.GetAccuracy());
+ Assert.AreEqual(output.TargetProbability, entity.TargetProbability);
+ Assert.AreEqual(output.TargetReliability, entity.TargetReliability, output.TargetReliability.GetAccuracy());
+ Assert.AreEqual(output.CalculatedProbability, entity.CalculatedProbability);
+ Assert.AreEqual(output.CalculatedReliability, entity.CalculatedReliability, output.CalculatedReliability.GetAccuracy());
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+
+ AssertGeneralResult(output.GeneralResult, entity.GeneralResultSubMechanismIllustrationPointEntity);
+ }
+
+ [Test]
+ public void CreateHydraulicLocationOutputEntity_WithNaNParameters_ReturnsHydraulicLocationEntityWithOutputNaN()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new HydraulicBoundaryLocationCalculationOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(), null);
+
+ // Call
+ HydraulicLocationOutputEntity entity = output.CreateHydraulicLocationOutputEntity();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.Result);
+ Assert.IsNull(entity.TargetProbability);
+ Assert.IsNull(entity.TargetReliability);
+ Assert.IsNull(entity.CalculatedProbability);
+ Assert.IsNull(entity.CalculatedReliability);
+ Assert.AreEqual((byte) output.CalculationConvergence, entity.CalculationConvergence);
+
+ AssertGeneralResult(output.GeneralResult, entity.GeneralResultSubMechanismIllustrationPointEntity);
+ }
+
+ [Test]
+ public void CreateHydraulicLocationOutputEntity_WithGeneralResult_ReturnsHydraulicLocationEntityWithGeneralResult()
+ {
+ // Setup
+ var random = new Random(21);
+ var output = new HydraulicBoundaryLocationCalculationOutput(double.NaN, double.NaN, double.NaN,
+ double.NaN, double.NaN, random.NextEnumValue(),
+ GetGeneralResult());
+
+ // Call
+ HydraulicLocationOutputEntity entity = output.CreateHydraulicLocationOutputEntity();
+
+ // Assert
+ AssertGeneralResult(output.GeneralResult, entity.GeneralResultSubMechanismIllustrationPointEntity);
+ }
+
+ private static GeneralResult GetGeneralResult()
+ {
+ var random = new Random(55);
+ var generalResult = new GeneralResult(
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ new[]
+ {
+ new Stochast("stochastOne", random.NextDouble(), random.NextDouble())
+ },
+ new[]
+ {
+ new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ "IllustrationPointTwo",
+ new TestSubMechanismIllustrationPoint())
+ });
+
+ return generalResult;
+ }
+
+ private static void AssertGeneralResult(GeneralResult illustrationPoint,
+ GeneralResultSubMechanismIllustrationPointEntity entity)
+ {
+ if (illustrationPoint == null)
+ {
+ Assert.IsNull(entity);
+ return;
+ }
+
+ Assert.IsNotNull(entity);
+ WindDirection governingWindDirection = illustrationPoint.GoverningWindDirection;
+ TestHelper.AssertAreEqualButNotSame(governingWindDirection.Name, entity.GoverningWindDirectionName);
+ Assert.AreEqual(governingWindDirection.Angle, entity.GoverningWindDirectionAngle,
+ governingWindDirection.Angle.GetAccuracy());
+
+ Assert.AreEqual(illustrationPoint.Stochasts.Count(), entity.StochastEntities.Count);
+ Assert.AreEqual(illustrationPoint.TopLevelIllustrationPoints.Count(),
+ entity.TopLevelSubMechanismIllustrationPointEntities.Count);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicBoundaryLocationCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 NUnit.Framework;
+using Ringtoets.Common.Data.Hydraulics;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class HydraulicBoundaryLocationCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(-1, "testName", 2, 3);
+
+ // Call
+ TestDelegate test = () => hydraulicBoundaryLocation.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_HydraulicBoundaryLocationNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var random = new Random(21);
+
+ // Call
+ TestDelegate call = () => ((HydraulicBoundaryLocation) null).Create(new PersistenceRegistry(), random.Next());
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("location", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithPersistenceRegistry_ReturnsHydraulicLocationEntityWithPropertiesSet()
+ {
+ // Setup
+ const string testName = "testName";
+ var random = new Random(21);
+ double coordinateX = random.NextDouble();
+ double coordinateY = random.NextDouble();
+ int id = random.Next(0, 150);
+ int order = random.Next();
+
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, testName, coordinateX, coordinateY);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ HydraulicLocationEntity entity = hydraulicBoundaryLocation.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(id, entity.LocationId);
+ Assert.AreEqual(testName, entity.Name);
+ Assert.AreEqual(coordinateX, entity.LocationX);
+ Assert.AreEqual(coordinateY, entity.LocationY);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReferences()
+ {
+ // Setup
+ const string testName = "original name";
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, testName, 0, 0);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ HydraulicLocationEntity entity = hydraulicBoundaryLocation.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreNotSame(testName, entity.Name,
+ "To create stable binary representations/fingerprints, it's really important that strings are not shared.");
+ Assert.AreEqual(testName, entity.Name);
+ }
+
+ [Test]
+ public void Create_HydraulicBoundaryLocationSavedMultipleTimes_ReturnSameEntity()
+ {
+ // Setup
+ var hydraulicBoundaryLocations = new HydraulicBoundaryLocation(1, "A", 1.1, 2.2);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ HydraulicLocationEntity entity1 = hydraulicBoundaryLocations.Create(registry, 0);
+ HydraulicLocationEntity entity2 = hydraulicBoundaryLocations.Create(registry, 1);
+
+ // Assert
+ Assert.AreSame(entity1, entity2);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicLocationConfigurationSettingsCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicLocationConfigurationSettingsCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/HydraulicLocationConfigurationSettingsCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,86 @@
+// 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 Ringtoets.Common.Data.Hydraulics;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create
+{
+ [TestFixture]
+ public class HydraulicLocationConfigurationSettingsCreateExtensionsTest
+ {
+ [Test]
+ public void Create_HydraulicBoundaryDatabaseNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((HydraulicBoundaryDatabase) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("hydraulicBoundaryDatabase", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_ValidHydraulicBoundaryDatabase_ReturnsHydraulicBoundaryDatabaseEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
+ {
+ FilePath = "hydraulicBoundaryDatabasefilePath",
+ Version = "Version"
+ };
+ hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings.SetValues("hlcdFilePath",
+ "ScenarioName",
+ random.Next(),
+ "Scope",
+ "SeaLevel",
+ "RiverDischarge",
+ "LakeLevel",
+ "WindDirection",
+ "WindSpeed",
+ "Comment");
+
+ // Call
+ HydraulicBoundaryDatabaseEntity entity = hydraulicBoundaryDatabase.Create();
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(hydraulicBoundaryDatabase.FilePath, entity.FilePath);
+ TestHelper.AssertAreEqualButNotSame(hydraulicBoundaryDatabase.Version, entity.Version);
+
+ HydraulicLocationConfigurationSettings settings = hydraulicBoundaryDatabase.HydraulicLocationConfigurationSettings;
+ TestHelper.AssertAreEqualButNotSame(settings.FilePath, entity.HydraulicLocationConfigurationSettingsFilePath);
+ TestHelper.AssertAreEqualButNotSame(settings.ScenarioName, entity.HydraulicLocationConfigurationSettingsScenarioName);
+ TestHelper.AssertAreEqualButNotSame(settings.Year, entity.HydraulicLocationConfigurationSettingsYear);
+ TestHelper.AssertAreEqualButNotSame(settings.Scope, entity.HydraulicLocationConfigurationSettingsScope);
+ TestHelper.AssertAreEqualButNotSame(settings.SeaLevel, entity.HydraulicLocationConfigurationSettingsSeaLevel);
+ TestHelper.AssertAreEqualButNotSame(settings.RiverDischarge, entity.HydraulicLocationConfigurationSettingsRiverDischarge);
+ TestHelper.AssertAreEqualButNotSame(settings.LakeLevel, entity.HydraulicLocationConfigurationSettingsLakeLevel);
+ TestHelper.AssertAreEqualButNotSame(settings.WindDirection, entity.HydraulicLocationConfigurationSettingsWindDirection);
+ TestHelper.AssertAreEqualButNotSame(settings.WindSpeed, entity.HydraulicLocationConfigurationSettingsWindSpeed);
+ TestHelper.AssertAreEqualButNotSame(settings.Comment, entity.HydraulicLocationConfigurationSettingsComment);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/GeneralResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,320 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class GeneralResultCreateExtensionsTest
+ {
+ [Test]
+ public void CreateGeneralResultSubMechanismIllustrationPointEntity_GeneralResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GeneralResult) null)
+ .CreateGeneralResultSubMechanismIllustrationPointEntity();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("generalResult", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralResult_ReturnsEntityWithoutStochastsAndTopLevelSubMechanismIllustrationPointEntities()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ Enumerable.Empty(),
+ Enumerable.Empty());
+
+ // Call
+ GeneralResultSubMechanismIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultSubMechanismIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultSubMechanismIllustrationPointEntity(generalResult, entity);
+ }
+
+ [Test]
+ public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralResultWithStochasts_ReturnsEntityWithStochastsEntities()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ new[]
+ {
+ new Stochast("stochastOne", random.NextDouble(), random.NextDouble()),
+ new Stochast("stochastTwo", random.NextDouble(), random.NextDouble())
+ },
+ Enumerable.Empty());
+
+ // Call
+ GeneralResultSubMechanismIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultSubMechanismIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultSubMechanismIllustrationPointEntity(generalResult, entity);
+ }
+
+ [Test]
+ public void CreateGeneralResultSubMechanismIllustrationPointEntity_ValidGeneralResultWithIllustrationPoints_ReturnsEntityWithTopLevelSubMechanismIllustrationPointEntities()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ Enumerable.Empty(),
+ new[]
+ {
+ new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ "IllustrationPointOne",
+ new TestSubMechanismIllustrationPoint()),
+ new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(),
+ "IllustrationPointTwo",
+ new TestSubMechanismIllustrationPoint())
+ });
+
+ // Call
+ GeneralResultSubMechanismIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultSubMechanismIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultSubMechanismIllustrationPointEntity(generalResult, entity);
+ }
+
+ [Test]
+ public void CreateGeneralResultFaultTreeIllustrationPointEntity_GeneralResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((GeneralResult) null)
+ .CreateGeneralResultFaultTreeIllustrationPointEntity();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("generalResult", exception.ParamName);
+ }
+
+ [Test]
+ public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralResult_ReturnsExpectedGeneralResultFaultTreeIllustrationPointEntity()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ Enumerable.Empty(),
+ Enumerable.Empty());
+
+ // Call
+ GeneralResultFaultTreeIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultFaultTreeIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultFaultTreeIllustrationPointEntity(generalResult, entity);
+ }
+
+ [Test]
+ public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralResultWithStochasts_ReturnsEntityWithStochastsEntities()
+ {
+ // Setup
+ var random = new Random(22);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ new[]
+ {
+ new Stochast("stochastOne", random.NextDouble(), random.NextDouble()),
+ new Stochast("stochastTwo", random.NextDouble(), random.NextDouble())
+ },
+ Enumerable.Empty());
+
+ // Call
+ GeneralResultFaultTreeIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultFaultTreeIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultFaultTreeIllustrationPointEntity(generalResult, entity);
+ }
+
+ [Test]
+ public void CreateGeneralResultFaultTreeIllustrationPointEntity_ValidGeneralResultsWithIllustrationPoints_ReturnsEntityWithTopLevelFaultTreeIllustrationPointEntities()
+ {
+ // Setup
+ var random = new Random(22);
+
+ var generalResult = new GeneralResult(
+ new WindDirection("SSE", random.NextDouble()),
+ Enumerable.Empty(),
+ new[]
+ {
+ new TopLevelFaultTreeIllustrationPoint(
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ "IllustrationPointOne",
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint())),
+ new TopLevelFaultTreeIllustrationPoint(
+ WindDirectionTestFactory.CreateTestWindDirection(),
+ "IllustrationPointTwo",
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint()))
+ });
+
+ // Call
+ GeneralResultFaultTreeIllustrationPointEntity entity =
+ generalResult.CreateGeneralResultFaultTreeIllustrationPointEntity();
+
+ // Assert
+ AssertGeneralResultFaultTreeIllustrationPointEntity(generalResult, entity);
+ }
+
+ private static void AssertGeneralResultSubMechanismIllustrationPointEntity(
+ GeneralResult generalResult,
+ GeneralResultSubMechanismIllustrationPointEntity entity)
+ {
+ AssertWindDirection(generalResult.GoverningWindDirection, entity);
+
+ AssertStochastEntities(generalResult.Stochasts.ToArray(), entity.StochastEntities.ToArray());
+
+ AssertTopLevelIllustrationPointEntities(generalResult.TopLevelIllustrationPoints.ToArray(),
+ entity.TopLevelSubMechanismIllustrationPointEntities.ToArray());
+ }
+
+ private static void AssertGeneralResultFaultTreeIllustrationPointEntity(
+ GeneralResult generalResult,
+ GeneralResultFaultTreeIllustrationPointEntity entity)
+ {
+ AssertWindDirection(generalResult.GoverningWindDirection, entity);
+
+ AssertStochastEntities(generalResult.Stochasts.ToArray(), entity.StochastEntities.ToArray());
+
+ AssertTopLevelIllustrationPointEntities(generalResult.TopLevelIllustrationPoints.ToArray(),
+ entity.TopLevelFaultTreeIllustrationPointEntities.ToArray());
+ }
+
+ private static void AssertWindDirection(WindDirection expectedWindDirection,
+ IGeneralResultEntity entity)
+ {
+ TestHelper.AssertAreEqualButNotSame(expectedWindDirection.Name, entity.GoverningWindDirectionName);
+ Assert.AreEqual(expectedWindDirection.Angle, entity.GoverningWindDirectionAngle,
+ expectedWindDirection.Angle.GetAccuracy());
+ }
+
+ private static void AssertStochastEntities(Stochast[] stochasts, StochastEntity[] stochastEntities)
+ {
+ Assert.AreEqual(stochasts.Length, stochastEntities.Length);
+
+ for (var i = 0; i < stochasts.Length; i++)
+ {
+ AssertStochastEntity(stochasts[i], stochastEntities[i], i);
+ }
+ }
+
+ private static void AssertStochastEntity(Stochast stochast,
+ StochastEntity stochastEntity,
+ int expectedOrder)
+ {
+ TestHelper.AssertAreEqualButNotSame(stochast.Name, stochastEntity.Name);
+ Assert.AreEqual(stochast.Duration, stochastEntity.Duration, stochast.Duration.GetAccuracy());
+ Assert.AreEqual(stochast.Alpha, stochastEntity.Alpha, stochast.Alpha.GetAccuracy());
+
+ Assert.AreEqual(expectedOrder, stochastEntity.Order);
+ }
+
+ private static void AssertTopLevelIllustrationPointEntities(
+ TTopLevelIllustrationPoint[] illustrationPoints,
+ TopLevelSubMechanismIllustrationPointEntity[] illustrationPointEntities)
+ where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase
+ {
+ Assert.AreEqual(illustrationPoints.Length, illustrationPointEntities.Length);
+
+ for (var i = 0; i < illustrationPoints.Length; i++)
+ {
+ AssertTopLevelIllustrationPointEntity(illustrationPoints[i],
+ illustrationPointEntities[i],
+ i);
+ }
+ }
+
+ private static void AssertTopLevelIllustrationPointEntity(
+ TTopLevelIllustrationPoint illustrationPoint,
+ TopLevelSubMechanismIllustrationPointEntity illustrationPointEntity,
+ int expectedOrder)
+ where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase
+ {
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation,
+ illustrationPointEntity.ClosingSituation);
+
+ WindDirection expectedWindDirection = illustrationPoint.WindDirection;
+ TestHelper.AssertAreEqualButNotSame(expectedWindDirection.Name, illustrationPointEntity.WindDirectionName);
+ Assert.AreEqual(expectedWindDirection.Angle, illustrationPointEntity.WindDirectionAngle,
+ expectedWindDirection.Angle.GetAccuracy());
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, illustrationPointEntity.ClosingSituation);
+
+ Assert.AreEqual(expectedOrder, illustrationPointEntity.Order);
+ }
+
+ private static void AssertTopLevelIllustrationPointEntities(
+ TTopLevelIllustrationPoint[] illustrationPoints,
+ TopLevelFaultTreeIllustrationPointEntity[] illustrationPointEntities)
+ where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase
+ {
+ Assert.AreEqual(illustrationPoints.Length, illustrationPointEntities.Length);
+
+ for (var i = 0; i < illustrationPoints.Length; i++)
+ {
+ AssertTopLevelIllustrationPointEntity(illustrationPoints[i],
+ illustrationPointEntities[i],
+ i);
+ }
+ }
+
+ private static void AssertTopLevelIllustrationPointEntity(
+ TTopLevelIllustrationPoint illustrationPoint,
+ TopLevelFaultTreeIllustrationPointEntity illustrationPointEntity,
+ int expectedOrder)
+ where TTopLevelIllustrationPoint : TopLevelIllustrationPointBase
+ {
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation,
+ illustrationPointEntity.ClosingSituation);
+
+ WindDirection expectedWindDirection = illustrationPoint.WindDirection;
+ TestHelper.AssertAreEqualButNotSame(expectedWindDirection.Name, illustrationPointEntity.WindDirectionName);
+ Assert.AreEqual(expectedWindDirection.Angle, illustrationPointEntity.WindDirectionAngle,
+ expectedWindDirection.Angle.GetAccuracy());
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, illustrationPointEntity.ClosingSituation);
+
+ Assert.AreEqual(expectedOrder, illustrationPointEntity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointNodeCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointNodeCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointNodeCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,251 @@
+// 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 Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class IllustrationPointNodeCreateExtensionsTest
+ {
+ [Test]
+ public void Create_IllustrationPointNodeNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((IllustrationPointNode) null).Create(0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("illustrationPointNode", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_IllustrationPointNodeWithFaultTreeIllustrationPoint_ReturnFaultTreeIllustrationPointEntity()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var illustrationPoint = new FaultTreeIllustrationPoint("Illustration point name",
+ random.NextDouble(),
+ Enumerable.Empty(),
+ random.NextEnumValue());
+ int order = random.Next();
+
+ var node = new IllustrationPointNode(illustrationPoint);
+
+ // Call
+ FaultTreeIllustrationPointEntity entity = node.Create(order);
+
+ // Assert
+ Assert.IsNull(entity.ParentFaultTreeIllustrationPointEntityId);
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, entity.Name);
+ Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy());
+ byte expectedCombinationType = Convert.ToByte(illustrationPoint.CombinationType);
+ Assert.AreEqual(expectedCombinationType, entity.CombinationType);
+ CollectionAssert.IsEmpty(entity.FaultTreeIllustrationPointEntity1);
+ CollectionAssert.IsEmpty(entity.StochastEntities);
+ CollectionAssert.IsEmpty(entity.SubMechanismIllustrationPointEntities);
+ CollectionAssert.IsEmpty(entity.TopLevelFaultTreeIllustrationPointEntities);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_IllustrationPointNodeWithFaultTreeIllustrationPointAndStochast_ReturnFaultTreeIllustrationPointEntity()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var illustrationPoint = new FaultTreeIllustrationPoint(
+ "Illustration point name",
+ random.NextDouble(),
+ new[]
+ {
+ new Stochast("Stochast",
+ random.NextDouble(),
+ random.NextDouble())
+ },
+ random.NextEnumValue());
+ int order = random.Next();
+
+ var node = new IllustrationPointNode(illustrationPoint);
+
+ // Call
+ FaultTreeIllustrationPointEntity entity = node.Create(order);
+
+ // Assert
+ Assert.IsNull(entity.ParentFaultTreeIllustrationPointEntityId);
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, entity.Name);
+ Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy());
+ byte expectedCombinationType = Convert.ToByte(illustrationPoint.CombinationType);
+ Assert.AreEqual(expectedCombinationType, entity.CombinationType);
+ CollectionAssert.IsEmpty(entity.FaultTreeIllustrationPointEntity1);
+ CollectionAssert.IsEmpty(entity.SubMechanismIllustrationPointEntities);
+ CollectionAssert.IsEmpty(entity.TopLevelFaultTreeIllustrationPointEntities);
+ Assert.AreEqual(order, entity.Order);
+
+ StochastEntity entityStochastEntity = entity.StochastEntities.Single();
+ Stochast stochast = illustrationPoint.Stochasts.First();
+ Assert.AreEqual(stochast.Name, entityStochastEntity.Name);
+ Assert.AreEqual(stochast.Alpha, entityStochastEntity.Alpha);
+ Assert.AreEqual(stochast.Duration, entityStochastEntity.Duration);
+ }
+
+ [Test]
+ public void Create_IllustrationPointNodeWithSubMechanismIllustrationPoint_ThrowsNotSupportedException()
+ {
+ // Setup
+ var node = new IllustrationPointNode(new TestSubMechanismIllustrationPoint());
+
+ // Call
+ TestDelegate call = () => node.Create(0);
+
+ // Assert
+ string message = Assert.Throws(call).Message;
+ Assert.AreEqual($"Illustration point type '{typeof(TestSubMechanismIllustrationPoint)}' is not supported.", message);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(GetValidIllustrationPointNodes))]
+ public void Create_IllustrationPointNodeWithValidChildren_ReturnFaultTreeIllustrationPointEntity(
+ IEnumerable children)
+ {
+ // Setup
+ var random = new Random(21);
+
+ var illustrationPoint = new FaultTreeIllustrationPoint("Illustration point name A",
+ random.NextDouble(),
+ Enumerable.Empty(),
+ random.NextEnumValue());
+ int order = random.Next();
+
+ var node = new IllustrationPointNode(illustrationPoint);
+ node.SetChildren(children.ToArray());
+
+ // Call
+ FaultTreeIllustrationPointEntity entity = node.Create(order);
+
+ // Assert
+ AssertFaultTreeIllustrationPointEntity(illustrationPoint, entity);
+ AssertIllustrationPointEntities(node.Children.ToArray(),
+ entity.SubMechanismIllustrationPointEntities.ToArray(),
+ entity.FaultTreeIllustrationPointEntity1.ToArray());
+
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ private static IEnumerable GetValidIllustrationPointNodes()
+ {
+ yield return new TestCaseData(new List
+ {
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("A")),
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("B"))
+ }).SetName("SubMechanismIllustrationPoints");
+
+ yield return new TestCaseData(new List
+ {
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("A")),
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("B"))
+ }).SetName("SubMechanismAndFaultTreeIllustrationPoints");
+
+ yield return new TestCaseData(new List
+ {
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("A")),
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("B"))
+ }).SetName("FaultTreeIllustrationPoints");
+
+ var node = new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("A"));
+ node.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("B")),
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("C"))
+ });
+
+ yield return new TestCaseData(new List
+ {
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPointCombinationTypeAnd("AA")),
+ node
+ }).SetName("FaultTreeIllustrationPointsWithChildren");
+ }
+
+ private static void AssertIllustrationPointEntities(
+ IllustrationPointNode[] children,
+ IEnumerable subMechanismIllustrationPointEntities,
+ IEnumerable faultTreeIllustrationPointEntity
+ )
+ {
+ for (var i = 0; i < children.Length; i++)
+ {
+ int nrOfTotalCreatedEntities = subMechanismIllustrationPointEntities.Count() + faultTreeIllustrationPointEntity.Count();
+ Assert.AreEqual(nrOfTotalCreatedEntities, children.Length);
+
+ IllustrationPointNode child = children[i];
+
+ var subMechanismIllustrationPoint = child.Data as SubMechanismIllustrationPoint;
+ if (subMechanismIllustrationPoint != null)
+ {
+ SubMechanismIllustrationPointEntity illustrationPointEntity = subMechanismIllustrationPointEntities.Single(s => s.Order == i);
+ AssertSubMechanismIllustrationPointEntity(subMechanismIllustrationPoint, illustrationPointEntity);
+ }
+
+ var faultTreeIllustrationPoint = child.Data as FaultTreeIllustrationPoint;
+ if (faultTreeIllustrationPoint != null)
+ {
+ FaultTreeIllustrationPointEntity illustrationPointEntity = faultTreeIllustrationPointEntity.Single(f => f.Order == i);
+ AssertFaultTreeIllustrationPointEntity(faultTreeIllustrationPoint, illustrationPointEntity);
+
+ AssertIllustrationPointEntities(child.Children.ToArray(),
+ illustrationPointEntity.SubMechanismIllustrationPointEntities.ToArray(),
+ illustrationPointEntity.FaultTreeIllustrationPointEntity1.ToArray());
+ }
+ }
+ }
+
+ private static void AssertSubMechanismIllustrationPointEntity(IllustrationPointBase illustrationPoint,
+ SubMechanismIllustrationPointEntity illustrationPointEntity)
+ {
+ Assert.IsNotNull(illustrationPoint);
+ Assert.AreEqual(illustrationPoint.Beta, illustrationPointEntity.Beta, illustrationPoint.Beta.GetAccuracy());
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, illustrationPointEntity.Name);
+
+ CollectionAssert.IsEmpty(illustrationPointEntity.IllustrationPointResultEntities);
+ CollectionAssert.IsEmpty(illustrationPointEntity.SubMechanismIllustrationPointStochastEntities);
+ }
+
+ private static void AssertFaultTreeIllustrationPointEntity(FaultTreeIllustrationPoint illustrationPoint,
+ FaultTreeIllustrationPointEntity illustrationPointEntity)
+ {
+ Assert.IsNotNull(illustrationPoint);
+ Assert.AreEqual(illustrationPoint.Beta, illustrationPointEntity.Beta, illustrationPoint.Beta.GetAccuracy());
+ Assert.AreEqual(Convert.ToByte(illustrationPoint.CombinationType), illustrationPointEntity.CombinationType);
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, illustrationPointEntity.Name);
+ CollectionAssert.IsEmpty(illustrationPointEntity.StochastEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/IllustrationPointResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 System;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class IllustrationPointResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_IllustrationPointResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((IllustrationPointResult) null).Create(0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("illustrationPointResult", paramName);
+ }
+
+ [Test]
+ public void Create_ValidIllustrationPointResult_ReturnIllustrationPointResultEntity()
+ {
+ // Setup
+ var random = new Random(123);
+ var illustrationPointResult = new IllustrationPointResult("Some description",
+ random.NextDouble());
+ int order = random.Next();
+
+ // Call
+ IllustrationPointResultEntity entity =
+ illustrationPointResult.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(illustrationPointResult.Description, entity.Description);
+ Assert.AreEqual(illustrationPointResult.Value, entity.Value, illustrationPointResult.Value.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/StochastCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/StochastCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/StochastCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,66 @@
+// 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 Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class StochastCreateExtensionsTest
+ {
+ [Test]
+ public void Create_StochastNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((Stochast) null).Create(0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("stochast", paramName);
+ }
+
+ [Test]
+ public void Create_ValidStochast_ReturnStochastEntity()
+ {
+ // Setup
+ var random = new Random(123);
+ var stochast = new Stochast("Some description",
+ random.NextDouble(),
+ random.NextDouble());
+ int order = random.Next();
+
+ // Call
+ StochastEntity entity = stochast.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(stochast.Name, entity.Name);
+ Assert.AreEqual(stochast.Alpha, entity.Alpha, stochast.Alpha.GetAccuracy());
+ Assert.AreEqual(stochast.Duration, entity.Duration, stochast.Duration.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class SubMechanismIllustrationPointCreateExtensionsTest
+ {
+ [Test]
+ public void Create_IllustrationPointNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((SubMechanismIllustrationPoint) null).Create(0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("subMechanismIllustrationPoint", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_SubMechanismIllustrationPointWithoutResultsAndStochasts_ReturnSubMechanismIllustrationPointEntityWithoutResultsAndStochastsEntities()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var illustrationPoint = new SubMechanismIllustrationPoint("Illustration point name",
+ random.NextDouble(),
+ Enumerable.Empty(),
+ Enumerable.Empty());
+ int order = random.Next();
+
+ // Call
+ SubMechanismIllustrationPointEntity entity = illustrationPoint.Create(order);
+
+ // Assert
+ AssertCommonProperties(illustrationPoint, entity);
+ Assert.AreEqual(order, entity.Order);
+ CollectionAssert.IsEmpty(entity.IllustrationPointResultEntities);
+ CollectionAssert.IsEmpty(entity.SubMechanismIllustrationPointStochastEntities);
+ }
+
+ [Test]
+ public void Create_ValidIllustrationPointWithStochasts_ReturnSubMechanismIllustrationPointEntityWithStochastEntities()
+ {
+ // Setup
+ var random = new Random(21);
+ var stochastOne = new SubMechanismIllustrationPointStochast("stochast name",
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ var stochastTwo = new SubMechanismIllustrationPointStochast("Stochast name two",
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ SubMechanismIllustrationPointStochast[] stochasts =
+ {
+ stochastOne,
+ stochastTwo
+ };
+
+ var illustrationPoint = new SubMechanismIllustrationPoint("Illustration point name",
+ random.NextDouble(),
+ stochasts,
+ Enumerable.Empty());
+ int order = random.Next();
+
+ // Call
+ SubMechanismIllustrationPointEntity entity = illustrationPoint.Create(order);
+
+ // Assert
+ AssertCommonProperties(illustrationPoint, entity);
+ Assert.AreEqual(order, entity.Order);
+ SubMechanismIllustrationPointStochastEntity[] stochastEntities =
+ entity.SubMechanismIllustrationPointStochastEntities.ToArray();
+ int expectedNrOfStochasts = stochasts.Length;
+ Assert.AreEqual(expectedNrOfStochasts, stochastEntities.Length);
+ for (var i = 0; i < expectedNrOfStochasts; i++)
+ {
+ SubMechanismIllustrationPointStochast stochast = stochasts[i];
+ SubMechanismIllustrationPointStochastEntity stochastEntity = stochastEntities[i];
+
+ TestHelper.AssertAreEqualButNotSame(stochast.Name, stochastEntity.Name);
+ Assert.AreEqual(stochast.Duration, stochastEntity.Duration, stochast.Duration.GetAccuracy());
+ Assert.AreEqual(stochast.Alpha, stochastEntity.Alpha, stochast.Alpha.GetAccuracy());
+ Assert.AreEqual(stochast.Realization, stochastEntity.Realization, stochast.Realization.GetAccuracy());
+ Assert.AreEqual(i, stochastEntity.Order);
+ }
+ }
+
+ [Test]
+ public void Create_MultipleResultsAndValidIllustrationPoint_ReturnSubMechanismIllustrationPointEntityWithResultEntities()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var illustrationPointResultOne = new IllustrationPointResult("result description", random.NextDouble());
+ var illustrationPointResultTwo = new IllustrationPointResult("result description two", random.NextDouble());
+ IllustrationPointResult[] illustrationPointResults =
+ {
+ illustrationPointResultOne,
+ illustrationPointResultTwo
+ };
+
+ var illustrationPoint = new SubMechanismIllustrationPoint("Illustration point name",
+ random.NextDouble(),
+ Enumerable.Empty(),
+ illustrationPointResults);
+ int order = random.Next();
+
+ // Call
+ SubMechanismIllustrationPointEntity entity = illustrationPoint.Create(order);
+
+ // Assert
+ AssertCommonProperties(illustrationPoint, entity);
+ Assert.AreEqual(order, entity.Order);
+ IllustrationPointResultEntity[] resultEntities = entity.IllustrationPointResultEntities.ToArray();
+ int expectedNrOfIllustrationPoints = illustrationPointResults.Length;
+ Assert.AreEqual(expectedNrOfIllustrationPoints, resultEntities.Length);
+ for (var i = 0; i < expectedNrOfIllustrationPoints; i++)
+ {
+ IllustrationPointResult illustrationPointResult = illustrationPointResults[i];
+ IllustrationPointResultEntity illustrationPointResultEntity = resultEntities[i];
+
+ TestHelper.AssertAreEqualButNotSame(illustrationPointResult.Description, illustrationPointResultEntity.Description);
+ Assert.AreEqual(illustrationPointResult.Value, illustrationPointResultEntity.Value,
+ illustrationPointResult.Value.GetAccuracy());
+ Assert.AreEqual(i, illustrationPointResultEntity.Order);
+ }
+ }
+
+ private static void AssertCommonProperties(SubMechanismIllustrationPoint illustrationPoint,
+ SubMechanismIllustrationPointEntity entity)
+ {
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, entity.Name);
+ Assert.AreEqual(illustrationPoint.Beta, entity.Beta, illustrationPoint.Beta.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/SubMechanismIllustrationPointStochastCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class SubMechanismIllustrationPointStochastCreateExtensionsTest
+ {
+ [Test]
+ public void Create_StochastNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((SubMechanismIllustrationPointStochast) null).Create(0);
+
+ // Assert
+ string paramName = Assert.Throws(call).ParamName;
+ Assert.AreEqual("subMechanismIllustrationPointStochast", paramName);
+ }
+
+ [Test]
+ public void Create_ValidStochast_ReturnSubMechanismIllustrationPointStochastEntity()
+ {
+ // Setup
+ var random = new Random(123);
+ var stochast = new SubMechanismIllustrationPointStochast("Some description",
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ int order = random.Next();
+
+ // Call
+ SubMechanismIllustrationPointStochastEntity entity = stochast.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(stochast.Name, entity.Name);
+ Assert.AreEqual(stochast.Alpha, entity.Alpha, stochast.Alpha.GetAccuracy());
+ Assert.AreEqual(stochast.Duration, entity.Duration, stochast.Duration.GetAccuracy());
+ Assert.AreEqual(stochast.Realization, entity.Realization, stochast.Realization.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelFaultTreeIllustrationPointCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class TopLevelFaultTreeIllustrationPointCreateExtensionsTest
+ {
+ [Test]
+ public void Create_TopLevelFaultTreeIllustrationPointNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((TopLevelFaultTreeIllustrationPoint) null).Create(0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("topLevelFaultTreeIllustrationPoint", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_ValidTopLevelFaultTreeIllustrationPoint_ReturnsTopLevelFaultTreeIllustrationPointEntity()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var windDirection = new WindDirection("WindDirection Name", random.NextDouble());
+ var illustrationPoint = new TopLevelFaultTreeIllustrationPoint(
+ windDirection,
+ "Just a situation",
+ new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint()));
+ int order = random.Next();
+
+ // Call
+ TopLevelFaultTreeIllustrationPointEntity entity = illustrationPoint.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.ClosingSituation, entity.ClosingSituation);
+ TestHelper.AssertAreEqualButNotSame(windDirection.Name, entity.WindDirectionName);
+ Assert.AreEqual(windDirection.Angle, entity.WindDirectionAngle, windDirection.Angle.GetAccuracy());
+ CollectionAssert.IsEmpty(entity.FaultTreeIllustrationPointEntity.SubMechanismIllustrationPointEntities);
+ CollectionAssert.IsEmpty(entity.FaultTreeIllustrationPointEntity.FaultTreeIllustrationPointEntity1);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_ValidTopLevelFaultTreeIllustrationPointWithChildren_ReturnsTopLevelFaultTreeIllustrationPointEntityWithChildren()
+ {
+ // Setup
+ var random = new Random(21);
+
+ var windDirection = new WindDirection("WindDirection Name", random.NextDouble());
+ var illustrationPointNode = new IllustrationPointNode(FaultTreeIllustrationPointTestFactory.CreateTestFaultTreeIllustrationPoint());
+ illustrationPointNode.SetChildren(new[]
+ {
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("Point A")),
+ new IllustrationPointNode(new TestSubMechanismIllustrationPoint("Point B"))
+ });
+
+ var topLevelIllustrationPoint = new TopLevelFaultTreeIllustrationPoint(
+ windDirection,
+ "Just a situation",
+ illustrationPointNode);
+ int order = random.Next();
+
+ // Call
+ TopLevelFaultTreeIllustrationPointEntity entity = topLevelIllustrationPoint.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(topLevelIllustrationPoint.ClosingSituation, entity.ClosingSituation);
+ TestHelper.AssertAreEqualButNotSame(windDirection.Name, entity.WindDirectionName);
+ Assert.AreEqual(windDirection.Angle, entity.WindDirectionAngle, windDirection.Angle.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+
+ SubMechanismIllustrationPointEntity[] subMechanismIllustrationPointEntities =
+ entity.FaultTreeIllustrationPointEntity.SubMechanismIllustrationPointEntities.ToArray();
+ Assert.AreEqual(2, subMechanismIllustrationPointEntities.Length);
+
+ for (var i = 0; i < 2; i++)
+ {
+ var expectedIllustrationPoint = new TestSubMechanismIllustrationPoint(subMechanismIllustrationPointEntities[i].Name);
+ SubMechanismIllustrationPointEntity illustrationPointEntity = subMechanismIllustrationPointEntities[i];
+ Assert.AreEqual(expectedIllustrationPoint.Name, illustrationPointEntity.Name);
+ Assert.AreEqual(expectedIllustrationPoint.Beta, illustrationPointEntity.Beta, expectedIllustrationPoint.Beta.GetAccuracy());
+ Assert.AreEqual(expectedIllustrationPoint.IllustrationPointResults.Count(),
+ illustrationPointEntity.IllustrationPointResultEntities.Count);
+ Assert.AreEqual(expectedIllustrationPoint.Stochasts.Count(),
+ illustrationPointEntity.IllustrationPointResultEntities.Count);
+ Assert.AreEqual(i, illustrationPointEntity.Order);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelSubMechanismIllustrationPointCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelSubMechanismIllustrationPointCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/IllustrationPoints/TopLevelSubMechanismIllustrationPointCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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;
+using System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
+using Riskeer.Storage.Core.Create.IllustrationPoints;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.IllustrationPoints
+{
+ [TestFixture]
+ public class TopLevelSubMechanismIllustrationPointCreateExtensionsTest
+ {
+ [Test]
+ public void Create_TopLevelSubMechanismIllustrationPointNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((TopLevelSubMechanismIllustrationPoint) null).Create(0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("topLevelSubMechanismIllustrationPoint", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_ValidTopLevelSubMechanismIllustrationPoint_ReturnsEntityWithSubMechanismIllustrationPointEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var illustrationPoint = new SubMechanismIllustrationPoint("Illustration point name",
+ random.NextDouble(),
+ Enumerable.Empty(),
+ Enumerable.Empty());
+
+ var windDirection = new WindDirection("WindDirection Name", random.NextDouble());
+ var topLevelSubMechanismIllustrationPoint = new TopLevelSubMechanismIllustrationPoint(windDirection,
+ "Just a situation",
+ illustrationPoint);
+ int order = random.Next();
+
+ // Call
+ TopLevelSubMechanismIllustrationPointEntity entity =
+ topLevelSubMechanismIllustrationPoint.Create(order);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(topLevelSubMechanismIllustrationPoint.ClosingSituation, entity.ClosingSituation);
+ Assert.AreEqual(order, entity.Order);
+
+ TestHelper.AssertAreEqualButNotSame(windDirection.Name, entity.WindDirectionName);
+ Assert.AreEqual(windDirection.Angle, entity.WindDirectionAngle, windDirection.Angle.GetAccuracy());
+
+ SubMechanismIllustrationPointEntity subMechanismIllustrationPointEntity = entity.SubMechanismIllustrationPointEntity;
+ TestHelper.AssertAreEqualButNotSame(illustrationPoint.Name, subMechanismIllustrationPointEntity.Name);
+ Assert.AreEqual(illustrationPoint.Beta, subMechanismIllustrationPointEntity.Beta, illustrationPoint.Beta.GetAccuracy());
+ CollectionAssert.IsEmpty(subMechanismIllustrationPointEntity.IllustrationPointResultEntities);
+ CollectionAssert.IsEmpty(subMechanismIllustrationPointEntity.SubMechanismIllustrationPointStochastEntities);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsCalculationScenarioCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsCalculationScenarioCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsCalculationScenarioCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,394 @@
+// 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.Linq;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.Storage.Core.TestUtil.MacroStabilityInwards;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsCalculationScenarioCreateExtensionsTest
+ {
+ [Test]
+ public void Create_RegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var scenario = new MacroStabilityInwardsCalculationScenario();
+
+ // Call
+ TestDelegate call = () => scenario.Create(null, 0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_MacroStabilityInwardsCalculationScenarioWithNaNValues_ReturnsMacroStabilityInwardsCalculationEntityWithExpectedNullProperties()
+ {
+ // Setup
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ Contribution = RoundedDouble.NaN,
+ InputParameters =
+ {
+ SlipPlaneMinimumDepth = RoundedDouble.NaN,
+ SlipPlaneMinimumLength = RoundedDouble.NaN,
+ MaximumSliceWidth = RoundedDouble.NaN,
+ AssessmentLevel = RoundedDouble.NaN,
+ WaterLevelRiverAverage = RoundedDouble.NaN,
+ XCoordinateDrainageConstruction = RoundedDouble.NaN,
+ ZCoordinateDrainageConstruction = RoundedDouble.NaN,
+ LocationInputExtreme =
+ {
+ WaterLevelPolder = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeTopAtRiver = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeTopAtPolder = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowShoulderBaseInside = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeToeAtPolder = RoundedDouble.NaN,
+ PenetrationLength = RoundedDouble.NaN
+ },
+ LocationInputDaily =
+ {
+ WaterLevelPolder = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeTopAtRiver = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeTopAtPolder = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowShoulderBaseInside = RoundedDouble.NaN,
+ PhreaticLineOffsetBelowDikeToeAtPolder = RoundedDouble.NaN
+ },
+ LeakageLengthOutwardsPhreaticLine3 = RoundedDouble.NaN,
+ LeakageLengthInwardsPhreaticLine3 = RoundedDouble.NaN,
+ LeakageLengthOutwardsPhreaticLine4 = RoundedDouble.NaN,
+ LeakageLengthInwardsPhreaticLine4 = RoundedDouble.NaN,
+ PiezometricHeadPhreaticLine2Outwards = RoundedDouble.NaN,
+ PiezometricHeadPhreaticLine2Inwards = RoundedDouble.NaN,
+ TangentLineZTop = RoundedDouble.NaN,
+ TangentLineZBottom = RoundedDouble.NaN,
+ LeftGrid =
+ {
+ XLeft = RoundedDouble.NaN,
+ XRight = RoundedDouble.NaN,
+ ZTop = RoundedDouble.NaN,
+ ZBottom = RoundedDouble.NaN
+ },
+ RightGrid =
+ {
+ XLeft = RoundedDouble.NaN,
+ XRight = RoundedDouble.NaN,
+ ZTop = RoundedDouble.NaN,
+ ZBottom = RoundedDouble.NaN
+ },
+ ZoneBoundaryLeft = RoundedDouble.NaN,
+ ZoneBoundaryRight = RoundedDouble.NaN
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // When
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+
+ Assert.IsNull(entity.ScenarioContribution);
+
+ Assert.IsNull(entity.AssessmentLevel);
+ Assert.IsNull(entity.SlipPlaneMinimumDepth);
+ Assert.IsNull(entity.SlipPlaneMinimumLength);
+ Assert.IsNull(entity.MaximumSliceWidth);
+ Assert.IsNull(entity.WaterLevelRiverAverage);
+ Assert.IsNull(entity.DrainageConstructionCoordinateX);
+ Assert.IsNull(entity.DrainageConstructionCoordinateZ);
+ Assert.IsNull(entity.MinimumLevelPhreaticLineAtDikeTopRiver);
+ Assert.IsNull(entity.MinimumLevelPhreaticLineAtDikeTopPolder);
+
+ Assert.IsNull(entity.LocationInputExtremeWaterLevelPolder);
+ Assert.IsNull(entity.LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder);
+ Assert.IsNull(entity.LocationInputExtremePhreaticLineOffsetBelowDikeTopAtPolder);
+ Assert.IsNull(entity.LocationInputExtremePhreaticLineOffsetBelowShoulderBaseInside);
+ Assert.IsNull(entity.LocationInputExtremePhreaticLineOffsetDikeToeAtPolder);
+ Assert.IsNull(entity.LocationInputExtremePenetrationLength);
+
+ Assert.IsNull(entity.LocationInputDailyWaterLevelPolder);
+ Assert.IsNull(entity.LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder);
+ Assert.IsNull(entity.LocationInputDailyPhreaticLineOffsetBelowDikeTopAtPolder);
+ Assert.IsNull(entity.LocationInputDailyPhreaticLineOffsetBelowShoulderBaseInside);
+ Assert.IsNull(entity.LocationInputDailyPhreaticLineOffsetDikeToeAtPolder);
+
+ Assert.IsNull(entity.LeakageLengthOutwardsPhreaticLine3);
+ Assert.IsNull(entity.LeakageLengthInwardsPhreaticLine3);
+ Assert.IsNull(entity.LeakageLengthOutwardsPhreaticLine4);
+ Assert.IsNull(entity.LeakageLengthInwardsPhreaticLine4);
+ Assert.IsNull(entity.PiezometricHeadPhreaticLine2Outwards);
+ Assert.IsNull(entity.PiezometricHeadPhreaticLine2Inwards);
+
+ Assert.IsNull(entity.TangentLineZTop);
+ Assert.IsNull(entity.TangentLineZBottom);
+
+ Assert.IsNull(entity.LeftGridXLeft);
+ Assert.IsNull(entity.LeftGridXRight);
+ Assert.IsNull(entity.LeftGridZTop);
+ Assert.IsNull(entity.LeftGridZBottom);
+
+ Assert.IsNull(entity.RightGridXRight);
+ Assert.IsNull(entity.RightGridXRight);
+ Assert.IsNull(entity.RightGridZTop);
+ Assert.IsNull(entity.RightGridZBottom);
+
+ Assert.IsNull(entity.ZoneBoundaryLeft);
+ Assert.IsNull(entity.ZoneBoundaryRight);
+ }
+
+ [Test]
+ public void Create_MacroStabilityInwardsCalculationScenarioWithNumericAndBooleanPropertiesSet_ReturnsMacroStabilityInwardsCalculationEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ IsRelevant = random.NextBoolean(),
+ Contribution = random.NextRoundedDouble(),
+ InputParameters =
+ {
+ UseAssessmentLevelManualInput = random.NextBoolean(),
+ AssessmentLevel = random.NextRoundedDouble(),
+ SlipPlaneMinimumDepth = random.NextRoundedDouble(),
+ SlipPlaneMinimumLength = random.NextRoundedDouble(),
+ MaximumSliceWidth = random.NextRoundedDouble(),
+ MoveGrid = random.NextBoolean(),
+ DikeSoilScenario = random.NextEnumValue(),
+ WaterLevelRiverAverage = random.NextRoundedDouble(),
+ DrainageConstructionPresent = random.NextBoolean(),
+ XCoordinateDrainageConstruction = random.NextRoundedDouble(),
+ ZCoordinateDrainageConstruction = random.NextRoundedDouble(),
+ MinimumLevelPhreaticLineAtDikeTopRiver = random.NextRoundedDouble(),
+ MinimumLevelPhreaticLineAtDikeTopPolder = random.NextRoundedDouble(),
+ LocationInputExtreme =
+ {
+ WaterLevelPolder = random.NextRoundedDouble(),
+ UseDefaultOffsets = random.NextBoolean(),
+ PhreaticLineOffsetBelowDikeTopAtRiver = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowDikeTopAtPolder = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowShoulderBaseInside = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowDikeToeAtPolder = random.NextRoundedDouble(),
+ PenetrationLength = random.NextRoundedDouble()
+ },
+ LocationInputDaily =
+ {
+ WaterLevelPolder = random.NextRoundedDouble(),
+ UseDefaultOffsets = random.NextBoolean(),
+ PhreaticLineOffsetBelowDikeTopAtRiver = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowDikeTopAtPolder = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowShoulderBaseInside = random.NextRoundedDouble(),
+ PhreaticLineOffsetBelowDikeToeAtPolder = random.NextRoundedDouble()
+ },
+ AdjustPhreaticLine3And4ForUplift = random.NextBoolean(),
+ LeakageLengthOutwardsPhreaticLine3 = random.NextRoundedDouble(),
+ LeakageLengthInwardsPhreaticLine3 = random.NextRoundedDouble(),
+ LeakageLengthOutwardsPhreaticLine4 = random.NextRoundedDouble(),
+ LeakageLengthInwardsPhreaticLine4 = random.NextRoundedDouble(),
+ PiezometricHeadPhreaticLine2Outwards = random.NextRoundedDouble(),
+ PiezometricHeadPhreaticLine2Inwards = random.NextRoundedDouble(),
+ GridDeterminationType = random.NextEnumValue(),
+ TangentLineDeterminationType = random.NextEnumValue(),
+ TangentLineZTop = random.NextRoundedDouble(2.0, 3.0),
+ TangentLineZBottom = random.NextRoundedDouble(0.0, 1.0),
+ TangentLineNumber = random.Next(1, 50),
+ LeftGrid =
+ {
+ XLeft = random.NextRoundedDouble(0.0, 1.0),
+ XRight = random.NextRoundedDouble(2.0, 3.0),
+ NumberOfHorizontalPoints = random.Next(1, 100),
+ ZTop = random.NextRoundedDouble(2.0, 3.0),
+ ZBottom = random.NextRoundedDouble(0.0, 1.0),
+ NumberOfVerticalPoints = random.Next(1, 100)
+ },
+ RightGrid =
+ {
+ XLeft = random.NextRoundedDouble(0.0, 1.0),
+ XRight = random.NextRoundedDouble(),
+ NumberOfHorizontalPoints = random.Next(1, 100),
+ ZTop = random.NextRoundedDouble(2.0, 3.0),
+ ZBottom = random.NextRoundedDouble(0.0, 1.0),
+ NumberOfVerticalPoints = random.Next(1, 100)
+ },
+ CreateZones = random.NextBoolean(),
+ ZoningBoundariesDeterminationType = random.NextEnumValue(),
+ ZoneBoundaryLeft = random.NextRoundedDouble(),
+ ZoneBoundaryRight = random.NextRoundedDouble()
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ int order = random.Next();
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+
+ MacroStabilityInwardsCalculationEntityTestHelper.AssertCalculationScenarioPropertyValues(scenario, entity);
+ Assert.IsNull(entity.SurfaceLineEntity);
+ Assert.IsNull(entity.MacroStabilityInwardsStochasticSoilProfileEntity);
+ Assert.IsNull(entity.HydraulicLocationEntity);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "Calculation name";
+ const string comment = "I am a comment";
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ Name = name,
+ Comments =
+ {
+ Body = comment
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ TestHelper.AssertAreEqualButNotSame(name, entity.Name);
+ TestHelper.AssertAreEqualButNotSame(comment, entity.Comment);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadyRegisteredHydraulicBoundaryLocation_ReturnsEntityWithHydraulicBoundaryLocationEntity()
+ {
+ // Setup
+ var hydraulicLocation = new TestHydraulicBoundaryLocation();
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = hydraulicLocation
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ var hydraulicLocationEntity = new HydraulicLocationEntity();
+ registry.Register(hydraulicLocationEntity, hydraulicLocation);
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadyRegisteredSurfaceLine_ReturnsEntityWithSurfaceLineEntity()
+ {
+ // Setup
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty);
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ InputParameters =
+ {
+ SurfaceLine = surfaceLine
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ var surfaceLineEntity = new SurfaceLineEntity();
+ registry.Register(surfaceLineEntity, surfaceLine);
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreSame(surfaceLineEntity, entity.SurfaceLineEntity);
+ }
+
+ [Test]
+ public void Create_CalculationWithAlreadyRegisteredStochasticSoilProfile_ReturnsEntityWithStochasticSoilModelEntity()
+ {
+ // Setup
+ var random = new Random(21);
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(),
+ MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D());
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ InputParameters =
+ {
+ StochasticSoilProfile = stochasticSoilProfile
+ }
+ };
+
+ var registry = new PersistenceRegistry();
+ var stochasticSoilProfileEntity = new MacroStabilityInwardsStochasticSoilProfileEntity();
+ registry.Register(stochasticSoilProfileEntity, stochasticSoilProfile);
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ MacroStabilityInwardsStochasticSoilProfileEntity expectedStochasticSoilProfileEntity = registry.Get(stochasticSoilProfile);
+ Assert.AreSame(expectedStochasticSoilProfileEntity, entity.MacroStabilityInwardsStochasticSoilProfileEntity);
+ }
+
+ [Test]
+ public void Create_HasMacroStabilityInwardsOutput_ReturnsEntityWithOutputEntity()
+ {
+ // Setup
+ var scenario = new MacroStabilityInwardsCalculationScenario
+ {
+ Output = MacroStabilityInwardsOutputTestFactory.CreateOutput()
+ };
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsCalculationEntity entity = scenario.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ MacroStabilityInwardsCalculationOutputEntity outputEntity = entity.MacroStabilityInwardsCalculationOutputEntities.FirstOrDefault();
+ Assert.IsNotNull(outputEntity);
+ MacroStabilityInwardsCalculationOutputEntityTestHelper.AssertOutputPropertyValues(scenario.Output, outputEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,344 @@
+// 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.Linq;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_WithoutAllPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.MacroStabilityInwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ Assert.AreEqual(failureMechanism.FailureMechanismSectionSourcePath, entity.FailureMechanismSectionCollectionSourcePath);
+
+ CollectionAssert.IsEmpty(entity.StochasticSoilModelEntities);
+ MacroStabilityInwardsFailureMechanismMetaEntity failureMechanismMetaEntity = entity.MacroStabilityInwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.A, failureMechanismMetaEntity.A);
+ Assert.AreEqual(failureMechanism.SurfaceLines.SourcePath, failureMechanismMetaEntity.SurfaceLineCollectionSourcePath);
+ Assert.AreEqual(failureMechanism.StochasticSoilModels.SourcePath, failureMechanismMetaEntity.StochasticSoilModelCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism
+ {
+ IsRelevant = random.NextBoolean(),
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ MacroStabilityInwardsProbabilityAssessmentInput =
+ {
+ A = random.NextDouble()
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.MacroStabilityInwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ CollectionAssert.IsEmpty(entity.StochasticSoilModelEntities);
+ CollectionAssert.IsEmpty(entity.SurfaceLineEntities);
+ MacroStabilityInwardsFailureMechanismMetaEntity failureMechanismMetaEntity = entity.MacroStabilityInwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.MacroStabilityInwardsProbabilityAssessmentInput.A, failureMechanismMetaEntity.A);
+ Assert.AreEqual(failureMechanism.SurfaceLines.SourcePath, failureMechanismMetaEntity.SurfaceLineCollectionSourcePath);
+ Assert.AreEqual(failureMechanism.StochasticSoilModels.SourcePath, failureMechanismMetaEntity.StochasticSoilModelCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithStochasticSoilModels_ReturnsFailureMechanismEntityWithStochasticSoilModelEntities()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ MacroStabilityInwardsStochasticSoilModelCollection stochasticSoilModels = failureMechanism.StochasticSoilModels;
+
+ stochasticSoilModels.AddRange(new[]
+ {
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("name"),
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("name2")
+ }, "some/path/to/file");
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(stochasticSoilModels.Count, entity.StochasticSoilModelEntities.Count);
+ for (var i = 0; i < stochasticSoilModels.Count; i++)
+ {
+ AssertStochasticSoilModel(stochasticSoilModels[i],
+ entity.StochasticSoilModelEntities.ElementAt(i));
+ }
+
+ string stochasticSoilModelCollectionSourcePath = entity.MacroStabilityInwardsFailureMechanismMetaEntities
+ .Single()
+ .StochasticSoilModelCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(stochasticSoilModels.SourcePath, stochasticSoilModelCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSurfaceLines_ReturnFailureMechanismEntityWithSurfaceLineEntities()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ MacroStabilityInwardsSurfaceLineCollection surfaceLines = failureMechanism.SurfaceLines;
+
+ surfaceLines.AddRange(new[]
+ {
+ CreateSurfaceLine(new Random(31))
+ }, "path");
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(surfaceLines.Count, entity.SurfaceLineEntities.Count);
+ for (var i = 0; i < surfaceLines.Count; i++)
+ {
+ AssertSurfaceLine(surfaceLines[i], entity.SurfaceLineEntities.ElementAt(i));
+ }
+
+ string surfaceLineCollectionSourcePath = entity.MacroStabilityInwardsFailureMechanismMetaEntities
+ .Single()
+ .SurfaceLineCollectionSourcePath;
+ TestHelper.AssertAreEqualButNotSame(surfaceLines.SourcePath, surfaceLineCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNotNull(entity);
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/file/path";
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ FailureMechanismSection testFailureMechanismSection = FailureMechanismSectionTestFactory.CreateFailureMechanismSection();
+ failureMechanism.SetSections(new[]
+ {
+ testFailureMechanismSection
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacroStabilityInwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithCalculationGroup_ReturnFailureMechanismWithCalculationGroupEntities()
+ {
+ // Setup
+ var calculationGroup = new CalculationGroup();
+ var calculation = new MacroStabilityInwardsCalculationScenario();
+
+ var failureMechanism = new MacroStabilityInwardsFailureMechanism();
+ failureMechanism.CalculationsGroup.Children.Add(calculationGroup);
+ failureMechanism.CalculationsGroup.Children.Add(calculation);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name);
+ Assert.AreEqual(0, entity.CalculationGroupEntity.Order);
+
+ CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1
+ .OrderBy(cge => cge.Order)
+ .ToArray();
+ Assert.AreEqual(1, childGroupEntities.Length);
+ CalculationGroupEntity childGroupEntity = childGroupEntities[0];
+ Assert.AreEqual(calculationGroup.Name, childGroupEntity.Name);
+ Assert.AreEqual(0, childGroupEntity.Order);
+
+ MacroStabilityInwardsCalculationEntity[] calculationEntities = entity.CalculationGroupEntity.MacroStabilityInwardsCalculationEntities
+ .OrderBy(ce => ce.Order)
+ .ToArray();
+ Assert.AreEqual(1, calculationEntities.Length);
+ MacroStabilityInwardsCalculationEntity calculationEntity = calculationEntities[0];
+ Assert.AreEqual(calculation.Name, calculationEntity.Name);
+ Assert.AreEqual(1, calculationEntity.Order);
+ }
+
+ private static void AssertSurfaceLine(MacroStabilityInwardsSurfaceLine surfaceLine, SurfaceLineEntity entity)
+ {
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ Assert.AreEqual(0, entity.PipingCharacteristicPointEntities.Count);
+ Assert.AreEqual(12, entity.MacroStabilityInwardsCharacteristicPointEntities.Count);
+ }
+
+ private MacroStabilityInwardsSurfaceLine CreateSurfaceLine(Random random)
+ {
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine(nameof(MacroStabilityInwardsSurfaceLine))
+ {
+ ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble())
+ };
+
+ var geometryPoints = new Point3D[12];
+ for (var i = 0; i < geometryPoints.Length; i++)
+ {
+ geometryPoints[i] = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ }
+
+ surfaceLine.SetGeometry(geometryPoints);
+
+ surfaceLine.SetDitchPolderSideAt(geometryPoints[1]);
+ surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[2]);
+ surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[3]);
+ surfaceLine.SetDitchDikeSideAt(geometryPoints[4]);
+ surfaceLine.SetDikeTopAtPolderAt(geometryPoints[5]);
+ surfaceLine.SetDikeTopAtRiverAt(geometryPoints[6]);
+ surfaceLine.SetShoulderBaseInsideAt(geometryPoints[7]);
+ surfaceLine.SetShoulderTopInsideAt(geometryPoints[8]);
+ surfaceLine.SetDikeToeAtRiverAt(geometryPoints[9]);
+ surfaceLine.SetDikeToeAtPolderAt(geometryPoints[10]);
+ surfaceLine.SetSurfaceLevelInsideAt(geometryPoints[11]);
+ surfaceLine.SetSurfaceLevelOutsideAt(geometryPoints[0]);
+
+ return surfaceLine;
+ }
+
+ private static void AssertStochasticSoilModel(MacroStabilityInwardsStochasticSoilModel model, StochasticSoilModelEntity entity)
+ {
+ Assert.AreEqual(model.Name, entity.Name);
+ Assert.AreEqual(model.StochasticSoilProfiles.Count(), entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.MacroStabilityInwards.Data;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((MacroStabilityInwardsFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double tailorMadeAssessmentProbability = random.NextDouble();
+ bool useManualAssembly = random.NextBoolean();
+ double manualAssemblyProbability = random.NextDouble();
+
+ var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ TailorMadeAssessmentProbability = tailorMadeAssessmentProbability,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyProbability = manualAssemblyProbability
+ };
+
+ // Call
+ MacroStabilityInwardsSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(tailorMadeAssessmentProbability, entity.TailorMadeAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(manualAssemblyProbability, entity.ManualAssemblyProbability);
+ }
+
+ [Test]
+ public void Create_SectionResultWithNaNValues_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new MacroStabilityInwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ TailorMadeAssessmentProbability = double.NaN,
+ ManualAssemblyProbability = double.NaN
+ };
+
+ // Call
+ MacroStabilityInwardsSectionResultEntity result = sectionResult.Create();
+
+ // Assert
+ Assert.IsNull(result.TailorMadeAssessmentProbability);
+ Assert.IsNull(result.ManualAssemblyProbability);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsOutputCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,187 @@
+// 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.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Data;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.Storage.Core.TestUtil.MacroStabilityInwards;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsOutputCreateExtensionsTest
+ {
+ [Test]
+ public void Create_OutputNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((MacroStabilityInwardsOutput) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("output", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithValidValues_ReturnsEntityWithExpectedPropertiesSet()
+ {
+ // Setup
+ var random = new Random(21);
+
+ MacroStabilityInwardsSlidingCircle leftCircle = CreateSlidingCircle(13);
+ MacroStabilityInwardsSlidingCircle rightCircle = CreateSlidingCircle(34);
+ IEnumerable slices = new[]
+ {
+ MacroStabilityInwardsSliceTestFactory.CreateSlice()
+ };
+ var slidingCurve = new MacroStabilityInwardsSlidingCurve(leftCircle,
+ rightCircle,
+ slices,
+ random.NextDouble(),
+ random.NextDouble());
+
+ MacroStabilityInwardsGrid leftGrid = MacroStabilityInwardsGridTestFactory.Create();
+ MacroStabilityInwardsGrid rightGrid = MacroStabilityInwardsGridTestFactory.Create();
+ RoundedDouble[] tangentLines =
+ {
+ random.NextRoundedDouble()
+ };
+ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(leftGrid, rightGrid, tangentLines);
+
+ var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties
+ {
+ FactorOfStability = random.NextDouble(),
+ ForbiddenZonesXEntryMax = random.NextDouble(),
+ ForbiddenZonesXEntryMin = random.NextDouble(),
+ ZValue = random.NextDouble()
+ });
+
+ // Call
+ MacroStabilityInwardsCalculationOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ MacroStabilityInwardsCalculationOutputEntityTestHelper.AssertOutputPropertyValues(output, entity);
+ }
+
+ [Test]
+ public void Create_WithNaNValues_ReturnsPropertyWithExpectedPropertiesSet()
+ {
+ // Setup
+ MacroStabilityInwardsSlidingCircle leftCircle = CreateSlidingCircleWithNaNValues();
+ MacroStabilityInwardsSlidingCircle rightCircle = CreateSlidingCircleWithNaNValues();
+ var slidingCurve = new MacroStabilityInwardsSlidingCurve(leftCircle,
+ rightCircle,
+ new MacroStabilityInwardsSlice[0],
+ double.NaN,
+ double.NaN);
+
+ var slipPlane = new MacroStabilityInwardsSlipPlaneUpliftVan(CreateGridWithNaNValues(),
+ CreateGridWithNaNValues(),
+ new RoundedDouble[0]);
+
+ var output = new MacroStabilityInwardsOutput(slidingCurve, slipPlane, new MacroStabilityInwardsOutput.ConstructionProperties());
+
+ // Call
+ MacroStabilityInwardsCalculationOutputEntity entity = output.Create();
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.FactorOfStability);
+ Assert.IsNull(entity.ForbiddenZonesXEntryMin);
+ Assert.IsNull(entity.ForbiddenZonesXEntryMax);
+ Assert.IsNull(entity.ZValue);
+
+ Assert.IsNull(entity.SlipPlaneLeftGridXLeft);
+ Assert.IsNull(entity.SlipPlaneLeftGridXRight);
+ Assert.IsNull(entity.SlipPlaneLeftGridZTop);
+ Assert.IsNull(entity.SlipPlaneLeftGridZBottom);
+
+ Assert.IsNull(entity.SlipPlaneRightGridXLeft);
+ Assert.IsNull(entity.SlipPlaneRightGridXRight);
+ Assert.IsNull(entity.SlipPlaneRightGridZTop);
+ Assert.IsNull(entity.SlipPlaneRightGridZBottom);
+
+ Assert.IsNull(entity.SlidingCurveIteratedHorizontalForce);
+ Assert.IsNull(entity.SlidingCurveNonIteratedHorizontalForce);
+
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleCenterX);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleCenterY);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleRadius);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleIteratedForce);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleNonIteratedForce);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleDrivingMoment);
+ Assert.IsNull(entity.SlidingCurveLeftSlidingCircleResistingMoment);
+
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleCenterX);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleCenterY);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleRadius);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleIteratedForce);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleNonIteratedForce);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleDrivingMoment);
+ Assert.IsNull(entity.SlidingCurveRightSlidingCircleResistingMoment);
+ }
+
+ #region Slip Plane Helpers
+
+ private static MacroStabilityInwardsGrid CreateGridWithNaNValues()
+ {
+ return new MacroStabilityInwardsGrid(double.NaN, double.NaN, double.NaN, double.NaN);
+ }
+
+ #endregion
+
+ #region Sliding Curve Helpers
+
+ private static MacroStabilityInwardsSlidingCircle CreateSlidingCircle(int seed)
+ {
+ var random = new Random(seed);
+ return new MacroStabilityInwardsSlidingCircle(new Point2D(random.NextDouble(), random.NextDouble()),
+ random.NextDouble(),
+ random.NextBoolean(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble(),
+ random.NextDouble());
+ }
+
+ private static MacroStabilityInwardsSlidingCircle CreateSlidingCircleWithNaNValues()
+ {
+ var random = new Random(21);
+ return new MacroStabilityInwardsSlidingCircle(new Point2D(double.NaN, double.NaN),
+ double.NaN,
+ random.NextBoolean(),
+ double.NaN,
+ double.NaN,
+ double.NaN,
+ double.NaN);
+ }
+
+ #endregion
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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 Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PreconsolidationStressNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsPreconsolidationStress) null).Create(0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("preconsolidationStress", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+
+ var stress = new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()),
+ new VariationCoefficientLogNormalDistribution
+ {
+ Mean = (RoundedDouble) 0.005,
+ CoefficientOfVariation = random.NextRoundedDouble()
+ });
+ int order = random.Next();
+
+ // Call
+ MacroStabilityInwardsPreconsolidationStressEntity entity = stress.Create(order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(stress.Location.X, entity.CoordinateX);
+ Assert.AreEqual(stress.Location.Y, entity.CoordinateZ);
+
+ VariationCoefficientLogNormalDistribution preconsolidationStressDistribution = stress.Stress;
+ Assert.AreEqual(preconsolidationStressDistribution.Mean, entity.PreconsolidationStressMean,
+ preconsolidationStressDistribution.GetAccuracy());
+ Assert.AreEqual(preconsolidationStressDistribution.CoefficientOfVariation, entity.PreconsolidationStressCoefficientOfVariation,
+ preconsolidationStressDistribution.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_WithNaNValues_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+
+ var stress = new MacroStabilityInwardsPreconsolidationStress(new Point2D(random.NextDouble(), random.NextDouble()),
+ new VariationCoefficientLogNormalDistribution
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ });
+ int order = random.Next();
+
+ // Call
+ MacroStabilityInwardsPreconsolidationStressEntity entity = stress.Create(order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.PreconsolidationStressMean);
+ Assert.IsNull(entity.PreconsolidationStressCoefficientOfVariation);
+ Assert.AreEqual(order, entity.Order);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer1DCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,257 @@
+// 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.Drawing;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilLayer1DCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SoilLayerNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilLayer1D) null).Create(0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("soilLayer", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ var soilLayer = new MacroStabilityInwardsSoilLayer1D(random.NextDouble())
+ {
+ Data =
+ {
+ IsAquifer = random.NextBoolean(),
+ MaterialName = "MaterialName",
+ Color = Color.FromKnownColor(random.NextEnumValue()),
+ UsePop = random.NextBoolean(),
+ ShearStrengthModel = random.NextEnumValue(),
+ AbovePhreaticLevel =
+ {
+ Mean = (RoundedDouble) 0.3,
+ CoefficientOfVariation = (RoundedDouble) 0.2,
+ Shift = (RoundedDouble) 0.1
+ },
+ BelowPhreaticLevel =
+ {
+ Mean = (RoundedDouble) 10,
+ CoefficientOfVariation = (RoundedDouble) 0.5,
+ Shift = (RoundedDouble) 2
+ },
+ Cohesion =
+ {
+ Mean = (RoundedDouble) 10,
+ CoefficientOfVariation = (RoundedDouble) 1
+ },
+ FrictionAngle =
+ {
+ Mean = (RoundedDouble) 12,
+ CoefficientOfVariation = (RoundedDouble) 0.8
+ },
+ ShearStrengthRatio =
+ {
+ Mean = (RoundedDouble) 10,
+ CoefficientOfVariation = (RoundedDouble) 0.6
+ },
+ StrengthIncreaseExponent =
+ {
+ Mean = (RoundedDouble) 11,
+ CoefficientOfVariation = (RoundedDouble) 0.7
+ },
+ Pop =
+ {
+ Mean = (RoundedDouble) 14,
+ CoefficientOfVariation = (RoundedDouble) 0.9
+ }
+ }
+ };
+ int order = random.Next();
+
+ // Call
+ MacroStabilityInwardsSoilLayerOneDEntity entity = soilLayer.Create(order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(soilLayer.Top, entity.Top);
+
+ MacroStabilityInwardsSoilLayerData data = soilLayer.Data;
+ Assert.AreEqual(Convert.ToByte(data.IsAquifer), entity.IsAquifer);
+ Assert.AreEqual(data.MaterialName, entity.MaterialName);
+ Assert.AreEqual(data.Color.ToInt64(), Convert.ToInt64(entity.Color));
+ Assert.AreEqual(Convert.ToByte(data.UsePop), entity.UsePop);
+ Assert.AreEqual(Convert.ToByte(data.ShearStrengthModel), entity.ShearStrengthModel);
+
+ VariationCoefficientLogNormalDistribution abovePhreaticLevelDistribution = data.AbovePhreaticLevel;
+ Assert.AreEqual(abovePhreaticLevelDistribution.Mean, entity.AbovePhreaticLevelMean,
+ abovePhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(abovePhreaticLevelDistribution.CoefficientOfVariation, entity.AbovePhreaticLevelCoefficientOfVariation,
+ abovePhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(abovePhreaticLevelDistribution.Shift, entity.AbovePhreaticLevelShift,
+ abovePhreaticLevelDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution belowPhreaticLevelDistribution = data.BelowPhreaticLevel;
+ Assert.AreEqual(belowPhreaticLevelDistribution.Mean, entity.BelowPhreaticLevelMean,
+ belowPhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(belowPhreaticLevelDistribution.CoefficientOfVariation, entity.BelowPhreaticLevelCoefficientOfVariation,
+ belowPhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(belowPhreaticLevelDistribution.Shift, entity.BelowPhreaticLevelShift,
+ belowPhreaticLevelDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution cohesionDistribution = data.Cohesion;
+ Assert.AreEqual(cohesionDistribution.Mean, entity.CohesionMean,
+ cohesionDistribution.GetAccuracy());
+ Assert.AreEqual(cohesionDistribution.CoefficientOfVariation, entity.CohesionCoefficientOfVariation,
+ cohesionDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution frictionAngleDistribution = data.FrictionAngle;
+ Assert.AreEqual(frictionAngleDistribution.Mean, entity.FrictionAngleMean,
+ frictionAngleDistribution.GetAccuracy());
+ Assert.AreEqual(frictionAngleDistribution.CoefficientOfVariation, entity.FrictionAngleCoefficientOfVariation,
+ frictionAngleDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution shearStrengthRatioDistribution = data.ShearStrengthRatio;
+ Assert.AreEqual(shearStrengthRatioDistribution.Mean, entity.ShearStrengthRatioMean,
+ shearStrengthRatioDistribution.GetAccuracy());
+ Assert.AreEqual(shearStrengthRatioDistribution.CoefficientOfVariation, entity.ShearStrengthRatioCoefficientOfVariation,
+ shearStrengthRatioDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution strengthIncreaseExponentDistribution = data.StrengthIncreaseExponent;
+ Assert.AreEqual(strengthIncreaseExponentDistribution.Mean, entity.StrengthIncreaseExponentMean,
+ strengthIncreaseExponentDistribution.GetAccuracy());
+ Assert.AreEqual(strengthIncreaseExponentDistribution.CoefficientOfVariation, entity.StrengthIncreaseExponentCoefficientOfVariation,
+ strengthIncreaseExponentDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution popDistribution = data.Pop;
+ Assert.AreEqual(popDistribution.Mean, entity.PopMean, popDistribution.GetAccuracy());
+ Assert.AreEqual(popDistribution.CoefficientOfVariation, entity.PopCoefficientOfVariation, popDistribution.GetAccuracy());
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_WithNaNProperties_ReturnsEntityWithPropertiesSetToNull()
+ {
+ // Setup
+ var soilLayer = new MacroStabilityInwardsSoilLayer1D(double.NaN)
+ {
+ Data =
+ {
+ AbovePhreaticLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN,
+ Shift = RoundedDouble.NaN
+ },
+ BelowPhreaticLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN,
+ Shift = RoundedDouble.NaN
+ },
+ Cohesion =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ FrictionAngle =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ ShearStrengthRatio =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ StrengthIncreaseExponent =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ Pop =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ }
+ }
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayerOneDEntity entity = soilLayer.Create(0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.Top);
+ Assert.IsNull(entity.AbovePhreaticLevelMean);
+ Assert.IsNull(entity.AbovePhreaticLevelCoefficientOfVariation);
+ Assert.IsNull(entity.AbovePhreaticLevelShift);
+ Assert.IsNull(entity.BelowPhreaticLevelMean);
+ Assert.IsNull(entity.BelowPhreaticLevelCoefficientOfVariation);
+ Assert.IsNull(entity.BelowPhreaticLevelShift);
+ Assert.IsNull(entity.CohesionMean);
+ Assert.IsNull(entity.CohesionCoefficientOfVariation);
+ Assert.IsNull(entity.FrictionAngleMean);
+ Assert.IsNull(entity.FrictionAngleCoefficientOfVariation);
+ Assert.IsNull(entity.ShearStrengthRatioMean);
+ Assert.IsNull(entity.ShearStrengthRatioCoefficientOfVariation);
+ Assert.IsNull(entity.StrengthIncreaseExponentMean);
+ Assert.IsNull(entity.StrengthIncreaseExponentCoefficientOfVariation);
+ Assert.IsNull(entity.PopMean);
+ Assert.IsNull(entity.PopCoefficientOfVariation);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string materialName = "MaterialName";
+ var soilLayer = new MacroStabilityInwardsSoilLayer1D(0)
+ {
+ Data =
+ {
+ MaterialName = materialName
+ }
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayerOneDEntity entity = soilLayer.Create(0);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(materialName, entity.MaterialName);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilLayer2DCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,306 @@
+// 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.Drawing;
+using System.Linq;
+using Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.MacroStabilityInwards.Primitives.TestUtil;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilLayer2DCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SoilLayerNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilLayer2D) null).Create(0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("soilLayer", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ MacroStabilityInwardsSoilLayer2D soilLayer = CreateMacroStabilityInwardsSoilLayer2D();
+ int order = random.Next();
+
+ // Call
+ MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(order);
+
+ // Assert
+ AssertMacroStabilityInwardsSoilLayerTwoDEntity(soilLayer, entity, order);
+ }
+
+ [Test]
+ public void Create_WithNestedLayers_ReturnsEntityWithNestedLayersSet()
+ {
+ // Setup
+ MacroStabilityInwardsSoilLayer2D parentLayer = MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(new[]
+ {
+ CreateMacroStabilityInwardsSoilLayer2D(),
+ CreateMacroStabilityInwardsSoilLayer2D(),
+ CreateMacroStabilityInwardsSoilLayer2D()
+ });
+
+ // Call
+ MacroStabilityInwardsSoilLayerTwoDEntity entity = parentLayer.Create(0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(parentLayer.NestedLayers.Count(), entity.MacroStabilityInwardsSoilLayerTwoDEntity1.Count);
+
+ for (var i = 0; i < parentLayer.NestedLayers.Count(); i++)
+ {
+ AssertMacroStabilityInwardsSoilLayerTwoDEntity(parentLayer.NestedLayers.ElementAt(i),
+ entity.MacroStabilityInwardsSoilLayerTwoDEntity1.ElementAt(i),
+ i);
+ }
+ }
+
+ [Test]
+ public void Create_WithNaNProperties_ReturnsEntityWithPropertiesSetToNull()
+ {
+ // Setup
+ var soilLayer = new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
+ {
+ Data =
+ {
+ AbovePhreaticLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN,
+ Shift = RoundedDouble.NaN
+ },
+ BelowPhreaticLevel =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN,
+ Shift = RoundedDouble.NaN
+ },
+ Cohesion =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ FrictionAngle =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ ShearStrengthRatio =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ StrengthIncreaseExponent =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ },
+ Pop =
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ }
+ }
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.AbovePhreaticLevelMean);
+ Assert.IsNull(entity.AbovePhreaticLevelCoefficientOfVariation);
+ Assert.IsNull(entity.AbovePhreaticLevelShift);
+ Assert.IsNull(entity.BelowPhreaticLevelMean);
+ Assert.IsNull(entity.BelowPhreaticLevelCoefficientOfVariation);
+ Assert.IsNull(entity.BelowPhreaticLevelShift);
+ Assert.IsNull(entity.CohesionMean);
+ Assert.IsNull(entity.CohesionCoefficientOfVariation);
+ Assert.IsNull(entity.FrictionAngleMean);
+ Assert.IsNull(entity.FrictionAngleCoefficientOfVariation);
+ Assert.IsNull(entity.ShearStrengthRatioMean);
+ Assert.IsNull(entity.ShearStrengthRatioCoefficientOfVariation);
+ Assert.IsNull(entity.StrengthIncreaseExponentMean);
+ Assert.IsNull(entity.StrengthIncreaseExponentCoefficientOfVariation);
+ Assert.IsNull(entity.PopMean);
+ Assert.IsNull(entity.PopCoefficientOfVariation);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string materialName = "MaterialName";
+ var soilLayer = new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
+ {
+ Data =
+ {
+ MaterialName = materialName
+ }
+ };
+
+ // Call
+ MacroStabilityInwardsSoilLayerTwoDEntity entity = soilLayer.Create(0);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(materialName, entity.MaterialName);
+ }
+
+ private static MacroStabilityInwardsSoilLayer2D CreateMacroStabilityInwardsSoilLayer2D()
+ {
+ var random = new Random(14);
+ return new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
+ {
+ Data =
+ {
+ IsAquifer = random.NextBoolean(),
+ MaterialName = "MaterialName",
+ Color = Color.FromKnownColor(random.NextEnumValue()),
+ UsePop = random.NextBoolean(),
+ ShearStrengthModel = random.NextEnumValue(),
+ AbovePhreaticLevel =
+ {
+ Mean = random.NextRoundedDouble(2.0, 3.0),
+ CoefficientOfVariation = random.NextRoundedDouble(),
+ Shift = random.NextRoundedDouble(0.0, 1.0)
+ },
+ BelowPhreaticLevel =
+ {
+ Mean = random.NextRoundedDouble(2.0, 3.0),
+ CoefficientOfVariation = random.NextRoundedDouble(),
+ Shift = random.NextRoundedDouble(0.0, 1.0)
+ },
+ Cohesion =
+ {
+ Mean = random.NextRoundedDouble(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ },
+ FrictionAngle =
+ {
+ Mean = random.NextRoundedDouble(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ },
+ StrengthIncreaseExponent =
+ {
+ Mean = random.NextRoundedDouble(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ },
+ ShearStrengthRatio =
+ {
+ Mean = random.NextRoundedDouble(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ },
+ Pop =
+ {
+ Mean = random.NextRoundedDouble(),
+ CoefficientOfVariation = random.NextRoundedDouble()
+ }
+ }
+ };
+ }
+
+ private static void AssertMacroStabilityInwardsSoilLayerTwoDEntity(MacroStabilityInwardsSoilLayer2D soilLayer,
+ MacroStabilityInwardsSoilLayerTwoDEntity entity, int order)
+ {
+ Assert.IsNotNull(entity);
+
+ MacroStabilityInwardsSoilLayerData data = soilLayer.Data;
+ Assert.AreEqual(Convert.ToByte(data.IsAquifer), entity.IsAquifer);
+ Assert.AreEqual(data.MaterialName, entity.MaterialName);
+ Assert.AreEqual(data.Color.ToInt64(), Convert.ToInt64(entity.Color));
+ Assert.AreEqual(Convert.ToByte(data.UsePop), entity.UsePop);
+ Assert.AreEqual(Convert.ToByte(data.ShearStrengthModel), entity.ShearStrengthModel);
+
+ VariationCoefficientLogNormalDistribution abovePhreaticLevelDistribution = data.AbovePhreaticLevel;
+ Assert.AreEqual(abovePhreaticLevelDistribution.Mean, entity.AbovePhreaticLevelMean,
+ abovePhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(abovePhreaticLevelDistribution.CoefficientOfVariation, entity.AbovePhreaticLevelCoefficientOfVariation,
+ abovePhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(abovePhreaticLevelDistribution.Shift, entity.AbovePhreaticLevelShift,
+ abovePhreaticLevelDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution belowPhreaticLevelDistribution = data.BelowPhreaticLevel;
+ Assert.AreEqual(belowPhreaticLevelDistribution.Mean, entity.BelowPhreaticLevelMean,
+ belowPhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(belowPhreaticLevelDistribution.CoefficientOfVariation, entity.BelowPhreaticLevelCoefficientOfVariation,
+ belowPhreaticLevelDistribution.GetAccuracy());
+ Assert.AreEqual(belowPhreaticLevelDistribution.Shift, entity.BelowPhreaticLevelShift,
+ belowPhreaticLevelDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution cohesionDistribution = data.Cohesion;
+ Assert.AreEqual(cohesionDistribution.Mean, entity.CohesionMean,
+ cohesionDistribution.GetAccuracy());
+ Assert.AreEqual(cohesionDistribution.CoefficientOfVariation, entity.CohesionCoefficientOfVariation,
+ cohesionDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution frictionAngleDistribution = data.FrictionAngle;
+ Assert.AreEqual(frictionAngleDistribution.Mean, entity.FrictionAngleMean,
+ frictionAngleDistribution.GetAccuracy());
+ Assert.AreEqual(frictionAngleDistribution.CoefficientOfVariation, entity.FrictionAngleCoefficientOfVariation,
+ frictionAngleDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution shearStrengthRatioDistribution = data.ShearStrengthRatio;
+ Assert.AreEqual(shearStrengthRatioDistribution.Mean, entity.ShearStrengthRatioMean,
+ shearStrengthRatioDistribution.GetAccuracy());
+ Assert.AreEqual(shearStrengthRatioDistribution.CoefficientOfVariation, entity.ShearStrengthRatioCoefficientOfVariation,
+ shearStrengthRatioDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution strengthIncreaseExponentDistribution = data.StrengthIncreaseExponent;
+ Assert.AreEqual(strengthIncreaseExponentDistribution.Mean, entity.StrengthIncreaseExponentMean,
+ strengthIncreaseExponentDistribution.GetAccuracy());
+ Assert.AreEqual(strengthIncreaseExponentDistribution.CoefficientOfVariation, entity.StrengthIncreaseExponentCoefficientOfVariation,
+ strengthIncreaseExponentDistribution.GetAccuracy());
+
+ VariationCoefficientLogNormalDistribution popDistribution = data.Pop;
+ Assert.AreEqual(popDistribution.Mean, entity.PopMean, popDistribution.GetAccuracy());
+ Assert.AreEqual(popDistribution.CoefficientOfVariation, entity.PopCoefficientOfVariation, popDistribution.GetAccuracy());
+
+ Assert.AreEqual(order, entity.Order);
+
+ AssertOuterRing(soilLayer.OuterRing, entity);
+ CollectionAssert.IsEmpty(entity.MacroStabilityInwardsSoilLayerTwoDEntity1);
+ }
+
+ private static void AssertOuterRing(Ring outerRing, MacroStabilityInwardsSoilLayerTwoDEntity entity)
+ {
+ string expectedOuterRingXml = new Point2DCollectionXmlSerializer().ToXml(outerRing.Points);
+ Assert.AreEqual(expectedOuterRingXml, entity.OuterRingXml);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile1DCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,147 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilProfile1DCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ MacroStabilityInwardsSoilProfile1D soilProfile =
+ MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
+
+ // Call
+ TestDelegate test = () => soilProfile.Create(null);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_SoilProfileNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilProfile1D) null).Create(registry);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("soilProfile", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ const string name = "some name";
+ double bottom = -random.NextDouble();
+ var soilProfile = new MacroStabilityInwardsSoilProfile1D(name, bottom, new[]
+ {
+ new MacroStabilityInwardsSoilLayer1D(random.NextDouble()),
+ new MacroStabilityInwardsSoilLayer1D(random.NextDouble())
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsSoilProfileOneDEntity entity = soilProfile.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(soilProfile.Bottom, entity.Bottom);
+ Assert.AreEqual(soilProfile.Layers.Count(), entity.MacroStabilityInwardsSoilLayerOneDEntities.Count);
+
+ MacroStabilityInwardsSoilLayerOneDEntity firstLayerEntity = entity.MacroStabilityInwardsSoilLayerOneDEntities.ElementAt(0);
+ Assert.AreEqual(soilProfile.Layers.ElementAt(0).Top, firstLayerEntity.Top);
+
+ MacroStabilityInwardsSoilLayerOneDEntity secondLayerEntity = entity.MacroStabilityInwardsSoilLayerOneDEntities.ElementAt(1);
+ Assert.AreEqual(soilProfile.Layers.ElementAt(1).Top, secondLayerEntity.Top);
+ }
+
+ [Test]
+ public void Create_WithNaNProperties_ReturnsEntityWithPropertiesSetToNull()
+ {
+ // Setup
+ var random = new Random(31);
+ var soilProfile = new MacroStabilityInwardsSoilProfile1D("some name", double.NaN, new[]
+ {
+ new MacroStabilityInwardsSoilLayer1D(random.NextDouble())
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsSoilProfileOneDEntity entity = soilProfile.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.IsNull(entity.Bottom);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "some name";
+ MacroStabilityInwardsSoilProfile1D soilProfile =
+ MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(name);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsSoilProfileOneDEntity entity = soilProfile.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(name, entity.Name);
+ }
+
+ [Test]
+ public void GivenCreatedEntity_WhenCreateCalledOnSameObject_ThenSameEntityReturned()
+ {
+ // Given
+ MacroStabilityInwardsSoilProfile1D soilProfile =
+ MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
+ var registry = new PersistenceRegistry();
+
+ MacroStabilityInwardsSoilProfileOneDEntity firstEntity = soilProfile.Create(registry);
+
+ // When
+ MacroStabilityInwardsSoilProfileOneDEntity secondEntity = soilProfile.Create(registry);
+
+ // Then
+ Assert.AreSame(firstEntity, secondEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,154 @@
+// 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.ObjectModel;
+using System.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.MacroStabilityInwards.Primitives.TestUtil;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSoilProfile2DCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ MacroStabilityInwardsSoilProfile2D soilProfile = CreateMacroStabilityInwardsSoilProfile2D();
+
+ // Call
+ TestDelegate test = () => soilProfile.Create(null);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_SoilProfileNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsSoilProfile2D) null).Create(registry);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("soilProfile", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet()
+ {
+ // Setup
+ var soilProfile = new MacroStabilityInwardsSoilProfile2D("some name", new[]
+ {
+ MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D(),
+ MacroStabilityInwardsSoilLayer2DTestFactory.CreateMacroStabilityInwardsSoilLayer2D()
+ }, new[]
+ {
+ MacroStabilityInwardsPreconsolidationStressTestFactory.CreateMacroStabilityInwardsPreconsolidationStress()
+ });
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsSoilProfileTwoDEntity entity = soilProfile.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(soilProfile.Layers.Count(), entity.MacroStabilityInwardsSoilLayerTwoDEntities.Count);
+ Assert.AreEqual(soilProfile.PreconsolidationStresses.Count(), entity.MacroStabilityInwardsPreconsolidationStressEntities.Count);
+
+ AssertPreconsolidationStress(soilProfile.PreconsolidationStresses.First(),
+ entity.MacroStabilityInwardsPreconsolidationStressEntities.First());
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ MacroStabilityInwardsSoilProfile2D soilProfile = CreateMacroStabilityInwardsSoilProfile2D("some name");
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsSoilProfileTwoDEntity entity = soilProfile.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(soilProfile.Name, entity.Name);
+ }
+
+ [Test]
+ public void GivenCreatedEntity_WhenCreateCalledOnSameObject_ThenSameEntityInstanceReturned()
+ {
+ // Given
+ MacroStabilityInwardsSoilProfile2D soilProfile = CreateMacroStabilityInwardsSoilProfile2D();
+ var registry = new PersistenceRegistry();
+
+ MacroStabilityInwardsSoilProfileTwoDEntity firstEntity = soilProfile.Create(registry);
+
+ // When
+ MacroStabilityInwardsSoilProfileTwoDEntity secondEntity = soilProfile.Create(registry);
+
+ // Then
+ Assert.AreSame(firstEntity, secondEntity);
+ }
+
+ private static void AssertPreconsolidationStress(MacroStabilityInwardsPreconsolidationStress preconsolidationStress,
+ MacroStabilityInwardsPreconsolidationStressEntity entity)
+ {
+ Assert.AreEqual(preconsolidationStress.Location.X, entity.CoordinateX);
+ Assert.AreEqual(preconsolidationStress.Location.Y, entity.CoordinateZ);
+
+ VariationCoefficientLogNormalDistribution preconsolidationDistribution = preconsolidationStress.Stress;
+ Assert.AreEqual(preconsolidationDistribution.Mean, entity.PreconsolidationStressMean,
+ preconsolidationDistribution.GetAccuracy());
+ Assert.AreEqual(preconsolidationDistribution.CoefficientOfVariation, entity.PreconsolidationStressCoefficientOfVariation,
+ preconsolidationDistribution.GetAccuracy());
+ }
+
+ private static MacroStabilityInwardsSoilProfile2D CreateMacroStabilityInwardsSoilProfile2D()
+ {
+ return CreateMacroStabilityInwardsSoilProfile2D(string.Empty);
+ }
+
+ private static MacroStabilityInwardsSoilProfile2D CreateMacroStabilityInwardsSoilProfile2D(string name)
+ {
+ var layers = new Collection
+ {
+ new MacroStabilityInwardsSoilLayer2D(RingTestFactory.CreateRandomRing())
+ };
+
+ return new MacroStabilityInwardsSoilProfile2D(name, layers, Enumerable.Empty());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilModelCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilModelCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilModelCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,179 @@
+// 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.Linq;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsStochasticSoilModelCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel();
+
+ // Call
+ TestDelegate test = () => stochasticSoilModel.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+ }
+
+ [Test]
+ public void Create_StochasticSoilModelNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsStochasticSoilModel) null).Create(registry, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("model", parameterName);
+ }
+
+ [Test]
+ public void Create_WithValidProperties_ReturnsStochasticSoilModelEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(1);
+ int order = random.Next();
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel(nameof(MacroStabilityInwardsStochasticSoilModel));
+ var registry = new PersistenceRegistry();
+
+ // Call
+ StochasticSoilModelEntity entity = stochasticSoilModel.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(stochasticSoilModel.Name, entity.Name);
+ Assert.AreEqual(order, entity.Order);
+ CollectionAssert.IsEmpty(entity.PipingStochasticSoilProfileEntities);
+ }
+
+ [Test]
+ public void Create_WithStochasticSoilProfiles_ReturnsStochasticSoilModelEntityWithPropertiesSet()
+ {
+ // Setup
+ var stochasticSoilProfiles = new[]
+ {
+ new MacroStabilityInwardsStochasticSoilProfile(0.1, MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D()),
+ new MacroStabilityInwardsStochasticSoilProfile(0.9, MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D())
+ };
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("Model", stochasticSoilProfiles);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ StochasticSoilModelEntity entity = stochasticSoilModel.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ CollectionAssert.IsEmpty(entity.PipingStochasticSoilProfileEntities);
+ Assert.AreEqual(stochasticSoilProfiles.Length, entity.MacroStabilityInwardsStochasticSoilProfileEntities.Count);
+
+ MacroStabilityInwardsStochasticSoilProfile firstStochasticSoilProfile = stochasticSoilProfiles[0];
+ MacroStabilityInwardsStochasticSoilProfileEntity firstStochasticSoilProfileEntity = entity.MacroStabilityInwardsStochasticSoilProfileEntities.First();
+ Assert.AreEqual(firstStochasticSoilProfile.Probability, firstStochasticSoilProfileEntity.Probability);
+ Assert.IsNotNull(firstStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.IsNull(firstStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
+
+ MacroStabilityInwardsStochasticSoilProfile secondStochasticSoilProfile = stochasticSoilProfiles[1];
+ MacroStabilityInwardsStochasticSoilProfileEntity secondStochasticSoilProfileEntity = entity.MacroStabilityInwardsStochasticSoilProfileEntities.ElementAt(1);
+ Assert.AreEqual(secondStochasticSoilProfile.Probability, secondStochasticSoilProfileEntity.Probability);
+ Assert.IsNull(secondStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.IsNotNull(secondStochasticSoilProfileEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
+ }
+
+ [Test]
+ public void Create_WithGeometryPoints_ReturnsStochasticSoilModelEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel("testName", new[]
+ {
+ new Point2D(random.NextDouble(), random.NextDouble()),
+ new Point2D(random.NextDouble(), random.NextDouble())
+ });
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ StochasticSoilModelEntity entity = stochasticSoilModel.Create(registry, 0);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ string expectedXml = new Point2DCollectionXmlSerializer().ToXml(stochasticSoilModel.Geometry);
+ Assert.AreEqual(expectedXml, entity.StochasticSoilModelSegmentPointXml);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string name = "testName";
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel =
+ MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel(name);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ StochasticSoilModelEntity entity = stochasticSoilModel.Create(registry, 0);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(name, entity.Name);
+ }
+
+ [Test]
+ public void GivenCreatedEntity_WhenCreateCalledOnSameObject_ThenSameEntityInstanceReturned()
+ {
+ // Given
+ MacroStabilityInwardsStochasticSoilModel stochasticSoilModel = MacroStabilityInwardsStochasticSoilModelTestFactory.CreateValidStochasticSoilModel();
+ var registry = new PersistenceRegistry();
+
+ StochasticSoilModelEntity firstEntity = stochasticSoilModel.Create(registry, 0);
+
+ // When
+ StochasticSoilModelEntity secondEntity = stochasticSoilModel.Create(registry, 0);
+
+ // Then
+ Assert.AreSame(firstEntity, secondEntity);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,209 @@
+// 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 NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.MacroStabilityInwards.Data.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil.SoilProfile;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsStochasticSoilProfileCreateExtensionsTest
+ {
+ [Test]
+ public void Create_StochasticSoilProfileNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => ((MacroStabilityInwardsStochasticSoilProfile) null).Create(registry, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("stochasticSoilProfile", parameterName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var mockRepository = new MockRepository();
+ var soilProfile = mockRepository.Stub>();
+ mockRepository.ReplayAll();
+
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0, soilProfile);
+
+ // Call
+ TestDelegate test = () => stochasticSoilProfile.Create(null, 0);
+
+ // Assert
+ string parameterName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", parameterName);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void Create_WithUnsupportedSoilProfile_ThrowsNotSupportedException()
+ {
+ // Setup
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.5, new UnsupportedMacroStabilityInwardsSoilProfile());
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate test = () => stochasticSoilProfile.Create(registry, 1);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual($"{nameof(UnsupportedMacroStabilityInwardsSoilProfile)} is not supported. " +
+ $"Supported types are: {nameof(MacroStabilityInwardsSoilProfile1D)} and {nameof(MacroStabilityInwardsSoilProfile2D)}.", exception.Message);
+ }
+
+ [Test]
+ public void Create_WithMacroStabilityInwardsSoilProfile1D_ReturnsStochasticSoilProfileEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ MacroStabilityInwardsSoilProfile1D soilProfile =
+ MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D(nameof(MacroStabilityInwardsSoilProfile1D));
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+
+ int order = random.Next();
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfileEntity entity = stochasticSoilProfile.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(stochasticSoilProfile.Probability, entity.Probability);
+ Assert.AreEqual(soilProfile.Name, entity.MacroStabilityInwardsSoilProfileOneDEntity.Name);
+ Assert.IsNull(entity.MacroStabilityInwardsSoilProfileTwoDEntity);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_WithMacroStabilityInwardsSoilProfile2D_ReturnsStochasticSoilProfileEntityWithPropertiesSet()
+ {
+ // Setup
+ var random = new Random(31);
+ MacroStabilityInwardsSoilProfile2D soilProfile =
+ MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D();
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+
+ int order = random.Next();
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfileEntity entity = stochasticSoilProfile.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(stochasticSoilProfile.Probability, entity.Probability);
+ Assert.IsNull(entity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.AreEqual(soilProfile.Name, entity.MacroStabilityInwardsSoilProfileTwoDEntity.Name);
+ Assert.AreEqual(order, entity.Order);
+ }
+
+ [Test]
+ public void Create_DifferentStochasticSoilProfilesWithSameMacroStabilityInwardsSoilProfile1D_ReturnsEntityWithSameSoilProfileEntitySet()
+ {
+ // Setup
+ var random = new Random(31);
+
+ MacroStabilityInwardsSoilProfile1D soilProfile = MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
+ var firstStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+ var secondStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+ var registry = new PersistenceRegistry();
+
+ MacroStabilityInwardsStochasticSoilProfileEntity firstEntity = firstStochasticSoilProfile.Create(registry, 0);
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfileEntity secondEntity = secondStochasticSoilProfile.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(firstEntity.MacroStabilityInwardsSoilProfileOneDEntity, secondEntity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.IsNull(firstEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
+ Assert.IsNull(secondEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
+ }
+
+ [Test]
+ public void Create_DifferentStochasticSoilProfilesWithSameMacroStabilityInwardsSoilProfile2D_ReturnsEntityWithSameSoilProfileEntitySet()
+ {
+ // Setup
+ var random = new Random(31);
+
+ MacroStabilityInwardsSoilProfile2D soilProfile = MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D();
+ var firstStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+ var secondStochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(random.NextDouble(), soilProfile);
+ var registry = new PersistenceRegistry();
+
+ MacroStabilityInwardsStochasticSoilProfileEntity firstEntity = firstStochasticSoilProfile.Create(registry, 0);
+
+ // Call
+ MacroStabilityInwardsStochasticSoilProfileEntity secondEntity = secondStochasticSoilProfile.Create(registry, 0);
+
+ // Assert
+ Assert.IsNull(firstEntity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.IsNull(secondEntity.MacroStabilityInwardsSoilProfileOneDEntity);
+ Assert.AreSame(firstEntity.MacroStabilityInwardsSoilProfileTwoDEntity, secondEntity.MacroStabilityInwardsSoilProfileTwoDEntity);
+ }
+
+ [Test]
+ [TestCaseSource(nameof(GetMacroStabilityInwardsSoilProfiles))]
+ public void GivenCreatedEntity_WhenCreateCalledOnSameObject_ThenSameEntityInstanceReturned(IMacroStabilityInwardsSoilProfile soilProfile)
+ {
+ // Given
+ var stochasticSoilProfile = new MacroStabilityInwardsStochasticSoilProfile(0.4, soilProfile);
+ var registry = new PersistenceRegistry();
+
+ MacroStabilityInwardsStochasticSoilProfileEntity entity1 = stochasticSoilProfile.Create(registry, 0);
+
+ // When
+ MacroStabilityInwardsStochasticSoilProfileEntity entity2 = stochasticSoilProfile.Create(registry, 0);
+
+ // Then
+ Assert.AreSame(entity1, entity2);
+ }
+
+ private class UnsupportedMacroStabilityInwardsSoilProfile : IMacroStabilityInwardsSoilProfile
+ {
+ public string Name { get; }
+ public IEnumerable Layers { get; }
+ }
+
+ private static IEnumerable> GetMacroStabilityInwardsSoilProfiles()
+ {
+ yield return MacroStabilityInwardsSoilProfile1DTestFactory.CreateMacroStabilityInwardsSoilProfile1D();
+ yield return MacroStabilityInwardsSoilProfile2DTestFactory.CreateMacroStabilityInwardsSoilProfile2D();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSurfaceLineCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSurfaceLineCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacroStabilityInwards/MacroStabilityInwardsSurfaceLineCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,367 @@
+// 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.Linq;
+using Core.Common.Base.Geometry;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityInwards;
+using Riskeer.Storage.Core.DbContext;
+using Riskeer.Storage.Core.Serializers;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityInwards
+{
+ [TestFixture]
+ public class MacroStabilityInwardsSurfaceLineCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SurfaceLineNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+
+ // Call
+ TestDelegate call = () => ((MacroStabilityInwardsSurfaceLine) null).Create(registry, 0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("surfaceLine", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty);
+
+ // Call
+ TestDelegate call = () => surfaceLine.Create(null, 0);
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("registry", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_SurfaceLineWithoutGeometry_ReturnSurfaceLineEntityWithoutAddingPointEntities()
+ {
+ // Setup
+ var random = new Random(31);
+ var registry = new PersistenceRegistry();
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test")
+ {
+ ReferenceLineIntersectionWorldPoint = GetRandomPoint2D(random)
+ };
+ int order = random.Next();
+
+ // Call
+ SurfaceLineEntity entity = surfaceLine.Create(registry, order);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+ Assert.AreEqual(order, entity.Order);
+
+ string expectedXml = new Point3DCollectionXmlSerializer().ToXml(new Point3D[0]);
+ Assert.AreEqual(expectedXml, entity.PointsXml);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ var registry = new PersistenceRegistry();
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test");
+
+ // Call
+ SurfaceLineEntity entity = surfaceLine.Create(registry, 0);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(surfaceLine.Name, entity.Name);
+ }
+
+ [Test]
+ public void Create_SurfaceLineWithGeometryWithoutCharacteristicPoints_ReturnSurfaceLineEntityWithPointEntities()
+ {
+ // Setup
+ var random = new Random(31);
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test")
+ {
+ ReferenceLineIntersectionWorldPoint = GetRandomPoint2D(random)
+ };
+ surfaceLine.SetGeometry(new[]
+ {
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random)
+ });
+
+ var registry = new PersistenceRegistry();
+ int order = random.Next();
+
+ // Call
+ SurfaceLineEntity entity = surfaceLine.Create(registry, order);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+ Assert.AreEqual(order, entity.Order);
+
+ string expectedXml = new Point3DCollectionXmlSerializer().ToXml(surfaceLine.Points);
+ Assert.AreEqual(expectedXml, entity.PointsXml);
+ }
+
+ [Test]
+ public void Create_SurfaceLineWithGeometryAndCharacteristicPoints_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences()
+ {
+ // Setup
+ var random = new Random(31);
+ Point3D[] geometry =
+ {
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random),
+ GetRandomPoint3D(random)
+ };
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test")
+ {
+ ReferenceLineIntersectionWorldPoint = GetRandomPoint2D(random)
+ };
+ surfaceLine.SetGeometry(geometry);
+
+ const int surfaceLevelOutsideIndex = 1;
+ surfaceLine.SetSurfaceLevelOutsideAt(geometry[surfaceLevelOutsideIndex]);
+ const int dikeTopAtPolderIndex = 2;
+ surfaceLine.SetDikeTopAtPolderAt(geometry[dikeTopAtPolderIndex]);
+ const int dikeTopAtRiverIndex = 3;
+ surfaceLine.SetDikeTopAtRiverAt(geometry[dikeTopAtRiverIndex]);
+ const int shoulderBaseInsideIndex = 4;
+ surfaceLine.SetShoulderBaseInsideAt(geometry[shoulderBaseInsideIndex]);
+ const int shoulderTopInsideIndex = 5;
+ surfaceLine.SetShoulderTopInsideAt(geometry[shoulderTopInsideIndex]);
+ const int bottomDitchDikeSideIndex = 6;
+ surfaceLine.SetBottomDitchDikeSideAt(geometry[bottomDitchDikeSideIndex]);
+ const int bottomDitchPolderSideIndex = 7;
+ surfaceLine.SetBottomDitchPolderSideAt(geometry[bottomDitchPolderSideIndex]);
+ const int dikeToeAtPolderIndex = 8;
+ surfaceLine.SetDikeToeAtPolderAt(geometry[dikeToeAtPolderIndex]);
+ const int dikeToeAtRiverIndex = 9;
+ surfaceLine.SetDikeToeAtRiverAt(geometry[dikeToeAtRiverIndex]);
+ const int ditchDikeSideIndex = 10;
+ surfaceLine.SetDitchDikeSideAt(geometry[ditchDikeSideIndex]);
+ const int ditchPolderSideIndex = 11;
+ surfaceLine.SetDitchPolderSideAt(geometry[ditchPolderSideIndex]);
+ const int surfaceLevelInsideIndex = 12;
+ surfaceLine.SetSurfaceLevelInsideAt(geometry[surfaceLevelInsideIndex]);
+
+ var registry = new PersistenceRegistry();
+
+ // Call
+ SurfaceLineEntity entity = surfaceLine.Create(registry, 0);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ string expectedXml = new Point3DCollectionXmlSerializer().ToXml(geometry);
+ Assert.AreEqual(expectedXml, entity.PointsXml);
+
+ Assert.AreEqual(12, entity.MacroStabilityInwardsCharacteristicPointEntities.Count);
+ foreach (MacroStabilityInwardsCharacteristicPointEntity characteristicPointEntity in entity.MacroStabilityInwardsCharacteristicPointEntities)
+ {
+ switch (characteristicPointEntity.Type)
+ {
+ case (byte) MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside:
+ Assert.AreEqual(geometry[surfaceLevelOutsideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[surfaceLevelOutsideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[surfaceLevelOutsideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder:
+ Assert.AreEqual(geometry[dikeTopAtPolderIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[dikeTopAtPolderIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[dikeTopAtPolderIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver:
+ Assert.AreEqual(geometry[dikeTopAtRiverIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[dikeTopAtRiverIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[dikeTopAtRiverIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside:
+ Assert.AreEqual(geometry[shoulderBaseInsideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[shoulderBaseInsideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[shoulderBaseInsideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside:
+ Assert.AreEqual(geometry[shoulderTopInsideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[shoulderTopInsideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[shoulderTopInsideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide:
+ Assert.AreEqual(geometry[bottomDitchDikeSideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[bottomDitchDikeSideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[bottomDitchDikeSideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide:
+ Assert.AreEqual(geometry[bottomDitchPolderSideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[bottomDitchPolderSideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[bottomDitchPolderSideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder:
+ Assert.AreEqual(geometry[dikeToeAtPolderIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[dikeToeAtPolderIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[dikeToeAtPolderIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver:
+ Assert.AreEqual(geometry[dikeToeAtRiverIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[dikeToeAtRiverIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[dikeToeAtRiverIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DitchDikeSide:
+ Assert.AreEqual(geometry[ditchDikeSideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[ditchDikeSideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[ditchDikeSideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.DitchPolderSide:
+ Assert.AreEqual(geometry[ditchPolderSideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[ditchPolderSideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[ditchPolderSideIndex].Z, characteristicPointEntity.Z);
+ break;
+ case (byte) MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside:
+ Assert.AreEqual(geometry[surfaceLevelInsideIndex].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[surfaceLevelInsideIndex].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[surfaceLevelInsideIndex].Z, characteristicPointEntity.Z);
+ break;
+ default:
+ Assert.Fail("Invalid characteristic point type found: {0}", characteristicPointEntity.Type);
+ break;
+ }
+ }
+ }
+
+ [Test]
+ public void Create_SurfaceLineWithCharacteristicPointsOnSameGeometryPoint_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences()
+ {
+ // Setup
+ var random = new Random(31);
+ var registry = new PersistenceRegistry();
+ Point3D[] geometry =
+ {
+ GetRandomPoint3D(random)
+ };
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine("Test")
+ {
+ ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble())
+ };
+ surfaceLine.SetGeometry(geometry);
+ surfaceLine.SetSurfaceLevelOutsideAt(geometry[0]);
+ surfaceLine.SetDikeTopAtPolderAt(geometry[0]);
+ surfaceLine.SetDikeTopAtRiverAt(geometry[0]);
+ surfaceLine.SetShoulderBaseInsideAt(geometry[0]);
+ surfaceLine.SetShoulderTopInsideAt(geometry[0]);
+ surfaceLine.SetBottomDitchDikeSideAt(geometry[0]);
+ surfaceLine.SetBottomDitchPolderSideAt(geometry[0]);
+ surfaceLine.SetDikeToeAtPolderAt(geometry[0]);
+ surfaceLine.SetDikeToeAtRiverAt(geometry[0]);
+ surfaceLine.SetDitchDikeSideAt(geometry[0]);
+ surfaceLine.SetDitchPolderSideAt(geometry[0]);
+ surfaceLine.SetSurfaceLevelInsideAt(geometry[0]);
+
+ // Call
+ SurfaceLineEntity entity = surfaceLine.Create(registry, 0);
+
+ // Assert
+ Assert.AreEqual(surfaceLine.Name, entity.Name);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX);
+ Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY);
+
+ string expectedXml = new Point3DCollectionXmlSerializer().ToXml(geometry);
+ Assert.AreEqual(expectedXml, entity.PointsXml);
+
+ Assert.AreEqual(12, entity.MacroStabilityInwardsCharacteristicPointEntities.Count);
+ CollectionAssert.AreEquivalent(new[]
+ {
+ (byte) MacroStabilityInwardsCharacteristicPointType.SurfaceLevelOutside,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DikeTopAtPolder,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DikeTopAtRiver,
+ (byte) MacroStabilityInwardsCharacteristicPointType.ShoulderBaseInside,
+ (byte) MacroStabilityInwardsCharacteristicPointType.ShoulderTopInside,
+ (byte) MacroStabilityInwardsCharacteristicPointType.BottomDitchDikeSide,
+ (byte) MacroStabilityInwardsCharacteristicPointType.BottomDitchPolderSide,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DikeToeAtPolder,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DikeToeAtRiver,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DitchDikeSide,
+ (byte) MacroStabilityInwardsCharacteristicPointType.DitchPolderSide,
+ (byte) MacroStabilityInwardsCharacteristicPointType.SurfaceLevelInside
+ }, entity.MacroStabilityInwardsCharacteristicPointEntities
+ .Select(cpe => cpe.Type));
+
+ foreach (MacroStabilityInwardsCharacteristicPointEntity characteristicPointEntity in entity.MacroStabilityInwardsCharacteristicPointEntities)
+ {
+ Assert.AreEqual(geometry[0].X, characteristicPointEntity.X);
+ Assert.AreEqual(geometry[0].Y, characteristicPointEntity.Y);
+ Assert.AreEqual(geometry[0].Z, characteristicPointEntity.Z);
+ }
+ }
+
+ [Test]
+ public void Create_CreatingEntityForSameSurfaceLine_ReturnSameEntity()
+ {
+ // Setup
+ var surfaceLine = new MacroStabilityInwardsSurfaceLine(string.Empty);
+ var registry = new PersistenceRegistry();
+
+ // Call
+ SurfaceLineEntity entity1 = surfaceLine.Create(registry, 0);
+ SurfaceLineEntity entity2 = surfaceLine.Create(registry, 0);
+
+ // Assert
+ Assert.AreSame(entity1, entity2);
+ }
+
+ private static Point3D GetRandomPoint3D(Random random)
+ {
+ return new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble());
+ }
+
+ private static Point2D GetRandomPoint2D(Random random)
+ {
+ return new Point2D(random.NextDouble(), random.NextDouble());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.MacroStabilityOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityOutwards
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ public void Create_WithoutAllPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.MacroStabilityOutwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(failureMechanism.IsRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+
+ CollectionAssert.IsEmpty(entity.StochasticSoilModelEntities);
+ MacroStabilityOutwardsFailureMechanismMetaEntity failureMechanismMetaEntity = entity.MacroStabilityOutwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A, failureMechanismMetaEntity.A);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var random = new Random(31);
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ },
+ MacroStabilityOutwardsProbabilityAssessmentInput =
+ {
+ A = random.NextDouble()
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.MacroStabilityOutwards, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ MacroStabilityOutwardsFailureMechanismMetaEntity failureMechanismMetaEntity = entity.MacroStabilityOutwardsFailureMechanismMetaEntities.First();
+ Assert.AreEqual(failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A, failureMechanismMetaEntity.A);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(originalInput, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(originalOutput, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(originalNotRelevantText, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSection/File/Path";
+ var failureMechanism = new MacroStabilityOutwardsFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacroStabilityOutwardsSectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/MacrostabilityOutwards/MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,102 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Riskeer.Storage.Core.Create.MacroStabilityOutwards;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.MacroStabilityOutwards
+{
+ [TestFixture]
+ public class MacroStabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((MacroStabilityOutwardsFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ double detailedAssessmentProbability = random.NextDouble();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ double tailorMadeAssessmentProbability = random.NextDouble();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue();
+
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ SimpleAssessmentResult = simpleAssessmentResult,
+ DetailedAssessmentResult = detailedAssessmentResult,
+ DetailedAssessmentProbability = detailedAssessmentProbability,
+ TailorMadeAssessmentResult = tailorMadeAssessmentResult,
+ TailorMadeAssessmentProbability = tailorMadeAssessmentProbability,
+ UseManualAssembly = useManualAssembly,
+ ManualAssemblyCategoryGroup = manualAssemblyCategoryGroup
+ };
+
+ // Call
+ MacroStabilityOutwardsSectionResultEntity entity = sectionResult.Create();
+
+ // Assert
+ Assert.AreEqual(Convert.ToByte(simpleAssessmentResult), entity.SimpleAssessmentResult);
+ Assert.AreEqual(Convert.ToByte(detailedAssessmentResult), entity.DetailedAssessmentResult);
+ Assert.AreEqual(detailedAssessmentProbability, entity.DetailedAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(tailorMadeAssessmentResult), entity.TailorMadeAssessmentResult);
+ Assert.AreEqual(tailorMadeAssessmentProbability, entity.TailorMadeAssessmentProbability);
+ Assert.AreEqual(Convert.ToByte(useManualAssembly), entity.UseManualAssembly);
+ Assert.AreEqual(Convert.ToByte(manualAssemblyCategoryGroup), entity.ManualAssemblyCategoryGroup);
+ }
+
+ [Test]
+ public void Create_WithNaNProbabilities_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var sectionResult = new MacroStabilityOutwardsFailureMechanismSectionResult(FailureMechanismSectionTestFactory.CreateFailureMechanismSection())
+ {
+ DetailedAssessmentProbability = double.NaN,
+ TailorMadeAssessmentProbability = double.NaN
+ };
+
+ // Call
+ MacroStabilityOutwardsSectionResultEntity result = sectionResult.Create();
+
+ // Assert
+ Assert.IsNull(result.DetailedAssessmentProbability);
+ Assert.IsNull(result.TailorMadeAssessmentProbability);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,154 @@
+// 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.Linq;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Integration.Data.StandAlone;
+using Riskeer.Storage.Core.Create;
+using Riskeer.Storage.Core.Create.Microstability;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.Microstability
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismCreateExtensionsTest
+ {
+ [Test]
+ public void Create_PersistenceRegistryNull_ThrowsArgumentNullException()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ // Call
+ TestDelegate test = () => failureMechanism.Create(null);
+
+ // Assert
+ string paramName = Assert.Throws(test).ParamName;
+ Assert.AreEqual("registry", paramName);
+ }
+
+ [Test]
+ [TestCase(true)]
+ [TestCase(false)]
+ public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant)
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ IsRelevant = isRelevant,
+ InputComments =
+ {
+ Body = "Some input text"
+ },
+ OutputComments =
+ {
+ Body = "Some output text"
+ },
+ NotRelevantComments =
+ {
+ Body = "Really not relevant"
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ Assert.IsNotNull(entity);
+ Assert.AreEqual((short) FailureMechanismType.Microstability, entity.FailureMechanismType);
+ Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant);
+ Assert.AreEqual(failureMechanism.InputComments.Body, entity.InputComments);
+ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments);
+ Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_StringPropertiesDoNotShareReference()
+ {
+ // Setup
+ const string originalInput = "Some input text";
+ const string originalOutput = "Some output text";
+ const string originalNotRelevantText = "Really not relevant";
+ var failureMechanism = new MicrostabilityFailureMechanism
+ {
+ InputComments =
+ {
+ Body = originalInput
+ },
+ OutputComments =
+ {
+ Body = originalOutput
+ },
+ NotRelevantComments =
+ {
+ Body = originalNotRelevantText
+ }
+ };
+ var registry = new PersistenceRegistry();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(registry);
+
+ // Assert
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.InputComments.Body, entity.InputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.OutputComments.Body, entity.OutputComments);
+ TestHelper.AssertAreEqualButNotSame(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments);
+ }
+
+ [Test]
+ public void Create_WithoutSections_EmptyFailureMechanismSectionEntities()
+ {
+ // Setup
+ var failureMechanism = new MicrostabilityFailureMechanism();
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ CollectionAssert.IsEmpty(entity.FailureMechanismSectionEntities);
+ Assert.IsNull(entity.FailureMechanismSectionCollectionSourcePath);
+ }
+
+ [Test]
+ public void Create_WithSections_FailureMechanismSectionEntitiesCreated()
+ {
+ // Setup
+ const string filePath = "failureMechanismSections/File/Path";
+ var failureMechanism = new MicrostabilityFailureMechanism();
+ failureMechanism.SetSections(new[]
+ {
+ FailureMechanismSectionTestFactory.CreateFailureMechanismSection()
+ }, filePath);
+
+ // Call
+ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry());
+
+ // Assert
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count);
+ Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MicrostabilitySectionResultEntities).Count());
+ TestHelper.AssertAreEqualButNotSame(filePath, entity.FailureMechanismSectionCollectionSourcePath);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs
===================================================================
diff -u
--- Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0)
+++ Ringtoets/Storage/test/Riskeer.Storage.Core.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (revision 2d850ad8de01dd4896ada4999d18f787165ce644)
@@ -0,0 +1,78 @@
+// 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 Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.Primitives;
+using Ringtoets.Integration.Data.StandAlone.SectionResults;
+using Riskeer.Storage.Core.Create.Microstability;
+using Riskeer.Storage.Core.DbContext;
+
+namespace Riskeer.Storage.Core.Test.Create.Microstability
+{
+ [TestFixture]
+ public class MicrostabilityFailureMechanismSectionResultCreateExtensionsTest
+ {
+ [Test]
+ public void Create_SectionResultNull_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => ((MicrostabilityFailureMechanismSectionResult) null).Create();
+
+ // Assert
+ var exception = Assert.Throws(call);
+ Assert.AreEqual("result", exception.ParamName);
+ }
+
+ [Test]
+ public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults()
+ {
+ // Setup
+ var random = new Random(39);
+ var simpleAssessmentResult = random.NextEnumValue();
+ var detailedAssessmentResult = random.NextEnumValue();
+ var tailorMadeAssessmentResult = random.NextEnumValue();
+ bool useManualAssembly = random.NextBoolean();
+ var manualAssemblyCategoryGroup = random.NextEnumValue