Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r31d2ac70c3ea6bb9f0461a296408af2a316ee5e0 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 31d2ac70c3ea6bb9f0461a296408af2a316ee5e0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -364,7 +364,7 @@ - + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs =================================================================== diff -u -ree999e492a57d9bbb3777754651e9f4722611075 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs (.../ClosingStructuresSectionResultEntityReadExtensions.cs) (revision ee999e492a57d9bbb3777754651e9f4722611075) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensions.cs (.../ClosingStructuresSectionResultEntityReadExtensions.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -40,7 +40,7 @@ /// The target of the read operation. /// The object keeping track of read operations. /// A new . - /// Thrown when is null. + /// Thrown when any input parameter is null. internal static void Read(this ClosingStructuresSectionResultEntity entity, ClosingStructuresFailureMechanismSectionResult sectionResult, ReadConversionCollector collector) { Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -r3e7db9d95e07d438ec99f8488ec184848655b98c -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 3e7db9d95e07d438ec99f8488ec184848655b98c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -29,6 +29,7 @@ using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.Read.HeightStructures; using Application.Ringtoets.Storage.Read.Piping; +using Application.Ringtoets.Storage.Read.PipingStructures; using Application.Ringtoets.Storage.Read.StabilityPointStructures; using Application.Ringtoets.Storage.Read.StabilityStoneCover; using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; @@ -61,15 +62,19 @@ /// The to read into a . /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadCommonFailureMechanismProperties(this FailureMechanismEntity entity, IFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadCommonFailureMechanismProperties(this FailureMechanismEntity entity, + IFailureMechanism failureMechanism, + ReadConversionCollector collector) { failureMechanism.IsRelevant = Convert.ToBoolean(entity.IsRelevant); failureMechanism.Comments = entity.Comments; entity.ReadFailureMechanismSections(failureMechanism, collector); } - private static void ReadFailureMechanismSections(this FailureMechanismEntity entity, IFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadFailureMechanismSections(this FailureMechanismEntity entity, + IFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var failureMechanismSectionEntity in entity.FailureMechanismSectionEntities) { @@ -90,7 +95,9 @@ /// is null /// is null /// - internal static void ReadAsPipingFailureMechanism(this FailureMechanismEntity entity, PipingFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsPipingFailureMechanism(this FailureMechanismEntity entity, + PipingFailureMechanism failureMechanism, + ReadConversionCollector collector) { if (failureMechanism == null) { @@ -124,14 +131,17 @@ failureMechanism.GeneralInput, collector); } - private static void ReadProbabilityAssessmentInput(ICollection pipingFailureMechanismMetaEntities, PipingProbabilityAssessmentInput pipingProbabilityAssessmentInput) + private static void ReadProbabilityAssessmentInput(ICollection pipingFailureMechanismMetaEntities, + PipingProbabilityAssessmentInput pipingProbabilityAssessmentInput) { PipingProbabilityAssessmentInput probabilityAssessmentInput = pipingFailureMechanismMetaEntities.ElementAt(0).Read(); pipingProbabilityAssessmentInput.A = probabilityAssessmentInput.A; } - private static void ReadPipingMechanismSectionResults(this FailureMechanismEntity entity, PipingFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadPipingMechanismSectionResults(this FailureMechanismEntity entity, + PipingFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingSectionResultEntities)) { @@ -164,7 +174,9 @@ /// The to read into a . /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsGrassCoverErosionInwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverErosionInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsGrassCoverErosionInwardsFailureMechanism(this FailureMechanismEntity entity, + GrassCoverErosionInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGeneralGrassCoverErosionInwardsCalculationInput(failureMechanism.GeneralInput); @@ -173,7 +185,8 @@ entity.ReadGrassCoverErosionInwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadGeneralGrassCoverErosionInwardsCalculationInput(this FailureMechanismEntity entity, GeneralGrassCoverErosionInwardsInput input) + private static void ReadGeneralGrassCoverErosionInwardsCalculationInput(this FailureMechanismEntity entity, + GeneralGrassCoverErosionInwardsInput input) { entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Single().Read(input); } @@ -186,7 +199,9 @@ } } - private static void ReadGrassCoverErosionInwardsMechanismSectionResults(this FailureMechanismEntity entity, GrassCoverErosionInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadGrassCoverErosionInwardsMechanismSectionResults(this FailureMechanismEntity entity, + GrassCoverErosionInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionInwardsSectionResultEntities)) { @@ -218,7 +233,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsHeightStructuresFailureMechanism(this FailureMechanismEntity entity, HeightStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsHeightStructuresFailureMechanism(this FailureMechanismEntity entity, + HeightStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadHeightStructuresMechanismSectionResults(failureMechanism, collector); @@ -228,7 +245,9 @@ ReadHeightStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); } - private static void ReadHeightStructuresMechanismSectionResults(this FailureMechanismEntity entity, HeightStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadHeightStructuresMechanismSectionResults(this FailureMechanismEntity entity, + HeightStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.HeightStructuresSectionResultEntities)) { @@ -271,13 +290,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsStrengthStabilityLengthwiseConstructionFailureMechanism(this FailureMechanismEntity entity, StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsStrengthStabilityLengthwiseConstructionFailureMechanism(this FailureMechanismEntity entity, + StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStrengthStabilityLengthwiseConstructionMechanismSectionResults(failureMechanism, collector); } - private static void ReadStrengthStabilityLengthwiseConstructionMechanismSectionResults(this FailureMechanismEntity entity, StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadStrengthStabilityLengthwiseConstructionMechanismSectionResults(this FailureMechanismEntity entity, + StrengthStabilityLengthwiseConstructionFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityLengthwiseConstructionSectionResultEntities)) { @@ -298,13 +321,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsTechnicalInnovationFailureMechanism(this FailureMechanismEntity entity, TechnicalInnovationFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsTechnicalInnovationFailureMechanism(this FailureMechanismEntity entity, + TechnicalInnovationFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadTechnicalInnovationMechanismSectionResults(failureMechanism, collector); } - private static void ReadTechnicalInnovationMechanismSectionResults(this FailureMechanismEntity entity, TechnicalInnovationFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadTechnicalInnovationMechanismSectionResults(this FailureMechanismEntity entity, + TechnicalInnovationFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.TechnicalInnovationSectionResultEntities)) { @@ -325,13 +352,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsWaterPressureAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, WaterPressureAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsWaterPressureAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, + WaterPressureAsphaltCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadWaterPressureAsphaltCoverMechanismSectionResults(failureMechanism, collector); } - private static void ReadWaterPressureAsphaltCoverMechanismSectionResults(this FailureMechanismEntity entity, WaterPressureAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadWaterPressureAsphaltCoverMechanismSectionResults(this FailureMechanismEntity entity, + WaterPressureAsphaltCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaterPressureAsphaltCoverSectionResultEntities)) { @@ -352,7 +383,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsClosingStructuresFailureMechanism(this FailureMechanismEntity entity, ClosingStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsClosingStructuresFailureMechanism(this FailureMechanismEntity entity, + ClosingStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadClosingStructuresMechanismSectionResults(failureMechanism, collector); @@ -362,7 +395,9 @@ ReadClosingStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); } - private static void ReadClosingStructuresMechanismSectionResults(this FailureMechanismEntity entity, ClosingStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadClosingStructuresMechanismSectionResults(this FailureMechanismEntity entity, + ClosingStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.ClosingStructuresSectionResultEntities)) { @@ -379,7 +414,8 @@ generalInput.N2A = generalClosingStructuresInput.N2A; } - private static void ReadClosingStructures(this FailureMechanismEntity entity, ObservableList closingStructures, ReadConversionCollector collector) + private static void ReadClosingStructures(this FailureMechanismEntity entity, ObservableList closingStructures, + ReadConversionCollector collector) { closingStructures.AddRange(entity.ClosingStructureEntities.OrderBy(fpe => fpe.Order).Select(structureEntity => structureEntity.Read(collector))); } @@ -405,13 +441,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsMacrostabilityInwardsFailureMechanism(this FailureMechanismEntity entity, MacrostabilityInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsMacrostabilityInwardsFailureMechanism(this FailureMechanismEntity entity, + MacrostabilityInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadMacrostabilityInwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadMacrostabilityInwardsMechanismSectionResults(this FailureMechanismEntity entity, MacrostabilityInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadMacrostabilityInwardsMechanismSectionResults(this FailureMechanismEntity entity, + MacrostabilityInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityInwardsSectionResultEntities)) { @@ -432,13 +472,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsMacrostabilityOutwardsFailureMechanism(this FailureMechanismEntity entity, MacrostabilityOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsMacrostabilityOutwardsFailureMechanism(this FailureMechanismEntity entity, + MacrostabilityOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadMacrostabilityOutwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadMacrostabilityOutwardsMechanismSectionResults(this FailureMechanismEntity entity, MacrostabilityOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadMacrostabilityOutwardsMechanismSectionResults(this FailureMechanismEntity entity, + MacrostabilityOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities)) { @@ -459,7 +503,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsWaveImpactAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, WaveImpactAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsWaveImpactAsphaltCoverFailureMechanism(this FailureMechanismEntity entity, + WaveImpactAsphaltCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadWaveImpactAsphaltCoverMechanismSectionResults(failureMechanism, collector); @@ -468,7 +514,9 @@ ReadWaveImpactAsphaltCoverRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); } - private static void ReadWaveImpactAsphaltCoverMechanismSectionResults(this FailureMechanismEntity entity, WaveImpactAsphaltCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadWaveImpactAsphaltCoverMechanismSectionResults(this FailureMechanismEntity entity, + WaveImpactAsphaltCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaveImpactAsphaltCoverSectionResultEntities)) { @@ -500,7 +548,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsGrassCoverErosionOutwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverErosionOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsGrassCoverErosionOutwardsFailureMechanism(this FailureMechanismEntity entity, + GrassCoverErosionOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGeneralGrassCoverErosionOutwardsCalculationInput(failureMechanism.GeneralInput); @@ -511,12 +561,15 @@ ReadGrassCoverErosionOutwardsWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); } - private static void ReadGeneralGrassCoverErosionOutwardsCalculationInput(this FailureMechanismEntity entity, GeneralGrassCoverErosionOutwardsInput input) + private static void ReadGeneralGrassCoverErosionOutwardsCalculationInput(this FailureMechanismEntity entity, + GeneralGrassCoverErosionOutwardsInput input) { entity.GrassCoverErosionOutwardsFailureMechanismMetaEntities.Single().Read(input); } - private static void ReadGrassCoverErosionOutwardsMechanismSectionResults(this FailureMechanismEntity entity, GrassCoverErosionOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadGrassCoverErosionOutwardsMechanismSectionResults(this FailureMechanismEntity entity, + GrassCoverErosionOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionOutwardsSectionResultEntities)) { @@ -527,7 +580,9 @@ } } - private static void ReadHydraulicBoundaryLocations(this FailureMechanismEntity entity, List locations, ReadConversionCollector collector) + private static void ReadHydraulicBoundaryLocations(this FailureMechanismEntity entity, + List locations, + ReadConversionCollector collector) { locations.AddRange( entity @@ -556,13 +611,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsGrassCoverSlipOffInwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverSlipOffInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsGrassCoverSlipOffInwardsFailureMechanism(this FailureMechanismEntity entity, + GrassCoverSlipOffInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGrassCoverSlipOffInwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadGrassCoverSlipOffInwardsMechanismSectionResults(this FailureMechanismEntity entity, GrassCoverSlipOffInwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadGrassCoverSlipOffInwardsMechanismSectionResults(this FailureMechanismEntity entity, + GrassCoverSlipOffInwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffInwardsSectionResultEntities)) { @@ -583,13 +642,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsGrassCoverSlipOffOutwardsFailureMechanism(this FailureMechanismEntity entity, GrassCoverSlipOffOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsGrassCoverSlipOffOutwardsFailureMechanism(this FailureMechanismEntity entity, + GrassCoverSlipOffOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadGrassCoverSlipOffOutwardsMechanismSectionResults(failureMechanism, collector); } - private static void ReadGrassCoverSlipOffOutwardsMechanismSectionResults(this FailureMechanismEntity entity, GrassCoverSlipOffOutwardsFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadGrassCoverSlipOffOutwardsMechanismSectionResults(this FailureMechanismEntity entity, + GrassCoverSlipOffOutwardsFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffOutwardsSectionResultEntities)) { @@ -610,13 +673,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsMicrostabilityFailureMechanism(this FailureMechanismEntity entity, MicrostabilityFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsMicrostabilityFailureMechanism(this FailureMechanismEntity entity, + MicrostabilityFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadMicrostabilityMechanismSectionResults(failureMechanism, collector); } - private static void ReadMicrostabilityMechanismSectionResults(this FailureMechanismEntity entity, MicrostabilityFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadMicrostabilityMechanismSectionResults(this FailureMechanismEntity entity, + MicrostabilityFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MicrostabilitySectionResultEntities)) { @@ -637,13 +704,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsPipingStructureFailureMechanism(this FailureMechanismEntity entity, PipingStructureFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsPipingStructureFailureMechanism(this FailureMechanismEntity entity, + PipingStructureFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadPipingStructureMechanismSectionResults(failureMechanism, collector); } - private static void ReadPipingStructureMechanismSectionResults(this FailureMechanismEntity entity, PipingStructureFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadPipingStructureMechanismSectionResults(this FailureMechanismEntity entity, + PipingStructureFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingStructureSectionResultEntities)) { @@ -664,13 +735,17 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsDuneErosionFailureMechanism(this FailureMechanismEntity entity, DuneErosionFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsDuneErosionFailureMechanism(this FailureMechanismEntity entity, + DuneErosionFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadDuneErosionMechanismSectionResults(failureMechanism, collector); } - private static void ReadDuneErosionMechanismSectionResults(this FailureMechanismEntity entity, DuneErosionFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadDuneErosionMechanismSectionResults(this FailureMechanismEntity entity, + DuneErosionFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.DuneErosionSectionResultEntities)) { @@ -691,7 +766,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsStabilityStoneCoverFailureMechanism(this FailureMechanismEntity entity, StabilityStoneCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsStabilityStoneCoverFailureMechanism(this FailureMechanismEntity entity, + StabilityStoneCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityStoneCoverMechanismSectionResults(failureMechanism, collector); @@ -700,12 +777,15 @@ ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.WaveConditionsCalculationGroup, collector); } - private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, ObservableList foreshoreProfiles, ReadConversionCollector collector) + private static void ReadForeshoreProfiles(this FailureMechanismEntity entity, ObservableList foreshoreProfiles, + ReadConversionCollector collector) { foreshoreProfiles.AddRange(entity.ForeshoreProfileEntities.OrderBy(fpe => fpe.Order).Select(foreshoreProfileEntity => foreshoreProfileEntity.Read(collector))); } - private static void ReadStabilityStoneCoverMechanismSectionResults(this FailureMechanismEntity entity, StabilityStoneCoverFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadStabilityStoneCoverMechanismSectionResults(this FailureMechanismEntity entity, + StabilityStoneCoverFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StabilityStoneCoverSectionResultEntities)) { @@ -717,7 +797,8 @@ } private static void ReadStabilityStoneCoverWaveConditionsRootCalculationGroup(CalculationGroupEntity rootCalculationGroupEntity, - CalculationGroup targetRootCalculationGroup, ReadConversionCollector collector) + CalculationGroup targetRootCalculationGroup, + ReadConversionCollector collector) { CalculationGroup rootCalculationGroup = rootCalculationGroupEntity.ReadAsStabilityStoneCoverWaveConditionsCalculationGroup(collector); foreach (ICalculationBase calculationBase in rootCalculationGroup.Children) @@ -736,7 +817,9 @@ /// The to create for. /// The target of the read operation. /// The object keeping track of read operations. - internal static void ReadAsStabilityPointStructuresFailureMechanism(this FailureMechanismEntity entity, StabilityPointStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + internal static void ReadAsStabilityPointStructuresFailureMechanism(this FailureMechanismEntity entity, + StabilityPointStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityPointStructuresMechanismSectionResults(failureMechanism, collector); @@ -746,14 +829,16 @@ ReadStabilityPointStructuresRootCalculationGroup(entity.CalculationGroupEntity, failureMechanism.CalculationsGroup, collector); } - private static void ReadStabilityPointStructuresMechanismSectionResults(this FailureMechanismEntity entity, StabilityPointStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) + private static void ReadStabilityPointStructuresMechanismSectionResults(this FailureMechanismEntity entity, + StabilityPointStructuresFailureMechanism failureMechanism, + ReadConversionCollector collector) { foreach (var sectionResultEntity in entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StabilityPointStructuresSectionResultEntities)) { var failureMechanismSection = collector.Get(sectionResultEntity.FailureMechanismSectionEntity); var result = failureMechanism.SectionResults.Single(sr => ReferenceEquals(sr.Section, failureMechanismSection)); - sectionResultEntity.Read(result); + sectionResultEntity.Read(result, collector); } } Fisheye: Tag 6e33ada58f1a53a5a732c3b4e46583ad846a2983 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/Piping/PipingStructureSectionResultEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensions.cs (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2016. 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 Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Read.PipingStructures +{ + /// + /// This class defines extension methods for read operations for a based on the + /// . + /// + internal static class PipingStructureSectionResultEntityReadExtensions + { + /// + /// Reads the and use the information to update a + /// . + /// + /// The to create for. + /// The target of the read operation. + /// A new . + /// Thrown when is null. + internal static void Read(this PipingStructureSectionResultEntity entity, PipingStructureFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + + sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne); + sectionResult.AssessmentLayerTwoA = (AssessmentLayerTwoAResult) entity.LayerTwoA; + sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs =================================================================== diff -u -r4f89601cb9d77ff379727afd64f902a0aff74fa3 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 4f89601cb9d77ff379727afd64f902a0aff74fa3) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ReadConversionCollector.cs (.../ReadConversionCollector.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -42,22 +42,54 @@ /// internal class ReadConversionCollector { - private readonly Dictionary stochasticSoilModels = CreateDictionary(); - private readonly Dictionary stochasticSoilProfiles = CreateDictionary(); - private readonly Dictionary soilProfiles = CreateDictionary(); - private readonly Dictionary surfaceLines = CreateDictionary(); - private readonly Dictionary hydraulicBoundaryLocations = CreateDictionary(); - private readonly Dictionary grassCoverErosionOutwardsHydraulicBoundaryLocations = CreateDictionary(); - private readonly Dictionary failureMechanismSections = CreateDictionary(); - private readonly Dictionary dikeProfiles = CreateDictionary(); - private readonly Dictionary foreshoreProfiles = CreateDictionary(); - private readonly Dictionary grassCoverErosionInwardsCalculations = CreateDictionary(); - private readonly Dictionary heightStructures = CreateDictionary(); - private readonly Dictionary closingStructures = CreateDictionary(); - private readonly Dictionary stabilityPointStructures = CreateDictionary(); - private readonly Dictionary> heightStructuresCalculations = CreateDictionary>(); - private readonly Dictionary> closingStructuresCalculations = CreateDictionary>(); + private readonly Dictionary stochasticSoilModels = + CreateDictionary(); + private readonly Dictionary stochasticSoilProfiles = + CreateDictionary(); + + private readonly Dictionary soilProfiles = + CreateDictionary(); + + private readonly Dictionary surfaceLines = + CreateDictionary(); + + private readonly Dictionary hydraulicBoundaryLocations = + CreateDictionary(); + + private readonly Dictionary grassCoverErosionOutwardsHydraulicBoundaryLocations = + CreateDictionary(); + + private readonly Dictionary failureMechanismSections = + CreateDictionary(); + + private readonly Dictionary dikeProfiles = + CreateDictionary(); + + private readonly Dictionary foreshoreProfiles = + CreateDictionary(); + + private readonly Dictionary grassCoverErosionInwardsCalculations = + CreateDictionary(); + + private readonly Dictionary heightStructures = + CreateDictionary(); + + private readonly Dictionary closingStructures = + CreateDictionary(); + + private readonly Dictionary stabilityPointStructures = + CreateDictionary(); + + private readonly Dictionary> heightStructuresCalculations = + CreateDictionary>(); + + private readonly Dictionary> closingStructuresCalculations = + CreateDictionary>(); + + private readonly Dictionary> stabilityPointStructuresCalculations = + CreateDictionary>(); + private static Dictionary CreateDictionary() { return new Dictionary(new ReferenceEqualityComparer()); @@ -1140,5 +1172,76 @@ } #endregion + + #region StabilityPointStructuresCalculationEntity: Read, Contains, Get + + /// + /// Registers a read operation for + /// and the that was constructed + /// with the information. + /// + /// The + /// that was read. + /// The that + /// was constructed. + /// Thrown when any input parameter is null. + internal void Read(StabilityPointStructuresCalculationEntity entity, StructuresCalculation model) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + if (model == null) + { + throw new ArgumentNullException("model"); + } + + stabilityPointStructuresCalculations[entity] = model; + } + + /// + /// Checks whether a read operation has been registered for a given . + /// + /// The to check for. + /// true if the was read before, false otherwise. + /// Thrown when is null. + internal bool Contains(StabilityPointStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + return stabilityPointStructuresCalculations.ContainsKey(entity); + } + + /// + /// Obtains the which was read + /// for the given . + /// + /// The for which a read + /// operation has been registered. + /// The constructed . + /// Thrown when is null. + /// Thrown when no read operation has + /// been registered for . + /// Use + /// to find out whether a read operation has been registered for . + internal StructuresCalculation Get(StabilityPointStructuresCalculationEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException("entity"); + } + try + { + return stabilityPointStructuresCalculations[entity]; + } + catch (KeyNotFoundException e) + { + throw new InvalidOperationException(e.Message, e); + } + } + + #endregion } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs =================================================================== diff -u -rc3378ccfc96767cbac99fa57ae60d08667555f01 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs (.../StabilityPointStructureCalculationEntityReadExtensions.cs) (revision c3378ccfc96767cbac99fa57ae60d08667555f01) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureCalculationEntityReadExtensions.cs (.../StabilityPointStructureCalculationEntityReadExtensions.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -49,6 +49,10 @@ { throw new ArgumentNullException("collector"); } + if (collector.Contains(entity)) + { + return collector.Get(entity); + } var calculation = new StructuresCalculation { @@ -57,6 +61,8 @@ }; ReadInputParameters(calculation.InputParameters, entity, collector); ReadOutput(calculation, entity); + + collector.Read(entity, calculation); return calculation; } Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensions.cs =================================================================== diff -u -r01d9fa228242fbc40d96844c43b10dd281e3edbf -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensions.cs (.../StabilityPointStructuresSectionResultEntityReadExtensions.cs) (revision 01d9fa228242fbc40d96844c43b10dd281e3edbf) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensions.cs (.../StabilityPointStructuresSectionResultEntityReadExtensions.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -38,17 +38,28 @@ /// /// The to create for. /// The target of the read operation. + /// The object keeping track of read operations. /// A new . - /// Thrown when is null. - internal static void Read(this StabilityPointStructuresSectionResultEntity entity, StabilityPointStructuresFailureMechanismSectionResult sectionResult) + /// Thrown when any input parameter is null. + internal static void Read(this StabilityPointStructuresSectionResultEntity entity, StabilityPointStructuresFailureMechanismSectionResult sectionResult, + ReadConversionCollector collector) { if (sectionResult == null) { throw new ArgumentNullException("sectionResult"); } + if (collector == null) + { + throw new ArgumentNullException("collector"); + } sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne); sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + + if (entity.StabilityPointStructuresCalculationEntity != null) + { + sectionResult.Calculation = entity.StabilityPointStructuresCalculationEntity.Read(collector); + } } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r43f72f0cd1f19b6bef02964ac191973d6077c74c -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 43f72f0cd1f19b6bef02964ac191973d6077c74c) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -192,7 +192,7 @@ - + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -ree999e492a57d9bbb3777754651e9f4722611075 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision ee999e492a57d9bbb3777754651e9f4722611075) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresSectionResultEntityReadExtensionsTest.cs (.../ClosingStructuresSectionResultEntityReadExtensionsTest.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -27,7 +27,6 @@ using NUnit.Framework; using Ringtoets.ClosingStructures.Data; using Ringtoets.Common.Data.Structures; -using Ringtoets.Integration.Data.StandAlone.SectionResults; namespace Application.Ringtoets.Storage.Test.Read.ClosingStructures { @@ -90,6 +89,7 @@ Assert.IsNotNull(sectionResult); Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + Assert.IsNull(sectionResult.Calculation); } [Test] Fisheye: Tag 6e33ada58f1a53a5a732c3b4e46583ad846a2983 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingStructureSectionResultEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/PipingStructures/PipingStructureSectionResultEntityReadExtensionsTest.cs (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -0,0 +1,108 @@ +// Copyright (C) Stichting Deltares 2016. 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read; +using Application.Ringtoets.Storage.Read.PipingStructures; +using Application.Ringtoets.Storage.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Read.PipingStructures +{ + [TestFixture] + public class PipingStructureSectionResultEntityReadExtensionsTest + { + [Test] + public void Read_SectionResultIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new PipingStructureSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResult", paramName); + } + + [Test] + [TestCase(true, AssessmentLayerTwoAResult.Failed)] + [TestCase(false, AssessmentLayerTwoAResult.Successful)] + [TestCase(false, AssessmentLayerTwoAResult.Failed)] + public void Read_WithDecimalParameterValues_ReturnPipingStructureSectionResultWithDoubleParameterValues(bool layerOne, AssessmentLayerTwoAResult layerTwoA) + { + // Setup + var random = new Random(21); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new PipingStructureSectionResultEntity + { + LayerThree = layerThree, + LayerTwoA = Convert.ToByte(layerTwoA), + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerTwoA, sectionResult.AssessmentLayerTwoA); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + } + + [Test] + [TestCase(true, AssessmentLayerTwoAResult.Failed)] + [TestCase(false, AssessmentLayerTwoAResult.Successful)] + [TestCase(false, AssessmentLayerTwoAResult.Failed)] + public void Read_WithNullLayerThree_ReturnPipingStructureSectionResultWithNullParameters(bool layerOne, AssessmentLayerTwoAResult layerTwoA) + { + // Setup + var collector = new ReadConversionCollector(); + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new PipingStructureSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerTwoA = Convert.ToByte(layerTwoA), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs =================================================================== diff -u -r4f89601cb9d77ff379727afd64f902a0aff74fa3 -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 4f89601cb9d77ff379727afd64f902a0aff74fa3) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ReadConversionCollectorTest.cs (.../ReadConversionCollectorTest.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -2148,5 +2148,154 @@ } #endregion + + #region StabilityPointStructuresCalculationEntity: Read, Contains, Get + + [Test] + public void Contains_WithoutStabilityPointStructuresCalculationEntity_ThrowsArgumentNullException() + { + // Setup + var collector = new ReadConversionCollector(); + + // Call + TestDelegate test = () => collector.Contains((StabilityPointStructuresCalculationEntity) null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("entity", paramName); + } + + [Test] + public void Contains_StabilityPointStructuresCalculationEntityAdded_ReturnsTrue() + { + // Setup + var collector = new ReadConversionCollector(); + var entity = new StabilityPointStructuresCalculationEntity(); + collector.Read(entity, new StructuresCalculation()); + + // Call + var result = collector.Contains(entity); + + // Assert + Assert.IsTrue(result); + } + + [Test] + public void Contains_NoStabilityPointStructuresCalculationEntityAdded_ReturnsFalse() + { + // Setup + var collector = new ReadConversionCollector(); + var entity = new StabilityPointStructuresCalculationEntity(); + + // Call + var result = collector.Contains(entity); + + // Assert + Assert.IsFalse(result); + } + + [Test] + public void Contains_OtherStabilityPointStructuresCalculationEntityAdded_ReturnsFalse() + { + // Setup + var collector = new ReadConversionCollector(); + var entity = new StabilityPointStructuresCalculationEntity(); + collector.Read(new StabilityPointStructuresCalculationEntity(), new StructuresCalculation()); + + // Call + var result = collector.Contains(entity); + + // Assert + Assert.IsFalse(result); + } + + [Test] + public void Get_WithoutStabilityPointStructuresCalculationEntity_ThrowsArgumentNullException() + { + // Setup + var collector = new ReadConversionCollector(); + + // Call + TestDelegate test = () => collector.Get((StabilityPointStructuresCalculationEntity) null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("entity", paramName); + } + + [Test] + public void Get_StabilityPointStructuresCalculationEntityAdded_ReturnsStabilityPointStructuresCalculation() + { + // Setup + var collector = new ReadConversionCollector(); + var calculation = new StructuresCalculation(); + var entity = new StabilityPointStructuresCalculationEntity(); + collector.Read(entity, calculation); + + // Call + var result = collector.Get(entity); + + // Assert + Assert.AreSame(calculation, result); + } + + [Test] + public void Get_NoStabilityPointStructuresCalculationEntityAdded_ThrowsInvalidOperationException() + { + // Setup + var collector = new ReadConversionCollector(); + var entity = new StabilityPointStructuresCalculationEntity(); + + // Call + TestDelegate test = () => collector.Get(entity); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Get_OtherStabilityPointStructuresCalculationEntityAdded_ThrowsInvalidOperationException() + { + // Setup + var collector = new ReadConversionCollector(); + var entity = new StabilityPointStructuresCalculationEntity(); + collector.Read(new StabilityPointStructuresCalculationEntity(), new StructuresCalculation()); + + // Call + TestDelegate test = () => collector.Get(entity); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Read_WithNullStabilityPointStructuresCalculationEntity_ThrowsArgumentNullException() + { + // Setup + var collector = new ReadConversionCollector(); + + // Call + TestDelegate test = () => collector.Read(null, new StructuresCalculation()); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("entity", paramName); + } + + [Test] + public void Read_WithNullStabilityPointStructuresCalculation_ThrowsArgumentNullException() + { + // Setup + var collector = new ReadConversionCollector(); + + // Call + TestDelegate test = () => collector.Read(new StabilityPointStructuresCalculationEntity(), null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("model", paramName); + } + + #endregion } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u -r481507356af9b0ed7ed0de2493275a6f8c2f47ea -r6e33ada58f1a53a5a732c3b4e46583ad846a2983 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs (.../StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs) (revision 481507356af9b0ed7ed0de2493275a6f8c2f47ea) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs (.../StabilityPointStructuresSectionResultEntityReadExtensionsTest.cs) (revision 6e33ada58f1a53a5a732c3b4e46583ad846a2983) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Read.StabilityPointStructures; using Application.Ringtoets.Storage.TestUtil; using NUnit.Framework; +using Ringtoets.Common.Data.Structures; using Ringtoets.StabilityPointStructures.Data; namespace Application.Ringtoets.Storage.Test.Read.StabilityPointStructures @@ -39,14 +40,29 @@ var entity = new StabilityPointStructuresSectionResultEntity(); // Call - TestDelegate call = () => entity.Read(null); + TestDelegate call = () => entity.Read(null, new ReadConversionCollector()); // Assert string paramName = Assert.Throws(call).ParamName; Assert.AreEqual("sectionResult", paramName); } [Test] + public void Read_CollectorIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new StabilityPointStructuresSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(new StabilityPointStructuresFailureMechanismSectionResult( + new TestFailureMechanismSection()), null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("collector", paramName); + } + + [Test] [TestCase(true)] [TestCase(false)] public void Read_WithDecimalParameterValues_ReturnSectionResultWithDoubleParameterValues(bool layerOne) @@ -67,12 +83,13 @@ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - entity.Read(sectionResult); + entity.Read(sectionResult, collector); // Assert Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); Assert.IsNotNull(sectionResult); + Assert.IsNull(sectionResult.Calculation); } [Test] @@ -91,7 +108,7 @@ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - entity.Read(sectionResult); + entity.Read(sectionResult, collector); // Assert Assert.IsNaN(sectionResult.AssessmentLayerTwoA); @@ -113,10 +130,33 @@ var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); // Call - entity.Read(sectionResult); + entity.Read(sectionResult, collector); // Assert Assert.IsNaN(sectionResult.AssessmentLayerThree); } + + [Test] + public void Read_CalculationEntitySet_ReturnStabilityPointStructuresSectionResultWithCalculation() + { + // Setup + var calculation = new StructuresCalculation(); + var calculationEntity = new StabilityPointStructuresCalculationEntity(); + + var collector = new ReadConversionCollector(); + collector.Read(calculationEntity, calculation); + + var entity = new StabilityPointStructuresSectionResultEntity + { + StabilityPointStructuresCalculationEntity = calculationEntity + }; + var sectionResult = new StabilityPointStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult, collector); + + // Assert + Assert.AreSame(calculation, sectionResult.Calculation); + } } } \ No newline at end of file