Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r755360927a67d206d503b10e0d4c40d5426c4a3b -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 755360927a67d206d503b10e0d4c40d5426c4a3b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -63,22 +63,19 @@ - - Code - Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs (.../ClosingStructuresFailureMechanismCreateExtensions.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs (.../ClosingStructuresFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.DikeProfiles; @@ -44,7 +45,7 @@ FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.ReliabilityClosingOfStructure, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); AddEntitiesForClosingStructures(mechanism.ClosingStructures, entity, registry); - AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); + AddEntitiesForFailureMechanismMeta(mechanism, entity); entity.CalculationGroupEntity = mechanism.CalculationsGroup.Create(registry, 0); AddEntitiesForSectionResults(mechanism.SectionResults, registry); @@ -87,9 +88,15 @@ } } - private static void AddEntitiesForFailureMechanismMeta(GeneralClosingStructuresInput generalInput, FailureMechanismEntity entity) + private static void AddEntitiesForFailureMechanismMeta(ClosingStructuresFailureMechanism failureMechanism, + FailureMechanismEntity entity) { - entity.ClosingStructuresFailureMechanismMetaEntities.Add(generalInput.Create()); + var metaEntity = new ClosingStructuresFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = failureMechanism.ForeshoreProfiles.SourcePath.DeepClone(), + N2A = failureMechanism.GeneralInput.N2A + }; + entity.ClosingStructuresFailureMechanismMetaEntities.Add(metaEntity); } } } \ No newline at end of file Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GeneralGrassCoverErosionOutwardsInputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -23,6 +23,7 @@ using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; using Core.Common.Base; +using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.GrassCoverErosionOutwards.Data; @@ -45,15 +46,18 @@ { FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.GrassRevetmentErosionOutwards, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); - AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); + AddEntitiesForFailureMechanismMeta(mechanism, entity); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); AddEntitiesForHydraulicBoundaryLocations(mechanism.HydraulicBoundaryLocations, entity, registry); entity.CalculationGroupEntity = mechanism.WaveConditionsCalculationGroup.Create(registry, 0); return entity; } - private static void AddEntitiesForHydraulicBoundaryLocations(ObservableList hydraulicBoundaryLocations, FailureMechanismEntity entity, PersistenceRegistry registry) + private static void AddEntitiesForHydraulicBoundaryLocations( + ObservableList hydraulicBoundaryLocations, + FailureMechanismEntity entity, + PersistenceRegistry registry) { var i = 0; foreach (HydraulicBoundaryLocation location in hydraulicBoundaryLocations) @@ -62,9 +66,16 @@ } } - private static void AddEntitiesForFailureMechanismMeta(GeneralGrassCoverErosionOutwardsInput generalInput, FailureMechanismEntity entity) + private static void AddEntitiesForFailureMechanismMeta(GrassCoverErosionOutwardsFailureMechanism failureMechanism, + FailureMechanismEntity entity) { - entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Add(generalInput.Create()); + var metaEntity = new GrassCoverErosionOutwardsFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = failureMechanism.ForeshoreProfiles.SourcePath.DeepClone(), + N = failureMechanism.GeneralInput.N + }; + + entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Add(metaEntity); } private static void AddEntitiesForSectionResults( Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -r308f45aac80baf6744776a04e10e3cbaf8c39198 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision 308f45aac80baf6744776a04e10e3cbaf8c39198) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -94,7 +94,8 @@ entity.HeightStructuresFailureMechanismMetaEntities.Add(new HeightStructuresFailureMechanismMetaEntity { N = mechanism.GeneralInput.N, - HeightStructureCollectionSourcePath = mechanism.HeightStructures.SourcePath.DeepClone() + HeightStructureCollectionSourcePath = mechanism.HeightStructures.SourcePath.DeepClone(), + ForeshoreProfileCollectionSourcePath = mechanism.ForeshoreProfiles.SourcePath.DeepClone() }); } } Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs (.../StabilityPointStructuresFailureMechanismCreateExtensions.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs (.../StabilityPointStructuresFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.StabilityPointStructures.Data; @@ -44,7 +45,7 @@ FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.StabilityPointStructures, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); AddEntitiesForStabilityPointStructures(mechanism.StabilityPointStructures, entity, registry); - AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); + AddEntitiesForFailureMechanismMeta(mechanism, entity); entity.CalculationGroupEntity = mechanism.CalculationsGroup.Create(registry, 0); AddEntitiesForSectionResults(mechanism.SectionResults, registry); @@ -87,9 +88,14 @@ } } - private static void AddEntitiesForFailureMechanismMeta(GeneralStabilityPointStructuresInput generalInput, FailureMechanismEntity entity) + private static void AddEntitiesForFailureMechanismMeta(StabilityPointStructuresFailureMechanism generalInput, FailureMechanismEntity entity) { - entity.StabilityPointStructuresFailureMechanismMetaEntities.Add(generalInput.Create()); + var metaEntity = new StabilityPointStructuresFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = generalInput.ForeshoreProfiles.SourcePath.DeepClone(), + N = generalInput.GeneralInput.N + }; + entity.StabilityPointStructuresFailureMechanismMetaEntities.Add(metaEntity); } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs (.../StabilityStoneCoverFailureMechanismCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs (.../StabilityStoneCoverFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.StabilityStoneCover.Data; @@ -43,6 +44,7 @@ { FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.StabilityStoneRevetment, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); + AddEntitiesForFailureMechanismMeta(mechanism, entity); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); entity.CalculationGroupEntity = mechanism.WaveConditionsCalculationGroup.Create(registry, 0); @@ -62,6 +64,17 @@ } } + private static void AddEntitiesForFailureMechanismMeta(StabilityStoneCoverFailureMechanism failureMechanism, + FailureMechanismEntity entity) + { + var metaEntity = new StabilityStoneCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = failureMechanism.ForeshoreProfiles.SourcePath.DeepClone() + }; + + entity.StabilityStoneCoverFailureMechanismMetaEntities.Add(metaEntity); + } + private static void AddEntitiesForForeshoreProfiles( IEnumerable foreshoreProfiles, FailureMechanismEntity entity, Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs =================================================================== diff -u -r3fb0df0ed6e64657154700ee7706e035d5bf99f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs) (revision 3fb0df0ed6e64657154700ee7706e035d5bf99f5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -22,6 +22,7 @@ using System; using System.Collections.Generic; using Application.Ringtoets.Storage.DbContext; +using Core.Common.Utils.Extensions; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.WaveImpactAsphaltCover.Data; @@ -43,6 +44,7 @@ { FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.WaveImpactOnAsphaltRevetment, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); + AddEntitiesForFailureMechanismMeta(mechanism, entity); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); entity.CalculationGroupEntity = mechanism.WaveConditionsCalculationGroup.Create(registry, 0); @@ -61,6 +63,17 @@ } } + private static void AddEntitiesForFailureMechanismMeta(WaveImpactAsphaltCoverFailureMechanism failureMechanism, + FailureMechanismEntity entity) + { + var metaEntity = new WaveImpactAsphaltCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = failureMechanism.ForeshoreProfiles.SourcePath.DeepClone() + }; + + entity.WaveImpactAsphaltCoverFailureMechanismMetaEntities.Add(metaEntity); + } + private static void AddEntitiesForForeshoreProfiles( IEnumerable foreshoreProfiles, FailureMechanismEntity entity, Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r755360927a67d206d503b10e0d4c40d5426c4a3b -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 755360927a67d206d503b10e0d4c40d5426c4a3b) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -87,6 +87,20 @@ } } + private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, + ForeshoreProfileCollection foreshoreProfiles, + string foreshoreProfileSourcePath, + ReadConversionCollector collector) + { + if (entity.ForeshoreProfileEntities.Any()) + { + foreshoreProfiles.AddRange(entity.ForeshoreProfileEntities + .OrderBy(fpe => fpe.Order) + .Select(foreshoreProfileEntity => foreshoreProfileEntity.Read(collector)), + foreshoreProfileSourcePath); + } + } + #region Piping /// @@ -241,14 +255,15 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries could not be found.> internal static void ReadAsHeightStructuresFailureMechanism(this FailureMechanismEntity entity, HeightStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { HeightStructuresFailureMechanismMetaEntity metaEntity = entity.HeightStructuresFailureMechanismMetaEntities.Single(); entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadHeightStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, metaEntity.ForeshoreProfileCollectionSourcePath, collector); entity.ReadHeightStructures(metaEntity, failureMechanism.HeightStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadHeightStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); @@ -400,13 +415,20 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsClosingStructuresFailureMechanism(this FailureMechanismEntity entity, ClosingStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadClosingStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + ClosingStructuresFailureMechanismMetaEntity metaEntity = + entity.ClosingStructuresFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadClosingStructures(failureMechanism.ClosingStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadClosingStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); @@ -520,14 +542,18 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when the expected table entries could not be found. internal static void ReadAsWaveImpactAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, WaveImpactAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadWaveImpactAsphaltCoverMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + WaveImpactAsphaltCoverFailureMechanismMetaEntity metaEntity = + entity.WaveImpactAsphaltCoverFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, metaEntity.ForeshoreProfileCollectionSourcePath, collector); + ReadWaveImpactAsphaltCoverRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); } @@ -565,14 +591,22 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries could not be found. internal static void ReadAsGrassCoverErosionOutwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverErosionOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGeneralGrassCoverErosionOutwardsCalculationInput(failureMechanism.GeneralInput); entity.ReadGrassCoverErosionOutwardsMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity = + entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single(); + ReadForeshoreProfiles(entity, + failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadHydraulicBoundaryLocations(failureMechanism.HydraulicBoundaryLocations, collector); ReadGrassCoverErosionOutwardsWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); @@ -800,25 +834,24 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsStabilityStoneCoverFailureMechanism(this FailureMechanismEntity entity, StabilityStoneCoverFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityStoneCoverMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); - ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); - } + StabilityStoneCoverFailureMechanismMetaEntity metaEntity = + entity.StabilityStoneCoverFailureMechanismMetaEntities.Single(); + ReadForeshoreProfiles(entity, + failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); - private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, ForeshoreProfileCollection foreshoreProfiles, - ReadConversionCollector collector) - { - // TODO: WTI-1112 Add file path location to storage - foreshoreProfiles.AddRange(entity.ForeshoreProfileEntities - .OrderBy(fpe => fpe.Order) - .Select(foreshoreProfileEntity => foreshoreProfileEntity.Read(collector)), - "path"); + ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, + failureMechanism.WaveConditionsCalculationGroup, + collector); } private static void ReadStabilityStoneCoverMechanismSectionResults(this FailureMechanismEntity entity, @@ -855,13 +888,20 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. + /// Thrown when expected table entries cannot be found. internal static void ReadAsStabilityPointStructuresFailureMechanism(this FailureMechanismEntity entity, StabilityPointStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityPointStructuresMechanismSectionResults(failureMechanism, collector); - entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + + StabilityPointStructuresFailureMechanismMetaEntity metaEntity = + entity.StabilityPointStructuresFailureMechanismMetaEntities.Single(); + entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, + metaEntity.ForeshoreProfileCollectionSourcePath, + collector); + entity.ReadStabilityPointStructures(failureMechanism.StabilityPointStructures, collector); entity.ReadGeneralInput(failureMechanism.GeneralInput); ReadStabilityPointStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r308f45aac80baf6744776a04e10e3cbaf8c39198 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 308f45aac80baf6744776a04e10e3cbaf8c39198) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -81,7 +81,6 @@ - @@ -95,7 +94,6 @@ Code - @@ -148,7 +146,6 @@ - Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (.../ClosingStructuresFailureMechanismCreateExtensionsTest.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (.../ClosingStructuresFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -90,8 +90,10 @@ Assert.AreEqual(failureMechanism.OutputComments.Body, entity.OutputComments); Assert.AreEqual(failureMechanism.NotRelevantComments.Body, entity.NotRelevantComments); - ClosingStructuresFailureMechanismMetaEntity metaEntity = entity.ClosingStructuresFailureMechanismMetaEntities.First(); + ClosingStructuresFailureMechanismMetaEntity metaEntity = + entity.ClosingStructuresFailureMechanismMetaEntities.Single(); Assert.AreEqual(failureMechanism.GeneralInput.N2A, metaEntity.N2A); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); } [Test] @@ -167,12 +169,12 @@ // Setup var profile = new TestForeshoreProfile(); - // TODO: WTI - 1112 Add file path location to storage var failureMechanism = new ClosingStructuresFailureMechanism(); + const string filePath = "some/file/path/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { profile - }, "path"); + }, filePath); var persistenceRegistry = new PersistenceRegistry(); @@ -182,6 +184,12 @@ // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); Assert.IsTrue(persistenceRegistry.Contains(profile)); + + ClosingStructuresFailureMechanismMetaEntity metaEntity = + entity.ClosingStructuresFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityForeshoreProfileCollectionSourcePath); } [Test] Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GeneralGrassCoverErosionOutwardsOutputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (.../GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -164,24 +164,34 @@ // Assert Assert.IsEmpty(entity.ForeshoreProfileEntities); + + GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity = + entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single(); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); } [Test] public void Create_WithForeshoreProfiles_ForeshoreProfilesEntitiesCreated() { // Setup - // TODO: WTI 1112: add file location persistency as part of storage var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + const string filePath = "some/path/to/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { new TestForeshoreProfile() - }, "path"); + }, filePath); // Call FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); + + GrassCoverErosionOutwardsFailureMechanismMetaEntity metaEntity = + entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityForeshoreProfileCollectionSourcePath); } [Test] @@ -201,7 +211,7 @@ FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); // Assert - Assert.AreEqual(n, entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.First().N); + Assert.AreEqual(n, entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single().N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -r308f45aac80baf6744776a04e10e3cbaf8c39198 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision 308f45aac80baf6744776a04e10e3cbaf8c39198) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -169,17 +169,34 @@ } [Test] + public void Create_WithoutForeshoreProfiles_EmptyForeshoreProfilesEntities() + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.ForeshoreProfileEntities); + + HeightStructuresFailureMechanismMetaEntity metaEntity = + entity.HeightStructuresFailureMechanismMetaEntities.Single(); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); + } + + [Test] public void Create_WithForeshoreProfiles_ForeshoreProfileEntitiesCreated() { // Setup var profile = new TestForeshoreProfile(); - // TODO: WTI-1112: add persistency as part of storage var failureMechanism = new HeightStructuresFailureMechanism(); + const string filePath = "some/path/to/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { profile - }, "path"); + }, filePath); var persistenceRegistry = new PersistenceRegistry(); @@ -189,19 +206,45 @@ // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); Assert.IsTrue(persistenceRegistry.Contains(profile)); + + HeightStructuresFailureMechanismMetaEntity metaEntity = + entity.HeightStructuresFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(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 - }, "some path"); + }, filePath); var persistenceRegistry = new PersistenceRegistry(); @@ -211,6 +254,12 @@ // Assert Assert.AreEqual(1, entity.HeightStructureEntities.Count); Assert.IsTrue(persistenceRegistry.Contains(structure)); + + HeightStructuresFailureMechanismMetaEntity metaEntity = + entity.HeightStructuresFailureMechanismMetaEntities.Single(); + string metaEntityHeightStructureCollectionSourcePath = metaEntity.HeightStructureCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityHeightStructureCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityHeightStructureCollectionSourcePath); } [Test] Fisheye: Tag c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -162,17 +162,34 @@ } [Test] + public void Create_WithoutForeshoreProfiles_EmptyForeshoreProfilesEntities() + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.ForeshoreProfileEntities); + + StabilityPointStructuresFailureMechanismMetaEntity metaEntity = + entity.StabilityPointStructuresFailureMechanismMetaEntities.Single(); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); + } + + [Test] public void Create_WithForeshoreProfiles_ForeshoreProfileEntitiesCreated() { // Setup var profile = new TestForeshoreProfile(); - // TODO: WTI - 1112 Add file path location to storage var failureMechanism = new StabilityPointStructuresFailureMechanism(); + const string filePath = "some/path/to/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { profile - }, "path"); + }, filePath); var persistenceRegistry = new PersistenceRegistry(); @@ -182,6 +199,12 @@ // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); Assert.IsTrue(persistenceRegistry.Contains(profile)); + + StabilityPointStructuresFailureMechanismMetaEntity metaEntity = + entity.StabilityPointStructuresFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityForeshoreProfileCollectionSourcePath); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (.../StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -163,25 +163,35 @@ // Assert Assert.IsEmpty(entity.ForeshoreProfileEntities); + + StabilityStoneCoverFailureMechanismMetaEntity metaEntity = + entity.StabilityStoneCoverFailureMechanismMetaEntities.Single(); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); } [Test] public void Create_WithForeshoreProfiles_ForeshoreProfilesEntitiesCreated() { // Setup - // TODO: WTI - 1112 Add file path location to storage var failureMechanism = new StabilityStoneCoverFailureMechanism(); + const string filePath = "some/path/to/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { new TestForeshoreProfile() }, - "path"); + filePath); // Call FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); + + StabilityStoneCoverFailureMechanismMetaEntity metaEntity = + entity.StabilityStoneCoverFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityForeshoreProfileCollectionSourcePath); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -red4b032b9903f394deb9691c2c39a9f2122ab0f5 -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs) (revision ed4b032b9903f394deb9691c2c39a9f2122ab0f5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (.../WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -163,24 +163,34 @@ // Assert Assert.IsEmpty(entity.ForeshoreProfileEntities); + + WaveImpactAsphaltCoverFailureMechanismMetaEntity metaEntity = + entity.WaveImpactAsphaltCoverFailureMechanismMetaEntities.Single(); + Assert.IsNull(metaEntity.ForeshoreProfileCollectionSourcePath); } [Test] public void Create_WithForeshoreProfiles_ForeshoreProfilesEntitiesCreated() { // Setup - // TODO: WTI-1112: Add path location as part of storage var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + const string filePath = "some/path/to/foreshoreProfiles"; failureMechanism.ForeshoreProfiles.AddRange(new[] { new TestForeshoreProfile() - }, "path"); + }, filePath); // Call FailureMechanismEntity entity = failureMechanism.Create(new PersistenceRegistry()); // Assert Assert.AreEqual(1, entity.ForeshoreProfileEntities.Count); + + WaveImpactAsphaltCoverFailureMechanismMetaEntity metaEntity = + entity.WaveImpactAsphaltCoverFailureMechanismMetaEntities.Single(); + string metaEntityForeshoreProfileCollectionSourcePath = metaEntity.ForeshoreProfileCollectionSourcePath; + Assert.AreNotSame(filePath, metaEntityForeshoreProfileCollectionSourcePath); + Assert.AreEqual(filePath, metaEntityForeshoreProfileCollectionSourcePath); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r755360927a67d206d503b10e0d4c40d5426c4a3b -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 755360927a67d206d503b10e0d4c40d5426c4a3b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -643,14 +643,16 @@ const string profileAId = "profileA"; const string profileBId = "profileB"; + const string fileLocation = "some/location"; var failureMechanismEntity = new FailureMechanismEntity { FailureMechanismType = (int) FailureMechanismType.GrassRevetmentErosionOutwards, GrassCoverErosionOutwardsFailureMechanismMetaEntities = { new GrassCoverErosionOutwardsFailureMechanismMetaEntity { - N = 2 + N = 2, + ForeshoreProfileCollectionSourcePath = fileLocation } }, CalculationGroupEntity = new CalculationGroupEntity(), @@ -680,6 +682,7 @@ // Assert ForeshoreProfileCollection foreshoreProfiles = section.GrassCoverErosionOutwards.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); CollectionAssert.AreEqual(new[] { profileBId, @@ -705,7 +708,11 @@ IsRelevant = Convert.ToByte(isRelevant), InputComments = inputComments, OutputComments = outputComments, - NotRelevantComments = notRelevantComments + NotRelevantComments = notRelevantComments, + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity() + } }; entity.FailureMechanismEntities.Add(failureMechanismEntity); entity.BackgroundDataEntities.Add(CreateBackgroundDataEntity()); @@ -744,6 +751,10 @@ Order = 1 } } + }, + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity() } }; entity.FailureMechanismEntities.Add(failureMechanismEntity); @@ -769,6 +780,8 @@ const string profileAId = "profileA"; const string profileBId = "profileB"; + const string fileLocation = "some/file/location"; + var failureMechanismEntity = new FailureMechanismEntity { FailureMechanismType = (int) FailureMechanismType.StabilityStoneRevetment, @@ -788,6 +801,13 @@ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()) } }, + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } + }, IsRelevant = Convert.ToByte(isRelevant) }; entity.FailureMechanismEntities.Add(failureMechanismEntity); @@ -800,6 +820,7 @@ // Assert ForeshoreProfileCollection foreshoreProfiles = section.StabilityStoneCover.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); CollectionAssert.AreEqual(new[] { profileBId, @@ -825,7 +846,11 @@ IsRelevant = Convert.ToByte(isRelevant), InputComments = inputComments, OutputComments = outputComments, - NotRelevantComments = notRelevantComments + NotRelevantComments = notRelevantComments, + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity() + } }; entity.FailureMechanismEntities.Add(failureMechanismEntity); entity.BackgroundDataEntities.Add(CreateBackgroundDataEntity()); @@ -850,6 +875,8 @@ const string profileAId = "profileA"; const string profileBId = "profileB"; + const string fileLocation = "some/location"; + var failureMechanismEntity = new FailureMechanismEntity { FailureMechanismType = (int) FailureMechanismType.WaveImpactOnAsphaltRevetment, @@ -868,6 +895,13 @@ Id = profileBId, GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()) } + }, + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } } }; entity.FailureMechanismEntities.Add(failureMechanismEntity); @@ -880,6 +914,7 @@ // Assert ForeshoreProfileCollection foreshoreProfiles = section.WaveImpactAsphaltCover.ForeshoreProfiles; + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); CollectionAssert.AreEqual(new[] { profileBId, @@ -909,6 +944,10 @@ Order = 1 } } + }, + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity() } }; entity.FailureMechanismEntities.Add(failureMechanismEntity); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -r755360927a67d206d503b10e0d4c40d5426c4a3b -rc9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision 755360927a67d206d503b10e0d4c40d5426c4a3b) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision c9cee4b6d3ce28471a0054fa2bce21ce9e4c60f8) @@ -681,9 +681,61 @@ Assert.IsEmpty(failureMechanism.Sections); Assert.AreEqual(3, failureMechanism.GeneralInput.N); + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); } [Test] + public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithForeshoreProfiles_ReturnsNeGrassCoverErosionOutwardsFailureMechanismWithForeshoreProfilesSet() + { + // Setup + const string fileLocation = "some/path/to/foreshoreProfiles"; + + var entity = new FailureMechanismEntity + { + CalculationGroupEntity = new CalculationGroupEntity(), + ForeshoreProfileEntities = + { + new ForeshoreProfileEntity + { + Id = "Child1", + GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), + Order = 1 + }, + new ForeshoreProfileEntity + { + Id = "Child2", + GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), + Order = 0 + } + }, + 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(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); + + ForeshoreProfile child1 = foreshoreProfiles[0]; + Assert.AreEqual("Child2", child1.Id); + + ForeshoreProfile child2 = foreshoreProfiles[1]; + Assert.AreEqual("Child1", child2.Id); + } + + [Test] public void ReadAsGrassCoverErosionOutwardsFailureMechanism_WithSectionsSet_ReturnsNewGrassCoverErosionOutwardsFailureMechanismWithFailureMechanismSectionsAdded() { // Setup @@ -815,6 +867,41 @@ #region Stability Stone Cover [Test] + [TestCase(true)] + [TestCase(false)] + public void ReadAsStabilityStoneCoverFailureMechanism_WithCollector_ReturnsNewStabilityStoneCoverFailureMechanismWithPropertiesSet(bool isRelevant) + { + // Setup + var entity = new FailureMechanismEntity + { + IsRelevant = Convert.ToByte(isRelevant), + InputComments = "Some input text", + OutputComments = "Some output text", + NotRelevantComments = "Really not relevant", + CalculationGroupEntity = new CalculationGroupEntity(), + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity() + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + // Call + entity.ReadAsStabilityStoneCoverFailureMechanism(failureMechanism, collector); + + // Assert + Assert.IsNotNull(failureMechanism); + Assert.AreEqual(isRelevant, failureMechanism.IsRelevant); + Assert.AreEqual(entity.InputComments, failureMechanism.InputComments.Body); + Assert.AreEqual(entity.OutputComments, failureMechanism.OutputComments.Body); + Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); + Assert.IsEmpty(failureMechanism.Sections); + + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); + } + + [Test] public void ReadAsStabilityStoneCoverFailureMechanism_WithWaveConditionsCalculationGroup_ReturnsNewStabilityStoneCoverFailureMechanismWithCalculationGroupSet() { // Setup @@ -837,6 +924,10 @@ Order = 0 } } + }, + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity() } }; var collector = new ReadConversionCollector(); @@ -859,7 +950,7 @@ public void ReadAsStabilityStoneCoverFailureMechanism_WithForeshoreProfiles_ReturnsNewStabilityStoneCoverFailureMechanismWithForeshoreProfilesSet() { // Setup - // TODO: WTI-1112 Add file location as part of storage + const string fileLocation = "some/path/to/foreshoreProfiles"; var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -877,6 +968,13 @@ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), Order = 0 } + }, + StabilityStoneCoverFailureMechanismMetaEntities = + { + new StabilityStoneCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } } }; var collector = new ReadConversionCollector(); @@ -886,12 +984,14 @@ entity.ReadAsStabilityStoneCoverFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); - ForeshoreProfile child1 = failureMechanism.ForeshoreProfiles[0]; + ForeshoreProfile child1 = foreshoreProfiles[0]; Assert.AreEqual("Child2", child1.Id); - ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; + ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); } @@ -900,6 +1000,41 @@ #region Wave Impact Asphalt Cover [Test] + [TestCase(true)] + [TestCase(false)] + public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithCollector_ReturnsNewWaveImpactAsphaltCoverFailureMechanismWithPropertiesSet(bool isRelevant) + { + // Setup + var entity = new FailureMechanismEntity + { + IsRelevant = Convert.ToByte(isRelevant), + InputComments = "Some input text", + OutputComments = "Some output text", + NotRelevantComments = "Really not relevant", + CalculationGroupEntity = new CalculationGroupEntity(), + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity() + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + // Call + entity.ReadAsWaveImpactAsphaltCoverFailureMechanism(failureMechanism, collector); + + // Assert + Assert.IsNotNull(failureMechanism); + Assert.AreEqual(isRelevant, failureMechanism.IsRelevant); + Assert.AreEqual(entity.InputComments, failureMechanism.InputComments.Body); + Assert.AreEqual(entity.OutputComments, failureMechanism.OutputComments.Body); + Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); + Assert.IsEmpty(failureMechanism.Sections); + + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); + } + + [Test] public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithWaveConditionsCalculationGroup_ReturnsNewWaveImpactAsphaltCoverFailureMechanismWithCalculationGroupSet() { // Setup @@ -922,6 +1057,10 @@ Order = 0 } } + }, + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity() } }; var collector = new ReadConversionCollector(); @@ -944,7 +1083,8 @@ public void ReadAsWaveImpactAsphaltCoverFailureMechanism_WithForeshoreProfiles_ReturnsNewWaveImpactAsphaltCoverFailureMechanismWithForeshoreProfilesSet() { // Setup - // TODO: WTI-1112 Add file location as part of storage + const string fileLocation = "some/path/to/foreshoreProfiles"; + var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -962,6 +1102,13 @@ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), Order = 0 } + }, + WaveImpactAsphaltCoverFailureMechanismMetaEntities = + { + new WaveImpactAsphaltCoverFailureMechanismMetaEntity + { + ForeshoreProfileCollectionSourcePath = fileLocation + } } }; var collector = new ReadConversionCollector(); @@ -971,12 +1118,14 @@ entity.ReadAsWaveImpactAsphaltCoverFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); - ForeshoreProfile child1 = failureMechanism.ForeshoreProfiles[0]; + ForeshoreProfile child1 = foreshoreProfiles[0]; Assert.AreEqual("Child2", child1.Id); - ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; + ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); } @@ -985,12 +1134,50 @@ #region Height Structures [Test] + [TestCase(true)] + [TestCase(false)] + public void ReadAsHeightStructuresFailureMechanism_WithCollector_ReturnsNewHeightStructuresFailureMechanismWithPropertiesSet(bool isRelevant) + { + // Setup + var entity = new FailureMechanismEntity + { + IsRelevant = Convert.ToByte(isRelevant), + InputComments = "Some input text", + OutputComments = "Some output text", + NotRelevantComments = "Really not relevant", + CalculationGroupEntity = new CalculationGroupEntity(), + HeightStructuresFailureMechanismMetaEntities = + { + new HeightStructuresFailureMechanismMetaEntity + { + N = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + entity.ReadAsHeightStructuresFailureMechanism(failureMechanism, collector); + + // Assert + Assert.IsNotNull(failureMechanism); + Assert.AreEqual(isRelevant, failureMechanism.IsRelevant); + Assert.AreEqual(entity.InputComments, failureMechanism.InputComments.Body); + Assert.AreEqual(entity.OutputComments, failureMechanism.OutputComments.Body); + Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); + Assert.IsEmpty(failureMechanism.Sections); + + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); + } + + [Test] public void ReadAsHeightStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup const int generalInputN = 7; + const string fileLocation = "some/location/to/foreshoreProfiles"; - // TODO: WTI-1112 Add file location as part of storage var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -1013,7 +1200,8 @@ { new HeightStructuresFailureMechanismMetaEntity { - N = generalInputN + N = generalInputN, + ForeshoreProfileCollectionSourcePath = fileLocation } } }; @@ -1024,12 +1212,14 @@ entity.ReadAsHeightStructuresFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); - ForeshoreProfile child1 = failureMechanism.ForeshoreProfiles[0]; + ForeshoreProfile child1 = foreshoreProfiles[0]; Assert.AreEqual("Child2", child1.Id); - ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; + ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); Assert.AreEqual(generalInputN, failureMechanism.GeneralInput.N); @@ -1090,11 +1280,46 @@ #region Closing Structures [Test] + [TestCase(true)] + [TestCase(false)] + public void ReadAsClosingStructuresFailureMechanism_WithCollector_ReturnsNewClosingStructuresFailureMechanismWithPropertiesSet(bool isRelevant) + { + // Setup + var entity = new FailureMechanismEntity + { + IsRelevant = Convert.ToByte(isRelevant), + InputComments = "Some input text", + OutputComments = "Some output text", + NotRelevantComments = "Really not relevant", + CalculationGroupEntity = new CalculationGroupEntity(), + ClosingStructuresFailureMechanismMetaEntities = + { + new ClosingStructuresFailureMechanismMetaEntity() + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new ClosingStructuresFailureMechanism(); + + // Call + entity.ReadAsClosingStructuresFailureMechanism(failureMechanism, collector); + + // Assert + Assert.IsNotNull(failureMechanism); + Assert.AreEqual(isRelevant, failureMechanism.IsRelevant); + Assert.AreEqual(entity.InputComments, failureMechanism.InputComments.Body); + Assert.AreEqual(entity.OutputComments, failureMechanism.OutputComments.Body); + Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); + Assert.IsEmpty(failureMechanism.Sections); + + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); + } + + [Test] public void ReadAsClosingStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup - // TODO: WTI-1112 Add file location as part of storage const int generalInputN2A = 3; + const string fileLocation = "some/location/to/foreshoreprofiles"; var entity = new FailureMechanismEntity { @@ -1118,7 +1343,8 @@ { new ClosingStructuresFailureMechanismMetaEntity { - N2A = generalInputN2A + N2A = generalInputN2A, + ForeshoreProfileCollectionSourcePath = fileLocation } } }; @@ -1129,12 +1355,14 @@ entity.ReadAsClosingStructuresFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); - ForeshoreProfile child1 = failureMechanism.ForeshoreProfiles[0]; + ForeshoreProfile child1 = foreshoreProfiles[0]; Assert.AreEqual("Child2", child1.Id); - ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; + ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); Assert.AreEqual(generalInputN2A, failureMechanism.GeneralInput.N2A); @@ -1236,11 +1464,49 @@ #region Stability Point Structures [Test] + [TestCase(true)] + [TestCase(false)] + public void ReadAsStabilityPointStructuresFailureMechanism_WithCollector_ReturnsNewStabilityPointStructuresFailureMechanismWithPropertiesSet(bool isRelevant) + { + // Setup + var entity = new FailureMechanismEntity + { + IsRelevant = Convert.ToByte(isRelevant), + InputComments = "Some input text", + OutputComments = "Some output text", + NotRelevantComments = "Really not relevant", + CalculationGroupEntity = new CalculationGroupEntity(), + StabilityPointStructuresFailureMechanismMetaEntities = + { + new StabilityPointStructuresFailureMechanismMetaEntity + { + N = 1 + } + } + }; + var collector = new ReadConversionCollector(); + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + // Call + entity.ReadAsStabilityPointStructuresFailureMechanism(failureMechanism, collector); + + // Assert + Assert.IsNotNull(failureMechanism); + Assert.AreEqual(isRelevant, failureMechanism.IsRelevant); + Assert.AreEqual(entity.InputComments, failureMechanism.InputComments.Body); + Assert.AreEqual(entity.OutputComments, failureMechanism.OutputComments.Body); + Assert.AreEqual(entity.NotRelevantComments, failureMechanism.NotRelevantComments.Body); + Assert.IsEmpty(failureMechanism.Sections); + + Assert.IsNull(failureMechanism.ForeshoreProfiles.SourcePath); + } + + [Test] public void ReadAsStabilityPointStructuresFailureMechanism_WithForeshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup - // TODO: WTI-1112 Add file location as part of storage const int generalInputN = 5; + const string fileLocation = "some/location/to/foreshoreprofiles"; var entity = new FailureMechanismEntity { @@ -1264,7 +1530,8 @@ { new StabilityPointStructuresFailureMechanismMetaEntity { - N = generalInputN + N = generalInputN, + ForeshoreProfileCollectionSourcePath = fileLocation } } }; @@ -1275,12 +1542,14 @@ entity.ReadAsStabilityPointStructuresFailureMechanism(failureMechanism, collector); // Assert - Assert.AreEqual(2, failureMechanism.ForeshoreProfiles.Count); + ForeshoreProfileCollection foreshoreProfiles = failureMechanism.ForeshoreProfiles; + Assert.AreEqual(2, foreshoreProfiles.Count); + Assert.AreEqual(fileLocation, foreshoreProfiles.SourcePath); - ForeshoreProfile child1 = failureMechanism.ForeshoreProfiles[0]; + ForeshoreProfile child1 = foreshoreProfiles[0]; Assert.AreEqual("Child2", child1.Id); - ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; + ForeshoreProfile child2 = foreshoreProfiles[1]; Assert.AreEqual("Child1", child2.Id); Assert.AreEqual(generalInputN, failureMechanism.GeneralInput.N);