Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -r96a8dc21967335724f15f4606e7403057478164c -rb19067a9e44fb765a082ccc252bc786827b9e350 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 96a8dc21967335724f15f4606e7403057478164c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision b19067a9e44fb765a082ccc252bc786827b9e350) @@ -299,6 +299,34 @@ } [Test] + public void ReadAsPipingFailureMechanism_WithoutStochasticSoilModelsWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() + { + // Setup + const string sourcePath = "some/Path"; + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + PipingFailureMechanismMetaEntities = + { + new PipingFailureMechanismMetaEntity + { + StochasticSoilModelCollectionSourcePath = sourcePath + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new PipingFailureMechanism(); + + // Call + entity.ReadAsPipingFailureMechanism(failureMechanism, collector); + + // Assert + StochasticSoilModelCollection stochasticSoilModels = failureMechanism.StochasticSoilModels; + Assert.AreEqual(sourcePath, stochasticSoilModels.SourcePath); + CollectionAssert.IsEmpty(stochasticSoilModels); + } + + [Test] public void ReadAsPipingFailureMechanism_WithStochasticSoilModelsSet_ReturnsNewPipingFailureMechanismWithStochasticSoilModelsSet() { // Setup @@ -347,6 +375,34 @@ } [Test] + public void ReadAsPipingFailureMechanism_WithoutSurfaceLinesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() + { + // Setup + const string sourcePath = "some/path"; + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + PipingFailureMechanismMetaEntities = + { + new PipingFailureMechanismMetaEntity + { + SurfaceLineCollectionSourcePath = sourcePath + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new PipingFailureMechanism(); + + // Call + entity.ReadAsPipingFailureMechanism(failureMechanism, collector); + + // Assert + RingtoetsPipingSurfaceLineCollection surfaceLines = failureMechanism.SurfaceLines; + Assert.AreEqual(sourcePath, surfaceLines.SourcePath); + CollectionAssert.IsEmpty(surfaceLines); + } + + [Test] public void ReadAsPipingFailureMechanism_WithSurfaceLines_ReturnsNewPipingFailureMechanismWithSurfaceLinesSet() { // Setup @@ -686,14 +742,44 @@ } [Test] - public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithForeshoreProfiles_ReturnsGrassCoverErosionOutwardsFailureMechanismWithForeshoreProfilesSet() + public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() { // Setup const string fileLocation = "some/path/to/foreshoreProfiles"; var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), + GrassCoverErosionOutwardsFailureMechanismMetaEntities = + { + new GrassCoverErosionOutwardsFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation, + N = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + entity.ReadAsGrassCoverErosionOutwardsFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] + public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithForeshoreProfilesAndSourcePath_ReturnsFailureMechanismWithForeshoreProfilesAndSourcePathSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), ForeshoreProfileEntities = { new ForeshoreProfileEntity @@ -948,13 +1034,42 @@ } [Test] - public void ReadAsStabilityStoneCoverFailureMechanism_WithForeshoreProfiles_ReturnsNewStabilityStoneCoverFailureMechanismWithForeshoreProfilesSet() + public void ReadAsStabilityStoneCoverFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() { // Setup const string fileLocation = "some/path/to/foreshoreProfiles"; + var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + // Call + entity.ReadAsStabilityStoneCoverFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] + public void ReadAsStabilityStoneCoverFailureMechanism_WithForeshoreProfilesAndSourcePath_ReturnsFailureMechanismWithForeshoreProfilesAndSourcePathSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), ForeshoreProfileEntities = { new ForeshoreProfileEntity @@ -1081,14 +1196,43 @@ } [Test] - public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithForeshoreProfiles_ReturnsNewWaveImpactAsphaltCoverFailureMechanismWithForeshoreProfilesSet() + public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() { // Setup const string fileLocation = "some/path/to/foreshoreProfiles"; var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + // Call + entity.ReadAsWaveImpactAsphaltCoverFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] + public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithForeshoreProfilesAndSourcePath_ReturnsFailureMechanismWithForeshoreProfilesAndSourcePathSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), ForeshoreProfileEntities = { new ForeshoreProfileEntity @@ -1173,9 +1317,39 @@ } [Test] - public void ReadAsHeightStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() + public void ReadAsHeightStructuresFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() { // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + HeightStructuresFailureMechanismMetaEntities = + { + new HeightStructuresFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation, + N = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + entity.ReadAsHeightStructuresFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] + public void ReadAsHeightStructuresFailureMechanism_WithForeshoreProfilesAndSourcePath_ReturnFailureMechanismWithForeshoreProfilesAndSourcePathSet() + { + // Setup const int generalInputN = 7; const string fileLocation = "some/location/to/foreshoreProfiles"; @@ -1343,6 +1517,36 @@ } [Test] + public void ReadAsClosingStructuresFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + ClosingStructuresFailureMechanismMetaEntities = + { + new ClosingStructuresFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation, + N2A = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new ClosingStructuresFailureMechanism(); + + // Call + entity.ReadAsClosingStructuresFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] public void ReadAsClosingStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup @@ -1536,6 +1740,36 @@ } [Test] + public void ReadAsStabilityPointStructuresFailureMechanism_WithoutForeshoreProfilesWithSourcePath_ReturnsFailureMechanismWithSourcePathSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + StabilityPointStructuresFailureMechanismMetaEntities = + { + new StabilityPointStructuresFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation, + N = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + // Call + entity.ReadAsStabilityPointStructuresFailureMechanism(failureMechanism, collector); + + // Assert + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + CollectionAssert.IsEmpty(foreshoreProfiles); + } + + [Test] public void ReadAsStabilityPointStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup