Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r293206f556097f4aa2b3da952ce5dcff8b60210a -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 293206f556097f4aa2b3da952ce5dcff8b60210a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -57,60 +57,60 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + RingtoetsEntities.tt Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs =================================================================== diff -u -r424e934ab7fcdef2661e3fee605423ee9fd1b489 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 424e934ab7fcdef2661e3fee605423ee9fd1b489) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/AssessmentSectionCreateExtensions.cs (.../AssessmentSectionCreateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -20,6 +20,25 @@ // All rights reserved. using System; + +using Application.Ringtoets.Storage.Create.ClosingStructure; +using Application.Ringtoets.Storage.Create.DuneErosion; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards; +using Application.Ringtoets.Storage.Create.HeightStructures; +using Application.Ringtoets.Storage.Create.MacrostabilityInwards; +using Application.Ringtoets.Storage.Create.MacrostabilityOutwards; +using Application.Ringtoets.Storage.Create.Microstability; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.Create.PipingStructure; +using Application.Ringtoets.Storage.Create.StabilityStoneCover; +using Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise; +using Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction; +using Application.Ringtoets.Storage.Create.TechnicalInnovation; +using Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover; +using Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover; using Application.Ringtoets.Storage.DbContext; using Ringtoets.Integration.Data; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs =================================================================== diff -u -rbba617101367a21a38bf41ad520662058b9012af -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs (.../CalculationGroupCreateExtensions.cs) (revision bba617101367a21a38bf41ad520662058b9012af) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/CalculationGroupCreateExtensions.cs (.../CalculationGroupCreateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Ringtoets.Common.Data.Calculation; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.ClosingStructure +{ + /// + /// Extension methods for related to creating a . + /// + internal static class ClosingStructureFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this ClosingStructureFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.ReliabilityClosingOfStructure, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.ClosingStructureSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.ClosingStructure +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class ClosingStructureFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static ClosingStructureSectionResultEntity Create(this ClosingStructureFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new ClosingStructureSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal(), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructureFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructureFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DikeProfileCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.DuneErosion +{ + /// + /// Extension methods for related to creating a . + /// + internal static class DuneErosionFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this DuneErosionFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.DuneErosion, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.DuneErosionSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.DuneErosion +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class DuneErosionFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static DuneErosionSectionResultEntity Create(this DuneErosionFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new DuneErosionSectionResultEntity + { + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosionFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/DuneErosionFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GeneralGrassCoverErosionInwardsInputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeProfileCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeProfileCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/DikeProfileCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,70 @@ +// 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.BinaryConverters; +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionInwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class DikeProfileCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static DikeProfileEntity Create(this DikeProfile dikeProfile, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new DikeProfileEntity + { + X = dikeProfile.WorldReferencePoint.X, + Y = dikeProfile.WorldReferencePoint.Y, + X0 = dikeProfile.X0, + DikeGeometryData = new RoughnessPointBinaryConverter().ToBytes(dikeProfile.DikeGeometry), + ForeShoreData = new Point2DBinaryConverter().ToBytes(dikeProfile.ForeshoreGeometry), + Orientation = dikeProfile.Orientation, + DikeHeight = dikeProfile.DikeHeight, + Name = dikeProfile.Name + }; + if (dikeProfile.HasBreakWater) + { + sectionResultEntity.BreakWaterHeight = dikeProfile.BreakWater.Height; + sectionResultEntity.BreakWaterType = Convert.ToByte(dikeProfile.BreakWater.Type); + } + + registry.Register(sectionResultEntity, dikeProfile); + return sectionResultEntity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionInwards +{ + /// + /// Extension methods for related + /// to creating a . + /// + internal static class GeneralGrassCoverErosionInwardsInputCreateExtensions + { + /// + /// Creates a based + /// on the information of the . + /// + /// The general calculation input for Grass Cover Erosion Inwards + /// to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static GrassCoverErosionInwardsFailureMechanismMetaEntity Create(this GeneralGrassCoverErosionInwardsInput input, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + var entity = new GrassCoverErosionInwardsFailureMechanismMetaEntity + { + N = input.N + }; + registry.Register(entity, input); + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,81 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionInwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class GrassCoverErosionInwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this GrassCoverErosionInwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.GrassRevetmentTopErosionAndInwards, registry); + AddEntitiesForGeneralInput(mechanism, registry, entity); + AddEntitiesForDikeProfiles(mechanism, registry, entity); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + entity.CalculationGroupEntity = mechanism.CalculationsGroup.Create(registry, 0); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForGeneralInput(GrassCoverErosionInwardsFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity) + { + entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Add(mechanism.GeneralInput.Create(registry)); + } + + private static void AddEntitiesForDikeProfiles(GrassCoverErosionInwardsFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity) + { + foreach (DikeProfile dikeProfile in mechanism.DikeProfiles) + { + entity.DikeProfileEntities.Add(dikeProfile.Create(registry)); + } + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.GrassCoverErosionInwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionInwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static GrassCoverErosionInwardsSectionResultEntity Create(this GrassCoverErosionInwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new GrassCoverErosionInwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class GrassCoverErosionOutwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this GrassCoverErosionOutwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.GrassRevetmentErosionOutwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.GrassCoverErosionOutwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static GrassCoverErosionOutwardsSectionResultEntity Create(this GrassCoverErosionOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new GrassCoverErosionOutwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class GrassCoverSlipOffInwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this GrassCoverSlipOffInwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.GrassRevetmentSlidingInwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.GrassCoverSlipOffInwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static GrassCoverSlipOffInwardsSectionResultEntity Create(this GrassCoverSlipOffInwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new GrassCoverSlipOffInwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class GrassCoverSlipOffOutwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this GrassCoverSlipOffOutwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.GrassRevetmentSlidingOutwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.GrassCoverSlipOffOutwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static GrassCoverSlipOffOutwardsSectionResultEntity Create(this GrassCoverSlipOffOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new GrassCoverSlipOffOutwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,64 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Create.HeightStructures +{ + /// + /// Extension methods for related to creating a . + /// + internal static class HeightStructuresFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this HeightStructuresFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.StructureHeight, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.HeightStructuresSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Create.HeightStructures +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class HeightStructuresFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static HeightStructuresSectionResultEntity Create(this HeightStructuresFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var heightStructuresSectionResultEntity = new HeightStructuresSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(heightStructuresSectionResultEntity, result); + return heightStructuresSectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructuresFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructuresFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityInwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class MacrostabilityInwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this MacrostabilityInwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.MacrostabilityInwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.MacrostabilityInwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityInwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static MacrostabilityInwardsSectionResultEntity Create(this MacrostabilityInwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new MacrostabilityInwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal(), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityOutwards +{ + /// + /// Extension methods for related to creating a . + /// + internal static class MacrostabilityOutwardsFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this MacrostabilityOutwardsFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.MacrostabilityOutwards, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.MacrostabilityOutwardsSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.MacrostabilityOutwards +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static MacrostabilityOutwardsSectionResultEntity Create(this MacrostabilityOutwardsFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new MacrostabilityOutwardsSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal(), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwardsFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.Microstability +{ + /// + /// Extension methods for related to creating a . + /// + internal static class MicrostabilityFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this MicrostabilityFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.Microstability, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.MicrostabilitySectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.Microstability +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class MicrostabilityFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static MicrostabilitySectionResultEntity Create(this MicrostabilityFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new MicrostabilitySectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MicrostabilityFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MicrostabilityFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingCalculationScenarioCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingCalculationScenarioCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingCalculationScenarioCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,120 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating + /// an . + /// + internal static class PipingCalculationScenarioCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The piping calculation to create a database entity for. + /// The object keeping track of create operations. + /// The index at which resides within its parent. + /// A new . + /// Thrown when is null. + internal static PipingCalculationEntity Create(this PipingCalculationScenario calculation, PersistenceRegistry registry, int order) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + var entity = new PipingCalculationEntity + { + RelevantForScenario = Convert.ToByte(calculation.IsRelevant), + ScenarioContribution = Convert.ToDecimal(calculation.Contribution), + Name = calculation.Name, + Comments = calculation.Comments, + Order = order + }; + SetInputParametersToEntity(entity, calculation.InputParameters, registry); + CreatePipingOutputEntity(entity, calculation.Output, registry); + CreatePipingSemiProbabilisticOutputEntity(entity, calculation.SemiProbabilisticOutput, registry); + + registry.Register(entity, calculation); + + return entity; + } + + private static void SetInputParametersToEntity(PipingCalculationEntity entity, PipingInput inputParameters, PersistenceRegistry registry) + { + if (inputParameters.SurfaceLine != null) + { + entity.SurfaceLineEntity = inputParameters.SurfaceLine.Create(registry); + } + if (inputParameters.HydraulicBoundaryLocation != null) + { + entity.HydraulicLocationEntity = inputParameters.HydraulicBoundaryLocation.Create(registry); + } + if (inputParameters.StochasticSoilProfile != null) + { + inputParameters.StochasticSoilModel.Create(registry); + entity.StochasticSoilProfileEntity = registry.Get(inputParameters.StochasticSoilProfile); + } + + entity.ExitPointL = inputParameters.ExitPointL.Value.ToNullableDecimal(); + entity.EntryPointL = inputParameters.EntryPointL.Value.ToNullableDecimal(); + + entity.PhreaticLevelExitMean = Convert.ToDecimal(inputParameters.PhreaticLevelExit.Mean); + entity.PhreaticLevelExitStandardDeviation = Convert.ToDecimal(inputParameters.PhreaticLevelExit.StandardDeviation); + + entity.DampingFactorExitMean = Convert.ToDecimal(inputParameters.DampingFactorExit.Mean); + entity.DampingFactorExitStandardDeviation = Convert.ToDecimal(inputParameters.DampingFactorExit.StandardDeviation); + + entity.SaturatedVolumicWeightOfCoverageLayerMean = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean); + entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation); + entity.SaturatedVolumicWeightOfCoverageLayerShift = Convert.ToDecimal(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift); + + entity.Diameter70Mean = Convert.ToDecimal(inputParameters.Diameter70.Mean); + entity.Diameter70StandardDeviation = Convert.ToDecimal(inputParameters.Diameter70.StandardDeviation); + + entity.DarcyPermeabilityMean = Convert.ToDecimal(inputParameters.DarcyPermeability.Mean); + entity.DarcyPermeabilityStandardDeviation = Convert.ToDecimal(inputParameters.DarcyPermeability.StandardDeviation); + } + + private static void CreatePipingOutputEntity(PipingCalculationEntity entity, PipingOutput output, PersistenceRegistry registry) + { + if (output != null) + { + entity.PipingCalculationOutputEntity = output.Create(registry); + } + } + + private static void CreatePipingSemiProbabilisticOutputEntity(PipingCalculationEntity entity, PipingSemiProbabilisticOutput output, PersistenceRegistry registry) + { + if (output != null) + { + entity.PipingSemiProbabilisticOutputEntity = output.Create(registry); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,92 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating a . + /// + internal static class PipingFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this PipingFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.Piping, registry); + + AddEntitiesForFailureMechanismMeta(mechanism, registry, entity); + AddEntitiesForStochasticSoilModels(mechanism, registry, entity); + AddEntitiesForSurfaceLines(mechanism, registry, entity); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + entity.CalculationGroupEntity = mechanism.CalculationsGroup.Create(registry, 0); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var pipingFailureMechanismSectionResult in sectionResults) + { + var pipingSectionResultEntity = pipingFailureMechanismSectionResult.Create(registry); + var section = registry.Get(pipingFailureMechanismSectionResult.Section); + section.PipingSectionResultEntities.Add(pipingSectionResultEntity); + } + } + + private static void AddEntitiesForFailureMechanismMeta(PipingFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity) + { + entity.PipingFailureMechanismMetaEntities.Add(mechanism.PipingProbabilityAssessmentInput.Create(registry)); + } + + private static void AddEntitiesForStochasticSoilModels(PipingFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity) + { + foreach (var stochasticSoilModel in mechanism.StochasticSoilModels) + { + entity.StochasticSoilModelEntities.Add(stochasticSoilModel.Create(registry)); + } + } + + private static void AddEntitiesForSurfaceLines(PipingFailureMechanism mechanism, PersistenceRegistry registry, FailureMechanismEntity entity) + { + foreach (RingtoetsPipingSurfaceLine surfaceLine in mechanism.SurfaceLines) + { + entity.SurfaceLineEntities.Add(surfaceLine.Create(registry)); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class PipingFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static PipingSectionResultEntity Create(this PipingFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var pipingSectionResultEntity = new PipingSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(pipingSectionResultEntity, result); + return pipingSectionResultEntity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingOutputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingOutputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingOutputCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,63 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating an . + /// + internal static class PipingOutputCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// The calculation output for piping failure mechanism to + /// create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static PipingCalculationOutputEntity Create(this PipingOutput output, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var entity = new PipingCalculationOutputEntity + { + HeaveFactorOfSafety = output.HeaveFactorOfSafety.ToNullableDecimal(), + HeaveZValue = output.HeaveZValue.ToNullableDecimal(), + SellmeijerFactorOfSafety = output.SellmeijerFactorOfSafety.ToNullableDecimal(), + SellmeijerZValue = output.SellmeijerZValue.ToNullableDecimal(), + UpliftFactorOfSafety = output.UpliftFactorOfSafety.ToNullableDecimal(), + UpliftZValue = output.UpliftZValue.ToNullableDecimal() + }; + registry.Register(entity, output); + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingProbabilityAssessmentInputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingProbabilityAssessmentInputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingProbabilityAssessmentInputCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating a . + /// + internal static class PipingProbabilityAssessmentInputCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The piping probability assessment input to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static PipingFailureMechanismMetaEntity Create(this PipingProbabilityAssessmentInput assessmentInput, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + var entity = new PipingFailureMechanismMetaEntity + { + A = Convert.ToDecimal(assessmentInput.A) + }; + + registry.Register(entity, assessmentInput); + + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSemiProbabilisticOutputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSemiProbabilisticOutputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSemiProbabilisticOutputCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,72 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating + /// a . + /// + internal static class PipingSemiProbabilisticOutputCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// The semi-probabilistic calculation output + /// for piping to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static PipingSemiProbabilisticOutputEntity Create(this PipingSemiProbabilisticOutput semiProbabilisticOutput, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var entity = new PipingSemiProbabilisticOutputEntity + { + UpliftFactorOfSafety = semiProbabilisticOutput.UpliftFactorOfSafety.Value.ToNullableDecimal(), + UpliftReliability = semiProbabilisticOutput.UpliftReliability.Value.ToNullableDecimal(), + UpliftProbability = semiProbabilisticOutput.UpliftProbability.ToNullableDecimal(), + HeaveFactorOfSafety = semiProbabilisticOutput.HeaveFactorOfSafety.Value.ToNullableDecimal(), + HeaveReliability = semiProbabilisticOutput.HeaveReliability.Value.ToNullableDecimal(), + HeaveProbability = semiProbabilisticOutput.HeaveProbability.ToNullableDecimal(), + SellmeijerFactorOfSafety = semiProbabilisticOutput.SellmeijerFactorOfSafety.Value.ToNullableDecimal(), + SellmeijerReliability = semiProbabilisticOutput.SellmeijerReliability.Value.ToNullableDecimal(), + SellmeijerProbability = semiProbabilisticOutput.SellmeijerProbability.ToNullableDecimal(), + RequiredProbability = semiProbabilisticOutput.RequiredProbability.ToNullableDecimal(), + RequiredReliability = semiProbabilisticOutput.RequiredReliability.Value.ToNullableDecimal(), + PipingProbability = semiProbabilisticOutput.PipingProbability.ToNullableDecimal(), + PipingReliability = semiProbabilisticOutput.PipingReliability.Value.ToNullableDecimal(), + PipingFactorOfSafety = semiProbabilisticOutput.PipingFactorOfSafety.Value.ToNullableDecimal(), + }; + registry.Register(entity, semiProbabilisticOutput); + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilLayerCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilLayerCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilLayerCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,68 @@ +// 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 Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating a . + /// + internal static class PipingSoilLayerCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The layer to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static SoilLayerEntity Create(this PipingSoilLayer layer, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + var entity = new SoilLayerEntity + { + IsAquifer = Convert.ToByte(layer.IsAquifer), + Top = layer.Top, + BelowPhreaticLevelMean = layer.BelowPhreaticLevelMean.ToNaNAsNull(), + BelowPhreaticLevelDeviation = layer.BelowPhreaticLevelDeviation.ToNaNAsNull(), + BelowPhreaticLevelShift = layer.BelowPhreaticLevelShift.ToNaNAsNull(), + DiameterD70Mean = layer.DiameterD70Mean.ToNaNAsNull(), + DiameterD70Deviation = layer.DiameterD70Deviation.ToNaNAsNull(), + PermeabilityMean = layer.PermeabilityMean.ToNaNAsNull(), + PermeabilityDeviation = layer.PermeabilityDeviation.ToNaNAsNull(), + Color = layer.Color.ToArgb(), + MaterialName = layer.MaterialName + }; + + registry.Register(entity, layer); + return entity; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/PipingSoilProfileCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,74 @@ +// 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 Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating a . + /// + internal static class PipingSoilProfileCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The profile to create a database entity for. + /// The object keeping track of create operations. + /// A new or one from the if it + /// was created for the earlier. + /// Thrown when is null. + internal static SoilProfileEntity Create(this PipingSoilProfile profile, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + + if (registry.Contains(profile)) + { + return registry.Get(profile); + } + var entity = new SoilProfileEntity + { + Name = profile.Name, + Bottom = Convert.ToDecimal(profile.Bottom) + }; + + AddEntitiesForPipingSoilLayers(profile, registry, entity); + + registry.Register(entity, profile); + return entity; + } + + private static void AddEntitiesForPipingSoilLayers(PipingSoilProfile profile, PersistenceRegistry registry, SoilProfileEntity entity) + { + foreach (var pipingSoilLayer in profile.Layers) + { + entity.SoilLayerEntities.Add(pipingSoilLayer.Create(registry)); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,131 @@ +// 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.Geometry; + +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extensions methods for related to creating + /// a . + /// + internal static class RingtoetsPipingSurfaceLineCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The surface line to create a database entity for. + /// The object keeping track of create operations. + /// a new . + /// Thrown when is null. + internal static SurfaceLineEntity Create(this RingtoetsPipingSurfaceLine surfaceLine, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + if (registry.Contains(surfaceLine)) + { + return registry.Get(surfaceLine); + } + + var entity = new SurfaceLineEntity + { + Name = surfaceLine.Name, + ReferenceLineIntersectionX = Convert.ToDecimal(surfaceLine.ReferenceLineIntersectionWorldPoint.X), + ReferenceLineIntersectionY = Convert.ToDecimal(surfaceLine.ReferenceLineIntersectionWorldPoint.Y) + }; + CreateSurfaceLinePointEntities(surfaceLine, registry, entity); + CreateCharacteristicPointEntities(surfaceLine, registry); + + registry.Register(entity, surfaceLine); + + return entity; + } + + private static void CreateSurfaceLinePointEntities(RingtoetsPipingSurfaceLine surfaceLine, PersistenceRegistry registry, SurfaceLineEntity entity) + { + int order = 0; + foreach (Point3D point3D in surfaceLine.Points) + { + entity.SurfaceLinePointEntities.Add(point3D.CreateSurfaceLinePointEntity(registry, order++)); + } + } + + private static void CreateCharacteristicPointEntities(RingtoetsPipingSurfaceLine surfaceLine, PersistenceRegistry registry) + { + if (surfaceLine.BottomDitchPolderSide != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.BottomDitchPolderSide); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.BottomDitchPolderSide + }); + } + if (surfaceLine.BottomDitchDikeSide != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.BottomDitchDikeSide); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.BottomDitchDikeSide + }); + } + if (surfaceLine.DikeToeAtPolder != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.DikeToeAtPolder); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtPolder + }); + } + if (surfaceLine.DikeToeAtRiver != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.DikeToeAtRiver); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.DikeToeAtRiver + }); + } + if (surfaceLine.DitchDikeSide != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.DitchDikeSide); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.DitchDikeSide + }); + } + if (surfaceLine.DitchPolderSide != null) + { + SurfaceLinePointEntity characteristicPointEntity = registry.GetSurfaceLinePoint(surfaceLine.DitchPolderSide); + characteristicPointEntity.CharacteristicPointEntities.Add(new CharacteristicPointEntity + { + CharacteristicPointType = (short)CharacteristicPointType.DitchPolderSide + }); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilModelCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,86 @@ +// 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.Geometry; + +using Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating database entities. + /// + internal static class StochasticSoilModelCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The model to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StochasticSoilModelEntity Create(this StochasticSoilModel model, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + if (registry.Contains(model)) + { + return registry.Get(model); + } + + var entity = new StochasticSoilModelEntity + { + Name = model.Name, + SegmentName = model.SegmentName + }; + + AddEntitiesForStochasticSoilProfiles(model, registry, entity); + AddEntitiesForGeometryPoints(model, entity); + + registry.Register(entity, model); + return entity; + } + + private static void AddEntitiesForStochasticSoilProfiles(StochasticSoilModel model, PersistenceRegistry registry, StochasticSoilModelEntity entity) + { + foreach (var stochasticSoilProfile in model.StochasticSoilProfiles) + { + entity.StochasticSoilProfileEntities.Add(stochasticSoilProfile.Create(registry)); + } + } + + private static void AddEntitiesForGeometryPoints(StochasticSoilModel model, StochasticSoilModelEntity entity) + { + for (int i = 0; i < model.Geometry.Count; i++) + { + Point2D geometryPoint = model.Geometry[i]; + StochasticSoilModelSegmentPointEntity pointEntity = geometryPoint.CreateStochasticSoilModelSegmentPointEntity(i); + entity.StochasticSoilModelSegmentPointEntities.Add(pointEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilProfileCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilProfileCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Piping/StochasticSoilProfileCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,58 @@ +// 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 Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Create.Piping +{ + /// + /// Extension methods for related to creating database entities. + /// + internal static class StochasticSoilProfileCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The profile to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StochasticSoilProfileEntity Create(this StochasticSoilProfile profile, PersistenceRegistry registry) + { + var entity = new StochasticSoilProfileEntity + { + Probability = Convert.ToDecimal(profile.Probability), + SoilProfileEntity = profile.SoilProfile.Create(registry) + }; + if (registry.Contains(profile)) + { + return registry.Get(profile); + } + + registry.Register(entity, profile); + return entity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingCalculationScenarioCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingOutputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingProbabilityAssessmentInputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSemiProbabilisticOutputCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSoilLayerCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingSoilProfileCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.PipingStructure +{ + /// + /// Extension methods for related to creating a . + /// + internal static class PipingStructureFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this PipingStructureFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.PipingAtStructure, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.PipingStructureSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.PipingStructure +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class PipingStructureFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static PipingStructureSectionResultEntity Create(this PipingStructureFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new PipingStructureSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructureFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/PipingStructureFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/RingtoetsPipingSurfaceLineCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StabilityStoneCover +{ + /// + /// Extension methods for related to creating a . + /// + internal static class StabilityStoneCoverFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this StabilityStoneCoverFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.StabilityStoneRevetment, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.StabilityStoneCoverSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StabilityStoneCover +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class StabilityStoneCoverFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StabilityStoneCoverSectionResultEntity Create(this StabilityStoneCoverFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new StabilityStoneCoverSectionResultEntity + { + LayerTwoA = Convert.ToByte(result.AssessmentLayerTwoA), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCoverFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityStoneCoverFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StochasticSoilModelCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StochasticSoilProfileCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise +{ + /// + /// Extension methods for related to creating a . + /// + internal static class StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this StrengthStabilityLengthwiseConstructionFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.StrengthAndStabilityParallelConstruction, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.StrengthStabilityLengthwiseConstructionSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StrengthStabilityLengthwiseConstructionSectionResultEntity Create(this StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new StrengthStabilityLengthwiseConstructionSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction +{ + /// + /// Extension methods for related to creating a . + /// + internal static class StrengthStabilityPointConstructionFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this StrengthStabilityPointConstructionFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.StrengthAndStabilityPointConstruction, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.StrengthStabilityPointConstructionSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static StrengthStabilityPointConstructionSectionResultEntity Create(this StrengthStabilityPointConstructionFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new StrengthStabilityPointConstructionSectionResultEntity + { + LayerTwoA = result.AssessmentLayerTwoA.ToNullableDecimal(), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.TechnicalInnovation +{ + /// + /// Extension methods for related to creating a . + /// + internal static class TechnicalInnovationFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this TechnicalInnovationFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.TechnicalInnovations, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.TechnicalInnovationSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.TechnicalInnovation +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class TechnicalInnovationFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static TechnicalInnovationSectionResultEntity Create(this TechnicalInnovationFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new TechnicalInnovationSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovationFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/TechnicalInnovationFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover +{ + /// + /// Extension methods for related to creating a . + /// + internal static class WaterPressureAsphaltCoverFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this WaterPressureAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.WaterOverpressureAsphaltRevetment, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.WaterPressureAsphaltCoverSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,59 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static WaterPressureAsphaltCoverSectionResultEntity Create(this WaterPressureAsphaltCoverFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new WaterPressureAsphaltCoverSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCoverFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,65 @@ +// 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 System.Collections.Generic; + +using Application.Ringtoets.Storage.DbContext; + +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover +{ + /// + /// Extension methods for related to creating a . + /// + internal static class WaveImpactAsphaltCoverFailureMechanismCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The failure mechanism to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static FailureMechanismEntity Create(this WaveImpactAsphaltCoverFailureMechanism mechanism, PersistenceRegistry registry) + { + var entity = mechanism.Create(FailureMechanismType.WaveImpactOnAsphaltRevetment, registry); + AddEntitiesForSectionResults(mechanism.SectionResults, registry); + + registry.Register(entity, mechanism); + return entity; + } + + private static void AddEntitiesForSectionResults( + IEnumerable sectionResults, + PersistenceRegistry registry) + { + foreach (var failureMechanismSectionResult in sectionResults) + { + var sectionResultEntity = failureMechanismSectionResult.Create(registry); + var section = registry.Get(failureMechanismSectionResult.Section); + section.WaveImpactAsphaltCoverSectionResultEntities.Add(sectionResultEntity); + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,60 @@ +// 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 Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover +{ + /// + /// Extension methods for related to creating a + /// . + /// + internal static class WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensions + { + /// + /// Creates a based on the information of the . + /// + /// The result to create a database entity for. + /// The object keeping track of create operations. + /// A new . + /// Thrown when is null. + internal static WaveImpactAsphaltCoverSectionResultEntity Create(this WaveImpactAsphaltCoverFailureMechanismSectionResult result, PersistenceRegistry registry) + { + if (registry == null) + { + throw new ArgumentNullException("registry"); + } + var sectionResultEntity = new WaveImpactAsphaltCoverSectionResultEntity + { + LayerOne = Convert.ToByte(result.AssessmentLayerOne), + LayerTwoA = result.AssessmentLayerTwoA.Value.ToNullableDecimal(), + LayerThree = result.AssessmentLayerThree.Value.ToNullableDecimal() + }; + + registry.Register(sectionResultEntity, result); + return sectionResultEntity; + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCoverFailureMechanismCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Create/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs (.../CalculationGroupUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/CalculationGroupUpdateExtensions.cs (.../CalculationGroupUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -23,6 +23,7 @@ using System.Linq; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Common.Data.Calculation; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructureFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructureFailureMechanismUpdateExtensions.cs (.../ClosingStructureFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/ClosingStructureFailureMechanismUpdateExtensions.cs (.../ClosingStructureFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.ClosingStructure; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosionFailureMechanismUpdateExtensions.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosionFailureMechanismUpdateExtensions.cs (.../DuneErosionFailureMechanismUpdateExtensions.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/DuneErosionFailureMechanismUpdateExtensions.cs (.../DuneErosionFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.DuneErosion; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r93f4c75ba2309bb82de7e2362bafca5aa516d545 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs) (revision 93f4c75ba2309bb82de7e2362bafca5aa516d545) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverErosionInwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r4a12b47ea94488f0716d7c61c6cefba235d7db48 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs) (revision 4a12b47ea94488f0716d7c61c6cefba235d7db48) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverErosionOutwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverSlipOffInwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs (.../GrassCoverSlipOffOutwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructuresFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructuresFailureMechanismUpdateExtensions.cs (.../HeightStructuresFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/HeightStructuresFailureMechanismUpdateExtensions.cs (.../HeightStructuresFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.HeightStructures; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -rb4816e19c7167c26fad825b88dd72b59dcedc13a -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs (.../MacrostabilityInwardsFailureMechanismUpdateExtensions.cs) (revision b4816e19c7167c26fad825b88dd72b59dcedc13a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityInwardsFailureMechanismUpdateExtensions.cs (.../MacrostabilityInwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityInwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs =================================================================== diff -u -rb4816e19c7167c26fad825b88dd72b59dcedc13a -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs (.../MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs) (revision b4816e19c7167c26fad825b88dd72b59dcedc13a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs (.../MacrostabilityOutwardsFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityOutwards; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MicrostabilityFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MicrostabilityFailureMechanismUpdateExtensions.cs (.../MicrostabilityFailureMechanismUpdateExtensions.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/MicrostabilityFailureMechanismUpdateExtensions.cs (.../MicrostabilityFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Microstability; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingCalculationScenarioUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingCalculationScenarioUpdateExtensions.cs (.../PipingCalculationScenarioUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingCalculationScenarioUpdateExtensions.cs (.../PipingCalculationScenarioUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Piping.Data; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingFailureMechanismUpdateExtensions.cs (.../PipingFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingFailureMechanismUpdateExtensions.cs (.../PipingFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingSoilProfileUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingSoilProfileUpdateExtensions.cs (.../PipingSoilProfileUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingSoilProfileUpdateExtensions.cs (.../PipingSoilProfileUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Piping.Primitives; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructureFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r0e4717786f2f1a865e48da9fde2089a789bfe02c -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructureFailureMechanismUpdateExtensions.cs (.../PipingStructureFailureMechanismUpdateExtensions.cs) (revision 0e4717786f2f1a865e48da9fde2089a789bfe02c) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/PipingStructureFailureMechanismUpdateExtensions.cs (.../PipingStructureFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.PipingStructure; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCoverFailureMechanismUpdateExtensions.cs =================================================================== diff -u -rc482712c0ff06d5654836fc8d9af535641d63ffb -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCoverFailureMechanismUpdateExtensions.cs (.../StabilityStoneCoverFailureMechanismUpdateExtensions.cs) (revision c482712c0ff06d5654836fc8d9af535641d63ffb) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StabilityStoneCoverFailureMechanismUpdateExtensions.cs (.../StabilityStoneCoverFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StabilityStoneCover; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilModelUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilModelUpdateExtensions.cs (.../StochasticSoilModelUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilModelUpdateExtensions.cs (.../StochasticSoilModelUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Core.Common.Base.Geometry; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilProfileUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilProfileUpdateExtensions.cs (.../StochasticSoilProfileUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StochasticSoilProfileUpdateExtensions.cs (.../StochasticSoilProfileUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Piping.Data; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs (.../StrengthStabilityLengthwiseConstructionFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r8a15fe6e429a0f177f25defaf1851c9963374dbe -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (.../StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs) (revision 8a15fe6e429a0f177f25defaf1851c9963374dbe) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs (.../StrengthStabilityPointConstructionFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovationFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovationFailureMechanismUpdateExtensions.cs (.../TechnicalInnovationFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/TechnicalInnovationFailureMechanismUpdateExtensions.cs (.../TechnicalInnovationFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.TechnicalInnovation; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs =================================================================== diff -u -r5b3736b5350315a520f72c90222af261ea651019 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs (.../WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs) (revision 5b3736b5350315a520f72c90222af261ea651019) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs (.../WaterPressureAsphaltCoverFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs =================================================================== diff -u -rb4816e19c7167c26fad825b88dd72b59dcedc13a -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs (.../WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs) (revision b4816e19c7167c26fad825b88dd72b59dcedc13a) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Update/WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs (.../WaveImpactAsphaltCoverFailureMechanismUpdateExtensions.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -21,6 +21,7 @@ using System; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Ringtoets.Integration.Data.StandAlone; Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r53aef346fd0ee3cc79d1f5df9171c476453f2935 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 53aef346fd0ee3cc79d1f5df9171c476453f2935) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -85,61 +85,61 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.ClosingStructure; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.ClosingStructure +{ + [TestFixture] + public class ClosingStructureFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new ClosingStructureFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new ClosingStructureFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.ReliabilityClosingOfStructure, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new ClosingStructureFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new ClosingStructureFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.ClosingStructureSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructure/ClosingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -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.Create; +using Application.Ringtoets.Storage.Create.ClosingStructure; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.ClosingStructure +{ + [TestFixture] + public class ClosingStructureFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(0.2, 0.523)] double assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerTwoA); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new ClosingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructureFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructureFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DikeProfileCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.DuneErosion; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.DuneErosion +{ + [TestFixture] + public class DuneErosionFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.DuneErosion, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new DuneErosionFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.DuneErosionSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosion/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,90 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.DuneErosion; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.DuneErosion +{ + [TestFixture] + public class DuneErosionFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new DuneErosionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosionFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/DuneErosionFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/DikeProfileCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,198 @@ +// 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 System.Collections; + +using Application.Ringtoets.Storage.BinaryConverters; +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.DbContext; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionInwards +{ + [TestFixture] + public class DikeProfileCreateExtensionsTest + { + [Test] + public void Create_RegistryIsNull_ThrowArgumentNullException() + { + // Setup + var dikeProfile = new DikeProfile(new Point2D(1.1, 2.2), + new[] + { + new RoughnessPoint(new Point2D(3.3, 4.4), 0.75), + new RoughnessPoint(new Point2D(5.5, 6.6), 0.75) + }, + new[] + { + new Point2D(7.7, 8.8), + new Point2D(9.9, 10.10) + }, + null, + new DikeProfile.ConstructionProperties()); + + // Call + TestDelegate call = () => dikeProfile.Create(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_WithoutBreakWater_ReturnEntityWithNullBreakWaterProperties() + { + // Setup + var dikeProfile = new DikeProfile(new Point2D(1.1, 2.2), + new[] + { + new RoughnessPoint(new Point2D(3.3, 4.4), 0.75), + new RoughnessPoint(new Point2D(5.5, 6.6), 0.75) + }, + new[] + { + new Point2D(7.7, 8.8), + new Point2D(9.9, 10.10) + }, + null, + new DikeProfile.ConstructionProperties + { + Name = "Dike profile without break water.", + DikeHeight = 11.11, + Orientation = 12.12, + X0 = 13.13 + }); + var registry = new PersistenceRegistry(); + + // Call + DikeProfileEntity entity = dikeProfile.Create(registry); + + // Assert + Assert.AreEqual(dikeProfile.WorldReferencePoint.X, entity.X); + Assert.AreEqual(dikeProfile.WorldReferencePoint.Y, entity.Y); + Assert.AreEqual(dikeProfile.X0, entity.X0); + RoughnessPoint[] convertedDikeGeometry = new RoughnessPointBinaryConverter().ToData(entity.DikeGeometryData); + CollectionAssert.AreEqual(dikeProfile.DikeGeometry, convertedDikeGeometry, new RoughnessPointComparer()); + Point2D[] convertedForeshoreGeometry = new Point2DBinaryConverter().ToData(entity.ForeShoreData); + CollectionAssert.AreEqual(dikeProfile.ForeshoreGeometry, convertedForeshoreGeometry); + Assert.AreEqual(dikeProfile.Orientation.Value, entity.Orientation); + Assert.AreEqual(dikeProfile.DikeHeight.Value, entity.DikeHeight); + Assert.AreEqual(dikeProfile.Name, entity.Name); + + Assert.IsNull(entity.BreakWaterHeight); + Assert.IsNull(entity.BreakWaterType); + } + + [Test] + [TestCase(BreakWaterType.Caisson, 1.1)] + [TestCase(BreakWaterType.Dam, 2.2)] + [TestCase(BreakWaterType.Wall, -3.3)] + public void Create_WithBreakWater_ReturnEntity(BreakWaterType type, double height) + { + // Setup + var dikeProfile = new DikeProfile(new Point2D(1234.4567, 5678.432), + new[] + { + new RoughnessPoint(new Point2D(-6.6, -3.3), 0.75), + new RoughnessPoint(new Point2D(4.4, 5.5), 0.75) + }, + new[] + { + new Point2D(-12.12, -13.13), + new Point2D(-6.6, -3.3) + }, + new BreakWater(type, height), + new DikeProfile.ConstructionProperties + { + Name = "Dike profile without break water.", + DikeHeight = 98.76, + Orientation = 76.54, + X0 = -12.34 + }); + var registry = new PersistenceRegistry(); + + // Call + DikeProfileEntity entity = dikeProfile.Create(registry); + + // Assert + Assert.AreEqual(dikeProfile.WorldReferencePoint.X, entity.X); + Assert.AreEqual(dikeProfile.WorldReferencePoint.Y, entity.Y); + Assert.AreEqual(dikeProfile.X0, entity.X0); + RoughnessPoint[] convertedDikeGeometry = new RoughnessPointBinaryConverter().ToData(entity.DikeGeometryData); + CollectionAssert.AreEqual(dikeProfile.DikeGeometry, convertedDikeGeometry, new RoughnessPointComparer()); + Point2D[] convertedForeshoreGeometry = new Point2DBinaryConverter().ToData(entity.ForeShoreData); + CollectionAssert.AreEqual(dikeProfile.ForeshoreGeometry, convertedForeshoreGeometry); + Assert.AreEqual(dikeProfile.Orientation.Value, entity.Orientation); + Assert.AreEqual(dikeProfile.DikeHeight.Value, entity.DikeHeight); + Assert.AreEqual(dikeProfile.Name, entity.Name); + + Assert.AreEqual((byte)type, entity.BreakWaterType); + Assert.AreEqual(height, entity.BreakWaterHeight); + } + + [Test] + public void Create_Always_RegisterEntityToPersistenceRegistry() + { + // Setup + var dikeProfile = new DikeProfile(new Point2D(1.1, 2.2), + new[] + { + new RoughnessPoint(new Point2D(3.3, 4.4), 0.75), + new RoughnessPoint(new Point2D(5.5, 6.6), 0.75) + }, + new[] + { + new Point2D(7.7, 8.8), + new Point2D(9.9, 10.10) + }, null, new DikeProfile.ConstructionProperties()); + var registry = new PersistenceRegistry(); + + // Call + DikeProfileEntity entity = dikeProfile.Create(registry); + + // Assert + entity.DikeProfileEntityId = 345678; + registry.TransferIds(); + Assert.AreEqual(entity.DikeProfileEntityId, dikeProfile.StorageId); + } + + private class RoughnessPointComparer : IComparer + { + public int Compare(object x, object y) + { + RoughnessPoint x1 = (RoughnessPoint)x; + RoughnessPoint y1 = (RoughnessPoint)y; + if (x1.Point.Equals(y1.Point) && x1.Roughness.Equals(y1.Roughness)) + { + return 0; + } + return 1; + } + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GeneralGrassCoverErosionInwardsInputCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,67 @@ +using System; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.DbContext; + +using NUnit.Framework; + +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionInwards +{ + [TestFixture] + public class GeneralGrassCoverErosionInwardsInputCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryNull_ThrowArgumentNullException() + { + // Setup + var input = new GeneralGrassCoverErosionInwardsInput(); + + // Call + TestDelegate call = () => input.Create(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_ValidGeneralInput_ReturnEntity( + [Random(0, 20, 1)]int n) + { + // Setup + var input = new GeneralGrassCoverErosionInwardsInput + { + N = n + }; + var registry = new PersistenceRegistry(); + + // Call + GrassCoverErosionInwardsFailureMechanismMetaEntity entity = input.Create(registry); + + // Assert + Assert.AreEqual(n, entity.N); + } + + [Test] + public void Create_ValidGeneralInput_RegisterEntityToRegistry() + { + // Setup + var input = new GeneralGrassCoverErosionInwardsInput + { + N = 1 + }; + var registry = new PersistenceRegistry(); + + // Call + GrassCoverErosionInwardsFailureMechanismMetaEntity entity = input.Create(registry); + + // Assert + entity.GrassCoverErosionInwardsFailureMechanismMetaEntityId = 23456789; + registry.TransferIds(); + Assert.AreEqual(entity.GrassCoverErosionInwardsFailureMechanismMetaEntityId, input.StorageId); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,205 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.Common.Data.Calculation; +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionInwards +{ + [TestFixture] + public class GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text", + GeneralInput = + { + N = 12 + } + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short) FailureMechanismType.GrassRevetmentTopErosionAndInwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + + Assert.AreEqual(1, entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.Count); + GrassCoverErosionInwardsFailureMechanismMetaEntity generalInputEntity = entity.GrassCoverErosionInwardsFailureMechanismMetaEntities.First(); + Assert.AreEqual(failureMechanism.GeneralInput.N, generalInputEntity.N); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionInwardsSectionResultEntities).Count()); + } + + [Test] + public void Create_WithoutDikeProfiles_EmptyDikeProfileEntities() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + CollectionAssert.IsEmpty(entity.DikeProfileEntities); + } + + [Test] + public void Create_WithDikeProfiles_AddDikeProfileEntities() + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + failureMechanism.DikeProfiles.Add(new DikeProfile(new Point2D(0, 0), + new[] + { + new RoughnessPoint(new Point2D(1, 1), 0.75), + new RoughnessPoint(new Point2D(2, 2), 0.75), + }, + new[] + { + new Point2D(3, 3), + new Point2D(4, 4), + }, + null, new DikeProfile.ConstructionProperties())); + failureMechanism.DikeProfiles.Add(new DikeProfile(new Point2D(5, 5), + new[] + { + new RoughnessPoint(new Point2D(6, 6), 1), + new RoughnessPoint(new Point2D(7, 7), 1), + }, + new Point2D[0], + new BreakWater(BreakWaterType.Caisson, 8), + new DikeProfile.ConstructionProperties + { + Name = "A", + DikeHeight = 9, + Orientation = 10, + X0 = 11 + })); + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.AreEqual(2, entity.DikeProfileEntities.Count); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities(bool isRelevant) + { + // Setup + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup("A", true)); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup("B", true)); + + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name); + Assert.AreEqual(Convert.ToByte(failureMechanism.CalculationsGroup.IsNameEditable), entity.CalculationGroupEntity.IsEditable); + Assert.AreEqual(0, entity.CalculationGroupEntity.Order); + + CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1 + .OrderBy(cge => cge.Order) + .ToArray(); + Assert.AreEqual(2, childGroupEntities.Length); + Assert.AreEqual("A", childGroupEntities[0].Name); + Assert.AreEqual(1, childGroupEntities[0].IsEditable); + Assert.AreEqual(0, childGroupEntities[0].Order); + Assert.AreEqual("B", childGroupEntities[1].Name); + Assert.AreEqual(1, childGroupEntities[1].IsEditable); + Assert.AreEqual(1, childGroupEntities[1].Order); + } + + // TODO: With calculations in root folder + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwards/GrassCoverErosionInwardsMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionInwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.GrassCoverErosionInwards.Data; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionInwards +{ + [TestFixture] + public class GrassCoverErosionInwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new GrassCoverErosionInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionInwardsMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionOutwards +{ + [TestFixture] + public class GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.GrassRevetmentErosionOutwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverErosionOutwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwards/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,93 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.GrassCoverErosionOutwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverErosionOutwards +{ + [TestFixture] + public class GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new GrassCoverErosionOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverErosionOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffInwards +{ + [TestFixture] + public class GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.GrassRevetmentSlidingInwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new GrassCoverSlipOffInwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffInwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwards/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,93 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffInwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffInwards +{ + [TestFixture] + public class GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new GrassCoverSlipOffInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffOutwards +{ + [TestFixture] + public class GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.GrassRevetmentSlidingOutwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new GrassCoverSlipOffOutwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.GrassCoverSlipOffOutwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwards/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,93 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.GrassCoverSlipOffOutwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.GrassCoverSlipOffOutwards +{ + [TestFixture] + public class GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new GrassCoverSlipOffOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/GrassCoverSlipOffOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.HeightStructures; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Create.HeightStructures +{ + [TestFixture] + public class HeightStructuresFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.StructureHeight, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new HeightStructuresFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.HeightStructuresSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.HeightStructures; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Create.HeightStructures +{ + [TestFixture] + public class HeightStructuresFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructuresFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructuresFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityInwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityInwards +{ + [TestFixture] + public class MacrostabilityInwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacrostabilityInwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new MacrostabilityInwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.MacrostabilityInwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new MacrostabilityInwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new MacrostabilityInwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityInwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwards/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -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.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityInwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityInwards +{ + [TestFixture] + public class MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(0.2, 0.523)] double assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerTwoA); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MacrostabilityInwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityInwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityOutwards; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityOutwards +{ + [TestFixture] + public class MacrostabilityOutwardsFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MacrostabilityOutwardsFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new MacrostabilityOutwardsFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.MacrostabilityOutwards, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new MacrostabilityOutwardsFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new MacrostabilityOutwardsFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MacrostabilityOutwardsSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwards/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -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.Create; +using Application.Ringtoets.Storage.Create.MacrostabilityOutwards; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.MacrostabilityOutwards +{ + [TestFixture] + public class MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(0.2, 0.523)] double assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerTwoA); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MacrostabilityOutwardsFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwardsFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacrostabilityOutwardsFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Microstability; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.Microstability +{ + [TestFixture] + public class MicrostabilityFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.Microstability, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new MicrostabilityFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.MicrostabilitySectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Microstability/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,93 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Microstability; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.Microstability +{ + [TestFixture] + public class MicrostabilityFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new MicrostabilityFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MicrostabilityFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MicrostabilityFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,378 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.HydraRing.Data; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingCalculationScenarioCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var calculation = new PipingCalculationScenario(new GeneralPipingInput()); + + // Call + TestDelegate call = () => calculation.Create(null, 0); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual(paramName, "registry"); + } + + [Test] + [TestCase(true, 0.0, "A", "", 2.2, 0.0, 123, 827364)] + [TestCase(false, 1.0, null, null, double.NaN, double.NaN, 980754, 231)] + public void Create_PipingCalculationScenarioWithPropertiesSet_ReturnPipingCalculationEntity( + bool isRelevant, double contribution, string name, string comments, + double exitPoint, double entryPoint, int order, int randomSeed) + { + // Setup + var random = new Random(randomSeed); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + IsRelevant = isRelevant, + Contribution = (RoundedDouble)contribution, + Name = name, + Comments = comments, + InputParameters = + { + ExitPointL = (RoundedDouble)exitPoint, + EntryPointL = (RoundedDouble)entryPoint, + PhreaticLevelExit = + { + Mean = (RoundedDouble)GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), + StandardDeviation = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + }, + DampingFactorExit = + { + Mean = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + }, + SaturatedVolumicWeightOfCoverageLayer = + { + Mean = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + Shift = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + }, + Diameter70 = + { + Mean = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + }, + DarcyPermeability = + { + Mean = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble)GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + } + } + }; + + var registry = new PersistenceRegistry(); + + // Call + PipingCalculationEntity entity = calculation.Create(registry, order); + + // Assert + Assert.AreEqual(Convert.ToByte(isRelevant), entity.RelevantForScenario); + Assert.AreEqual(Convert.ToDecimal(contribution), entity.ScenarioContribution); + Assert.AreEqual(name, entity.Name); + Assert.AreEqual(comments, entity.Comments); + + Assert.AreEqual(exitPoint.ToNullableDecimal(), entity.ExitPointL); + Assert.AreEqual(entryPoint.ToNullableDecimal(), entity.EntryPointL); + + PipingInput input = calculation.InputParameters; + Assert.AreEqual(Convert.ToDecimal(input.PhreaticLevelExit.Mean), + entity.PhreaticLevelExitMean); + Assert.AreEqual(Convert.ToDecimal(input.PhreaticLevelExit.StandardDeviation), + entity.PhreaticLevelExitStandardDeviation); + Assert.AreEqual(Convert.ToDecimal(input.DampingFactorExit.Mean), + entity.DampingFactorExitMean); + Assert.AreEqual(Convert.ToDecimal(input.DampingFactorExit.StandardDeviation), + entity.DampingFactorExitStandardDeviation); + Assert.AreEqual(Convert.ToDecimal(input.SaturatedVolumicWeightOfCoverageLayer.Mean), + entity.SaturatedVolumicWeightOfCoverageLayerMean); + Assert.AreEqual(Convert.ToDecimal(input.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation), + entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation); + Assert.AreEqual(Convert.ToDecimal(input.SaturatedVolumicWeightOfCoverageLayer.Shift), + entity.SaturatedVolumicWeightOfCoverageLayerShift); + Assert.AreEqual(Convert.ToDecimal(input.Diameter70.Mean), + entity.Diameter70Mean); + Assert.AreEqual(Convert.ToDecimal(input.Diameter70.StandardDeviation), + entity.Diameter70StandardDeviation); + Assert.AreEqual(Convert.ToDecimal(input.DarcyPermeability.Mean), + entity.DarcyPermeabilityMean); + Assert.AreEqual(Convert.ToDecimal(input.DarcyPermeability.StandardDeviation), + entity.DarcyPermeabilityStandardDeviation); + + Assert.AreEqual(order, entity.Order); + Assert.AreEqual(0, entity.PipingCalculationEntityId); + Assert.IsNull(entity.CalculationGroupEntity); + + Assert.IsNull(entity.SurfaceLineEntity); + Assert.IsNull(entity.StochasticSoilProfileEntity); + Assert.IsNull(entity.HydraulicLocationEntityId); + } + + [Test] + public void Create_HasSurfaceLineSet_EntityHasSurfaceLineEntity() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2) + }; + surfaceLine.SetGeometry(new[] + { + new Point3D(0.0, 0.0, 1.0), + new Point3D(3.3, 6.6, 1.0) + }); + + var registry = new PersistenceRegistry(); + SurfaceLineEntity surfaceLineEntity = surfaceLine.Create(registry); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + SurfaceLine = surfaceLine + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.AreSame(surfaceLineEntity, entity.SurfaceLineEntity); + } + + [Test] + public void Create_HasSurfaceLineSetButInstanceNotSaved_EntityHasNewSurfaceLineEntity() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2) + }; + surfaceLine.SetGeometry(new[] + { + new Point3D(0.0, 0.0, 1.0), + new Point3D(3.3, 6.6, 1.0) + }); + + var registry = new PersistenceRegistry(); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + SurfaceLine = surfaceLine + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.True(registry.Contains(surfaceLine)); + Assert.AreSame(registry.Get(surfaceLine), entity.SurfaceLineEntity); + } + + [Test] + public void Create_HydraulicBoundaryLocation_EntityHasHydraulicLocationEntity() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "A", 2.3, 4.5); + + var registry = new PersistenceRegistry(); + HydraulicLocationEntity hydraulicLocationEntity = hydraulicBoundaryLocation.Create(registry); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.AreSame(hydraulicLocationEntity, entity.HydraulicLocationEntity); + } + + [Test] + public void Create_HasHydraulicBoundaryLocationSetButInstanceNotSaved_EntityHasNewHydraulicLocationEntity() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "a", 1.1, 2.2); + var registry = new PersistenceRegistry(); + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + HydraulicBoundaryLocation = hydraulicBoundaryLocation + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.True(registry.Contains(hydraulicBoundaryLocation)); + Assert.AreSame(registry.Get(hydraulicBoundaryLocation), entity.HydraulicLocationEntity); + } + + [Test] + public void Create_StochasticSoilProfileSet_EntityHasStochasticSoilProfileEntity() + { + // Setup + var soilProfile = new TestPipingSoilProfile(); + var stochasticSoilProfile = new StochasticSoilProfile(0.6, SoilProfileType.SoilProfile1D, 1) + { + SoilProfile = soilProfile + }; + + var soilModel = new StochasticSoilModel(1, "A", "B"); + soilModel.StochasticSoilProfiles.Add(stochasticSoilProfile); + + var registry = new PersistenceRegistry(); + StochasticSoilModelEntity soilModelEntity = soilModel.Create(registry); + + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + StochasticSoilModel = soilModel, + StochasticSoilProfile = stochasticSoilProfile + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + var expectedStochasticSoilProfileEntity = soilModelEntity.StochasticSoilProfileEntities.First(); + Assert.AreSame(expectedStochasticSoilProfileEntity, entity.StochasticSoilProfileEntity); + Assert.IsTrue(registry.Contains(soilModel)); + } + + [Test] + public void Create_HasStochasticSoilProfileSetButInstanceNotSaved_EntityHasNewStochasticSoilProfileEntity() + { + // Setup + var soilProfile = new TestPipingSoilProfile(); + var stochasticSoilProfile = new StochasticSoilProfile(0.6, SoilProfileType.SoilProfile1D, 1) + { + SoilProfile = soilProfile + }; + + var soilModel = new StochasticSoilModel(1, "A", "B"); + soilModel.StochasticSoilProfiles.Add(stochasticSoilProfile); + + var registry = new PersistenceRegistry(); + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + InputParameters = + { + StochasticSoilModel = soilModel, + StochasticSoilProfile = stochasticSoilProfile + } + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.True(registry.Contains(soilModel)); + Assert.True(registry.Contains(stochasticSoilProfile)); + Assert.AreSame(registry.Get(stochasticSoilProfile), entity.StochasticSoilProfileEntity); + } + + [Test] + public void Create_HasCalculationOutput_EntityHasPipingCalculationOutputEntity() + { + // Setup + var registry = new PersistenceRegistry(); + + var newOutput = new PipingOutput(1,2,3,4,5,6); + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + Output = newOutput + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.IsNotNull(entity.PipingCalculationOutputEntity); + } + + [Test] + public void Create_HasPipingSemiProbabilisticOutput_EntityHasPipingSemiProbabilisticOutputEntity() + { + // Setup + var registry = new PersistenceRegistry(); + + var newOutput = new PipingSemiProbabilisticOutput(1, 2, 0.3, + 4, 5, 0.6, + 7, 8, 0.9, + 1.0, 11, + 0.2, 13, 14); + var calculation = new PipingCalculationScenario(new GeneralPipingInput()) + { + SemiProbabilisticOutput = newOutput + }; + + // Call + PipingCalculationEntity entity = calculation.Create(registry, 0); + + // Assert + Assert.IsNotNull(entity.PipingSemiProbabilisticOutputEntity); + } + + private double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) + { + double difference = upperLimit - lowerLimit; + return lowerLimit + random.NextDouble() * difference; + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,205 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new PipingFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text", + PipingProbabilityAssessmentInput = + { + A = 0.9876 + } + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short) FailureMechanismType.Piping, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + CollectionAssert.IsEmpty(entity.StochasticSoilModelEntities); + + var failureMechanismMetaEntity = entity.PipingFailureMechanismMetaEntities.ToArray()[0]; + Assert.AreEqual(failureMechanism.PipingProbabilityAssessmentInput.A, failureMechanismMetaEntity.A); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithStochasticSoilModels_ReturnsFailureMechanismEntityWithStochasticSoilModelEntities(bool isRelevant) + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + failureMechanism.StochasticSoilModels.Add(new StochasticSoilModel(-1, "name", "segmentName")); + failureMechanism.StochasticSoilModels.Add(new StochasticSoilModel(-1, "name2", "segmentName2")); + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(2, entity.StochasticSoilModelEntities.Count); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithSections_ReturnsWithFailureMechanismSectionEntitiesAndPipingResultEntities(bool isRelevant) + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + failureMechanism.AddSection(new TestFailureMechanismSection()); + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(2, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(2, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingSectionResultEntities).Count()); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithSurfaceLines_ReturnFailureMechanismEntityWithSurfaceLineEntities(bool isRelevant) + { + // Setup + var random = new Random(); + var failureMechanism = new PipingFailureMechanism(); + failureMechanism.SurfaceLines.Add(CreateSurfaceLine(random)); + + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(failureMechanism.SurfaceLines.Count, entity.SurfaceLineEntities.Count); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCalculationGroup_ReturnFailureMechanismEntityWithCalculationGroupEntities(bool isRelevant) + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup("A", true)); + failureMechanism.CalculationsGroup.Children.Add(new CalculationGroup("B", true)); + + var registry = new PersistenceRegistry(); + + // Call + FailureMechanismEntity entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(failureMechanism.CalculationsGroup.Name, entity.CalculationGroupEntity.Name); + Assert.AreEqual(Convert.ToByte(failureMechanism.CalculationsGroup.IsNameEditable), entity.CalculationGroupEntity.IsEditable); + Assert.AreEqual(0, entity.CalculationGroupEntity.Order); + + CalculationGroupEntity[] childGroupEntities = entity.CalculationGroupEntity.CalculationGroupEntity1 + .OrderBy(cge => cge.Order) + .ToArray(); + Assert.AreEqual(2, childGroupEntities.Length); + Assert.AreEqual("A", childGroupEntities[0].Name); + Assert.AreEqual(1, childGroupEntities[0].IsEditable); + Assert.AreEqual(0, childGroupEntities[0].Order); + Assert.AreEqual("B", childGroupEntities[1].Name); + Assert.AreEqual(1, childGroupEntities[1].IsEditable); + Assert.AreEqual(1, childGroupEntities[1].Order); + } + + private RingtoetsPipingSurfaceLine CreateSurfaceLine(Random random) + { + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "A", + ReferenceLineIntersectionWorldPoint = new Point2D(random.NextDouble(), random.NextDouble()) + }; + + var geometryPoints = new Point3D[10]; + for (int i = 0; i < 10; i++) + { + geometryPoints[i] = new Point3D(random.NextDouble(), random.NextDouble(), random.NextDouble()); + } + surfaceLine.SetGeometry(geometryPoints); + + surfaceLine.SetBottomDitchDikeSideAt(geometryPoints[1]); + surfaceLine.SetBottomDitchPolderSideAt(geometryPoints[2]); + surfaceLine.SetDikeToeAtPolderAt(geometryPoints[3]); + surfaceLine.SetDikeToeAtRiverAt(geometryPoints[4]); + surfaceLine.SetDitchDikeSideAt(geometryPoints[5]); + surfaceLine.SetDitchPolderSideAt(geometryPoints[7]); + + return surfaceLine; + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new PipingFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingOutputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingOutputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingOutputCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,115 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using NUnit.Framework; + +using Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingOutputCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var pipingOutput = new PipingOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + + // Call + TestDelegate call = () => pipingOutput.Create(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_AllOutputValuesSet_ReturnEntity() + { + // Setup + var pipingOutput = new PipingOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + + var registry = new PersistenceRegistry(); + + // Call + PipingCalculationOutputEntity entity = pipingOutput.Create(registry); + + // Assert + Assert.AreEqual(pipingOutput.HeaveFactorOfSafety, entity.HeaveFactorOfSafety); + Assert.AreEqual(pipingOutput.HeaveZValue, entity.HeaveZValue); + Assert.AreEqual(pipingOutput.SellmeijerFactorOfSafety, entity.SellmeijerFactorOfSafety); + Assert.AreEqual(pipingOutput.SellmeijerZValue, entity.SellmeijerZValue); + Assert.AreEqual(pipingOutput.UpliftFactorOfSafety, entity.UpliftFactorOfSafety); + Assert.AreEqual(pipingOutput.UpliftZValue, entity.UpliftZValue); + + Assert.AreEqual(0, entity.PipingCalculationOutputEntityId); + CollectionAssert.IsEmpty(entity.PipingCalculationEntities); + } + + [Test] + public void Create_AllOutputValuesNaN_ReturnEntityWithNullValues() + { + // Setup + var pipingOutput = new PipingOutput(double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN, double.NaN); + + var registry = new PersistenceRegistry(); + + // Call + PipingCalculationOutputEntity entity = pipingOutput.Create(registry); + + // Assert + Assert.IsNull(entity.HeaveFactorOfSafety); + Assert.IsNull(entity.HeaveZValue); + Assert.IsNull(entity.SellmeijerFactorOfSafety); + Assert.IsNull(entity.SellmeijerZValue); + Assert.IsNull(entity.UpliftFactorOfSafety); + Assert.IsNull(entity.UpliftZValue); + + Assert.AreEqual(0, entity.PipingCalculationOutputEntityId); + CollectionAssert.IsEmpty(entity.PipingCalculationEntities); + } + + [Test] + public void Create_Always_RegisterNewEntityInPersistenceRegistry() + { + // Setup + var pipingOutput = new PipingOutput(1.1, 2.2, 3.3, 4.4, 5.5, 6.6); + + var registry = new PersistenceRegistry(); + + // Call + PipingCalculationOutputEntity entity = pipingOutput.Create(registry); + + // Assert + entity.PipingCalculationOutputEntityId = 39458; + registry.TransferIds(); + Assert.AreEqual(entity.PipingCalculationOutputEntityId, pipingOutput.StorageId); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingProbabilityAssessmentInputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingProbabilityAssessmentInputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingProbabilityAssessmentInputCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,66 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using NUnit.Framework; + +using Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingProbabilityAssessmentInputCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.PipingProbabilityAssessmentInput.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + public void Create_WithCollector_ReturnsPipingFailureMechanismMetaEntityWithPropertiesSet() + { + // Setup + var failureMechanism = new PipingFailureMechanism(); + var registry = new PersistenceRegistry(); + + // Call + PipingFailureMechanismMetaEntity entity = failureMechanism.PipingProbabilityAssessmentInput.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(failureMechanism.PipingProbabilityAssessmentInput.A, entity.A); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSemiProbabilisticOutputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSemiProbabilisticOutputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSemiProbabilisticOutputCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,140 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Piping.Data; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingSemiProbabilisticOutputCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 0.3, 4.4, 5.5, 0.6, 7.7, + 8.8, 0.9, 0.10, 11.11, 0.12, + 13.13, 14.14); + + // Call + TestDelegate call = () => output.Create(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + public void Create_WithValidValues_ReturnEntity() + { + // Setup + var output = new PipingSemiProbabilisticOutput(1.1, 2.2, 0.3, 4.4, 5.5, 0.6, 7.7, + 8.8, 0.9, 0.10, 11.11, 0.12, + 13.13, 14.14); + var registry = new PersistenceRegistry(); + + // Call + PipingSemiProbabilisticOutputEntity entity = output.Create(registry); + + // Assert + AssertAreEqual(output.UpliftFactorOfSafety, entity.UpliftFactorOfSafety); + AssertAreEqual(output.UpliftReliability, entity.UpliftReliability); + AssertAreEqual(output.UpliftProbability, entity.UpliftProbability); + AssertAreEqual(output.HeaveFactorOfSafety, entity.HeaveFactorOfSafety); + AssertAreEqual(output.HeaveReliability, entity.HeaveReliability); + AssertAreEqual(output.HeaveProbability, entity.HeaveProbability); + AssertAreEqual(output.SellmeijerFactorOfSafety, entity.SellmeijerFactorOfSafety); + AssertAreEqual(output.SellmeijerReliability, entity.SellmeijerReliability); + AssertAreEqual(output.SellmeijerProbability, entity.SellmeijerProbability); + AssertAreEqual(output.RequiredProbability, entity.RequiredProbability); + AssertAreEqual(output.RequiredReliability, entity.RequiredReliability); + AssertAreEqual(output.PipingProbability, entity.PipingProbability); + AssertAreEqual(output.PipingReliability, entity.PipingReliability); + AssertAreEqual(output.PipingFactorOfSafety, entity.PipingFactorOfSafety); + + Assert.AreEqual(0, entity.PipingSemiProbabilisticOutputEntityId); + CollectionAssert.IsEmpty(entity.PipingCalculationEntities); + } + + private static void AssertAreEqual(double expectedValue, decimal? actualValue) + { + if (double.IsNaN(expectedValue)) + { + Assert.IsNull(actualValue); + } + Assert.AreEqual(expectedValue, Convert.ToDouble(actualValue)); + } + + private static void AssertAreEqual(RoundedDouble expectedValue, decimal? actualValue) + { + if (double.IsNaN(expectedValue)) + { + Assert.IsNull(actualValue); + } + Assert.AreEqual(expectedValue, Convert.ToDouble(actualValue), expectedValue.GetAccuracy()); + } + + [Test] + public void Create_WithNaNValues_ReturnEntityWithNullPropertyValues() + { + // Setup + var output = new PipingSemiProbabilisticOutput(double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN, double.NaN, + double.NaN, double.NaN); + var registry = new PersistenceRegistry(); + + // Call + PipingSemiProbabilisticOutputEntity entity = output.Create(registry); + + // Assert + Assert.IsNull(entity.UpliftFactorOfSafety); + Assert.IsNull(entity.UpliftReliability); + Assert.IsNull(entity.UpliftProbability); + Assert.IsNull(entity.HeaveFactorOfSafety); + Assert.IsNull(entity.HeaveReliability); + Assert.IsNull(entity.HeaveProbability); + Assert.IsNull(entity.SellmeijerFactorOfSafety); + Assert.IsNull(entity.SellmeijerReliability); + Assert.IsNull(entity.SellmeijerProbability); + Assert.IsNull(entity.RequiredProbability); + Assert.IsNull(entity.RequiredReliability); + Assert.IsNull(entity.PipingProbability); + Assert.IsNull(entity.PipingReliability); + Assert.IsNull(entity.PipingFactorOfSafety); + + Assert.AreEqual(0, entity.PipingSemiProbabilisticOutputEntityId); + CollectionAssert.IsEmpty(entity.PipingCalculationEntities); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilLayerCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilLayerCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilLayerCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,92 @@ +// 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 System.Drawing; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; + +using NUnit.Framework; + +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingSoilLayerCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var soilLayer = new PipingSoilLayer(new Random(21).NextDouble()); + + // Call + TestDelegate test = () => soilLayer.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollector_ReturnsFailureMechanismEntityWithPropertiesSet(bool isAquifer) + { + // Setup + double top = new Random(21).NextDouble(); + var random = new Random(21); + var soilLayer = new PipingSoilLayer(top) + { + IsAquifer = isAquifer, + Color = Color.AliceBlue, + MaterialName = "MaterialName", + BelowPhreaticLevelMean = random.NextDouble(), + BelowPhreaticLevelDeviation = random.NextDouble(), + BelowPhreaticLevelShift = random.NextDouble(), + DiameterD70Mean = double.NaN, + DiameterD70Deviation = double.NaN, + PermeabilityMean = random.NextDouble(), + PermeabilityDeviation = random.NextDouble() + + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = soilLayer.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(Convert.ToDecimal(top), entity.Top); + Assert.AreEqual(Convert.ToByte(isAquifer), entity.IsAquifer); + Assert.AreEqual(soilLayer.Color.ToArgb(), Convert.ToInt32(entity.Color)); + Assert.AreEqual(soilLayer.BelowPhreaticLevelMean.ToNaNAsNull(), entity.BelowPhreaticLevelMean); + Assert.AreEqual(soilLayer.BelowPhreaticLevelDeviation.ToNaNAsNull(), entity.BelowPhreaticLevelDeviation); + Assert.AreEqual(soilLayer.BelowPhreaticLevelShift.ToNaNAsNull(), entity.BelowPhreaticLevelShift); + Assert.AreEqual(soilLayer.DiameterD70Mean.ToNaNAsNull(), entity.DiameterD70Mean); + Assert.AreEqual(soilLayer.DiameterD70Deviation.ToNaNAsNull(), entity.DiameterD70Deviation); + Assert.AreEqual(soilLayer.PermeabilityMean.ToNaNAsNull(), entity.PermeabilityMean); + Assert.AreEqual(soilLayer.PermeabilityDeviation.ToNaNAsNull(), entity.PermeabilityDeviation); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingSoilProfileCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,91 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; + +using NUnit.Framework; + +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class PipingSoilProfileCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var soilProfile = new TestPipingSoilProfile(); + + // Call + TestDelegate test = () => soilProfile.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + public void Create_WithCollectorAndLayers_ReturnsSoilProfileEntityWithPropertiesAndSoilLayerEntitiesSet() + { + // Setup + string testName = "testName"; + double bottom = new Random(21).NextDouble(); + var layers = new [] + { + new PipingSoilLayer(bottom + 1), + new PipingSoilLayer(bottom + 2) + }; + var soilProfile = new PipingSoilProfile(testName, bottom, layers, SoilProfileType.SoilProfile1D, -1); + var registry = new PersistenceRegistry(); + + // Call + var entity = soilProfile.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(Convert.ToDecimal(bottom), entity.Bottom); + Assert.AreEqual(testName, entity.Name); + Assert.AreEqual(2, entity.SoilLayerEntities.Count); + } + + [Test] + public void Create_ForTheSameEntityTwice_ReturnsSameSoilProfileEntityInstance() + { + // Setup + var soilProfile = new TestPipingSoilProfile(); + var registry = new PersistenceRegistry(); + + var firstEntity = soilProfile.Create(registry); + + // Call + var secondEntity = soilProfile.Create(registry); + + // Assert + Assert.AreSame(firstEntity, secondEntity); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/RingtoetsPipingSurfaceLineCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,303 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class RingtoetsPipingSurfaceLineCreateExtensionsTest + { + [Test] + public void Create_PersistenceRegistryIsNull_ThrowArgumentNullException() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine(); + + // Call + TestDelegate call = () => surfaceLine.Create(null); + + // Assert + Assert.Throws(call); + } + + [Test] + public void Create_SurfaceLineWithoutGeometry_ReturnSurfaceLineEntityWithoutAddingPointEntities() + { + // Setup + var registry = new PersistenceRegistry(); + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "Test", + ReferenceLineIntersectionWorldPoint = new Point2D(1235.439, 49308.346) + }; + + // Call + SurfaceLineEntity entity = surfaceLine.Create(registry); + + // Assert + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(0, entity.SurfaceLineEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + Assert.IsNull(entity.FailureMechanismEntity); + CollectionAssert.IsEmpty(entity.SurfaceLinePointEntities); + } + + [Test] + public void Create_SurfaceLineWithGeometryWithoutCharacteristicPoints_ReturnSurfaceLineEntityWithPointEntities() + { + // Setup + var registry = new PersistenceRegistry(); + var geometry = new[] + { + new Point3D(1.1, 2.2, 3.3), + new Point3D(4.4, 5.5, 6.6), + new Point3D(7.7, 8.8, 9.9) + }; + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "Test", + ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2) + }; + surfaceLine.SetGeometry(geometry); + + // Call + SurfaceLineEntity entity = surfaceLine.Create(registry); + + // Assert + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(geometry.Length, entity.SurfaceLinePointEntities.Count); + SurfaceLinePointEntity[] pointEntities = entity.SurfaceLinePointEntities.ToArray(); + for (int i = 0; i < geometry.Length; i++) + { + SurfaceLinePointEntity pointEntity = pointEntities[i]; + Assert.AreEqual(i, pointEntity.Order); + + Point3D expectedMatchingGeometryPoint = geometry[i]; + Assert.AreEqual(expectedMatchingGeometryPoint.X, pointEntity.X); + Assert.AreEqual(expectedMatchingGeometryPoint.Y, pointEntity.Y); + Assert.AreEqual(expectedMatchingGeometryPoint.Z, pointEntity.Z); + } + + Assert.AreEqual(0, entity.SurfaceLineEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + Assert.IsNull(entity.FailureMechanismEntity); + } + + [Test] + public void Create_SurfaceLineWithAllData_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences() + { + // Setup + var registry = new PersistenceRegistry(); + var geometry = new[] + { + new Point3D(1.1, 2.2, 3.3), + new Point3D(4.4, 5.5, 6.6), + new Point3D(7.7, 8.8, 9.9), + new Point3D(10.10, 11.11, 12.12), + new Point3D(13.13, 14.14, 15.15), + new Point3D(16.16, 17.17, 18.18), + new Point3D(19.19, 20.20, 21.21), + new Point3D(22.22, 23.23, 24.24), + }; + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "Test", + ReferenceLineIntersectionWorldPoint = new Point2D(3.3, 4.4) + }; + surfaceLine.SetGeometry(geometry); + const int bottomDitchDikeIndex = 1; + surfaceLine.SetBottomDitchDikeSideAt(geometry[bottomDitchDikeIndex]); + const int bottomDitchPolderIndex = 2; + surfaceLine.SetBottomDitchPolderSideAt(geometry[bottomDitchPolderIndex]); + const int toePolderIndex = 3; + surfaceLine.SetDikeToeAtPolderAt(geometry[toePolderIndex]); + const int toeDikeIndex = 4; + surfaceLine.SetDikeToeAtRiverAt(geometry[toeDikeIndex]); + const int ditchDikeIndex = 5; + surfaceLine.SetDitchDikeSideAt(geometry[ditchDikeIndex]); + const int ditchPolderIndex = 6; + surfaceLine.SetDitchPolderSideAt(geometry[ditchPolderIndex]); + + // Call + SurfaceLineEntity entity = surfaceLine.Create(registry); + + // Assert + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(geometry.Length, entity.SurfaceLinePointEntities.Count); + SurfaceLinePointEntity[] pointEntities = entity.SurfaceLinePointEntities.ToArray(); + for (int i = 0; i < geometry.Length; i++) + { + SurfaceLinePointEntity pointEntity = pointEntities[i]; + Assert.AreEqual(i, pointEntity.Order); + + Point3D expectedMatchingGeometryPoint = geometry[i]; + Assert.AreEqual(expectedMatchingGeometryPoint.X, pointEntity.X); + Assert.AreEqual(expectedMatchingGeometryPoint.Y, pointEntity.Y); + Assert.AreEqual(expectedMatchingGeometryPoint.Z, pointEntity.Z); + } + + SurfaceLinePointEntity bottomDitchDikeEntity = pointEntities[bottomDitchDikeIndex]; + Assert.AreEqual(1, bottomDitchDikeEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.BottomDitchDikeSide, bottomDitchDikeEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + SurfaceLinePointEntity bottomDitchPolderEntity = pointEntities[bottomDitchPolderIndex]; + Assert.AreEqual(1, bottomDitchPolderEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.BottomDitchPolderSide, bottomDitchPolderEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + SurfaceLinePointEntity dikeToePolderEntity = pointEntities[toePolderIndex]; + Assert.AreEqual(1, dikeToePolderEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.DikeToeAtPolder, dikeToePolderEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + SurfaceLinePointEntity dikeToeRiverEntity = pointEntities[toeDikeIndex]; + Assert.AreEqual(1, dikeToeRiverEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.DikeToeAtRiver, dikeToeRiverEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + SurfaceLinePointEntity ditchDikeEntity = pointEntities[ditchDikeIndex]; + Assert.AreEqual(1, ditchDikeEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.DitchDikeSide, ditchDikeEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + SurfaceLinePointEntity ditchPolderEntity = pointEntities[ditchPolderIndex]; + Assert.AreEqual(1, ditchPolderEntity.CharacteristicPointEntities.Count); + Assert.AreEqual((short)CharacteristicPointType.DitchPolderSide, ditchPolderEntity.CharacteristicPointEntities.First().CharacteristicPointType); + + Assert.AreEqual(0, entity.SurfaceLineEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + Assert.IsNull(entity.FailureMechanismEntity); + } + + [Test] + public void Create_SurfaceLineWithCharacteristicPointsOnSameGeometryPoint_ReturnSurfaceLineEntityWithPointEntitiesAndCharactersisticPointReferences() + { + // Setup + var registry = new PersistenceRegistry(); + var geometry = new[] + { + new Point3D(1.1, 2.2, 3.3) + }; + var surfaceLine = new RingtoetsPipingSurfaceLine + { + Name = "Test", + ReferenceLineIntersectionWorldPoint = new Point2D(3.3, 4.4) + }; + surfaceLine.SetGeometry(geometry); + surfaceLine.SetBottomDitchDikeSideAt(geometry[0]); + surfaceLine.SetBottomDitchPolderSideAt(geometry[0]); + surfaceLine.SetDikeToeAtPolderAt(geometry[0]); + surfaceLine.SetDikeToeAtRiverAt(geometry[0]); + surfaceLine.SetDitchDikeSideAt(geometry[0]); + surfaceLine.SetDitchPolderSideAt(geometry[0]); + + // Call + SurfaceLineEntity entity = surfaceLine.Create(registry); + + // Assert + Assert.AreEqual(surfaceLine.Name, entity.Name); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.X, entity.ReferenceLineIntersectionX); + Assert.AreEqual(surfaceLine.ReferenceLineIntersectionWorldPoint.Y, entity.ReferenceLineIntersectionY); + + Assert.AreEqual(geometry.Length, entity.SurfaceLinePointEntities.Count); + SurfaceLinePointEntity[] pointEntities = entity.SurfaceLinePointEntities.ToArray(); + for (int i = 0; i < geometry.Length; i++) + { + SurfaceLinePointEntity pointEntity = pointEntities[i]; + Assert.AreEqual(i, pointEntity.Order); + + Point3D expectedMatchingGeometryPoint = geometry[i]; + Assert.AreEqual(expectedMatchingGeometryPoint.X, pointEntity.X); + Assert.AreEqual(expectedMatchingGeometryPoint.Y, pointEntity.Y); + Assert.AreEqual(expectedMatchingGeometryPoint.Z, pointEntity.Z); + } + + SurfaceLinePointEntity characteristicGeometryPointEntity = pointEntities[0]; + Assert.AreEqual(6, characteristicGeometryPointEntity.CharacteristicPointEntities.Count); + short[] characteristicPointTypeValues = characteristicGeometryPointEntity.CharacteristicPointEntities + .Select(cpe => cpe.CharacteristicPointType) + .ToArray(); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.DikeToeAtRiver); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.DikeToeAtPolder); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.DitchDikeSide); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.BottomDitchDikeSide); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.BottomDitchPolderSide); + CollectionAssert.Contains(characteristicPointTypeValues, (short)CharacteristicPointType.DitchPolderSide); + + Assert.AreEqual(0, entity.SurfaceLineEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + Assert.IsNull(entity.FailureMechanismEntity); + } + + [Test] + public void Create_SurfaceLine_RegisterNewEntityToPersistenceRegistry() + { + // Setup + var registry = new PersistenceRegistry(); + var surfaceLine = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(0.0, 0.0) + }; + + // Call + surfaceLine.Create(registry); + + // Assert + Assert.IsTrue(registry.Contains(surfaceLine)); + } + + [Test] + public void Create_CreatingEntityForSameSurfaceLine_ReturnSamenEntity() + { + // Setup + var surfaceLine = new RingtoetsPipingSurfaceLine + { + ReferenceLineIntersectionWorldPoint = new Point2D(1.1, 2.2) + }; + + var registry = new PersistenceRegistry(); + + // Call + SurfaceLineEntity entity1 = surfaceLine.Create(registry); + SurfaceLineEntity entity2 = surfaceLine.Create(registry); + + // Assert + Assert.AreSame(entity1, entity2); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilModelCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,134 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using Core.Common.Base.Geometry; + +using NUnit.Framework; + +using Ringtoets.Piping.Data; +using Ringtoets.Piping.Data.TestUtil; +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class StochasticSoilModelCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var stochasticSoilModel = new TestStochasticSoilModel(); + + // Call + TestDelegate test = () => stochasticSoilModel.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + public void Create_WithCollector_ReturnsStochasticSoilModelEntityWithPropertiesSet() + { + // Setup + string testName = "testName"; + string testSegmentName = "testSegmentName"; + var stochasticSoilModel = new StochasticSoilModel(-1, testName, testSegmentName); + var registry = new PersistenceRegistry(); + + // Call + var entity = stochasticSoilModel.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(testName, entity.Name); + Assert.AreEqual(testSegmentName, entity.SegmentName); + Assert.IsEmpty(entity.StochasticSoilProfileEntities); + } + + [Test] + public void Create_WithStochasticSoilProfiles_ReturnsStochasticSoilModelEntityWithPropertiesAndStochasticSoilProfileEntitiesSet() + { + // Setup + var stochasticSoilModel = new StochasticSoilModel(-1, "testName", "testSegmentName"); + stochasticSoilModel.StochasticSoilProfiles.Add(new StochasticSoilProfile(50, SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = new TestPipingSoilProfile() + }); + stochasticSoilModel.StochasticSoilProfiles.Add(new StochasticSoilProfile(50, SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = new TestPipingSoilProfile() + }); + var registry = new PersistenceRegistry(); + + // Call + var entity = stochasticSoilModel.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(2, entity.StochasticSoilProfileEntities.Count); + } + + [Test] + public void Create_WithGeometryPoints_ReturnsStochasticSoilModelEntityWithPropertiesAndStochasticSoilModelSegmentPointEntitiesSet() + { + // Setup + var stochasticSoilModel = new StochasticSoilModel(-1, "testName", "testSegmentName"); + stochasticSoilModel.Geometry.AddRange(new[] + { + new Point2D(-12.34, 56.78), + new Point2D(91.23, -34.56) + }); + var registry = new PersistenceRegistry(); + + // Call + var entity = stochasticSoilModel.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(2, entity.StochasticSoilModelSegmentPointEntities.Count); + } + + [Test] + public void Create_SameModelCreatedMultipleTimes_ReturnSameEntity() + { + // Setup + var soilModel = new StochasticSoilModel(1, "A", "B"); + + var registry = new PersistenceRegistry(); + + // Call + StochasticSoilModelEntity entity1 = soilModel.Create(registry); + StochasticSoilModelEntity entity2 = soilModel.Create(registry); + + // Assert + Assert.AreSame(entity1, entity2); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilProfileCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilProfileCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/StochasticSoilProfileCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,115 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.Piping; +using Application.Ringtoets.Storage.DbContext; + +using NUnit.Framework; + +using Ringtoets.Piping.Data; +using Ringtoets.Piping.KernelWrapper.TestUtil; +using Ringtoets.Piping.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.Piping +{ + [TestFixture] + public class StochasticSoilProfileCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var stochasticSoilProfile = new StochasticSoilProfile(40, SoilProfileType.SoilProfile1D, -1); + + // Call + TestDelegate test = () => stochasticSoilProfile.Create(null); + + // Assert + var parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", parameterName); + } + + [Test] + public void Create_WithCollector_ReturnsStochasticSoilProfileEntityWithPropertiesSet() + { + // Setup + var probability = new Random(21).NextDouble(); + var stochasticSoilProfile = new StochasticSoilProfile(probability, SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = new TestPipingSoilProfile() + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = stochasticSoilProfile.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(probability, entity.Probability); + } + + [Test] + public void Create_DifferentStochasticSoilProfilesWithSamePipingSoilProfile_ReturnsStochasticSoilProfileEntityWithSameSoilProfileEntitySet() + { + // Setup + var testPipingSoilProfile = new TestPipingSoilProfile(); + var firstStochasticSoilProfile = new StochasticSoilProfile(new Random(21).NextDouble(), SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = testPipingSoilProfile + }; + var secondStochasticSoilProfile = new StochasticSoilProfile(new Random(21).NextDouble(), SoilProfileType.SoilProfile1D, -1) + { + SoilProfile = testPipingSoilProfile + }; + var registry = new PersistenceRegistry(); + + // Call + var firstEntity = firstStochasticSoilProfile.Create(registry); + var secondEntity = secondStochasticSoilProfile.Create(registry); + + // Assert + Assert.AreSame(firstEntity.SoilProfileEntity, secondEntity.SoilProfileEntity); + } + + [Test] + public void Create_SameStochasticSoilProfileMultipleTimes_ReturnSameEntity() + { + // Setup + var soilProfile = new TestPipingSoilProfile(); + var stochasticSoilProfile = new StochasticSoilProfile(0.4, SoilProfileType.SoilProfile2D, 1) + { + SoilProfile = soilProfile + }; + + var registry = new PersistenceRegistry(); + + // Call + StochasticSoilProfileEntity entity1 = stochasticSoilProfile.Create(registry); + StochasticSoilProfileEntity entity2 = stochasticSoilProfile.Create(registry); + + // Assert + Assert.AreSame(entity1, entity2); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingCalculationScenarioCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingOutputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingProbabilityAssessmentInputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSemiProbabilisticOutputCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSoilLayerCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingSoilProfileCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.PipingStructure; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.PipingStructure +{ + [TestFixture] + public class PipingStructureFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.PipingAtStructure, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.PipingStructureSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructure/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,93 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.PipingStructure; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.PipingStructure +{ + [TestFixture] + public class PipingStructureFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new PipingStructureFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructureFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/PipingStructureFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/RingtoetsPipingSurfaceLineCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StabilityStoneCover; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.StabilityStoneCover +{ + [TestFixture] + public class StabilityStoneCoverFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.StabilityStoneRevetment, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StabilityStoneCoverSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCover/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,90 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.StabilityStoneCover; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.StabilityStoneCover +{ + [TestFixture] + public class StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(AssessmentLayerTwoAResult.NotCalculated, AssessmentLayerTwoAResult.Failed)] AssessmentLayerTwoAResult assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new StabilityStoneCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCoverFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityStoneCoverFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StochasticSoilModelCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StochasticSoilProfileCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.StrengthStabilityLengthwise +{ + [TestFixture] + public class StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.StrengthAndStabilityParallelConstruction, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new StrengthStabilityLengthwiseConstructionFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityLengthwiseConstructionSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwise/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityLengthwise; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.StrengthStabilityLengthwise +{ + [TestFixture] + public class StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new StrengthStabilityLengthwiseConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwiseConstructionFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityLengthwiseConstructionFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.StrengthStabilityPointConstruction +{ + [TestFixture] + public class StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.StrengthAndStabilityPointConstruction, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new StrengthStabilityPointConstructionFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.StrengthStabilityPointConstructionSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstruction/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,106 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.StrengthStabilityPointConstruction; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.StrengthStabilityPointConstruction +{ + [TestFixture] + public class StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(0.2, 0.523)] double assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerTwoA); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new StrengthStabilityPointConstructionFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StrengthStabilityPointConstructionFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.TechnicalInnovation; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.TechnicalInnovation +{ + [TestFixture] + public class TechnicalInnovationFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.TechnicalInnovations, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new TechnicalInnovationFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.TechnicalInnovationSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovation/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.TechnicalInnovation; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.TechnicalInnovation +{ + [TestFixture] + public class TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new TechnicalInnovationFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovationFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/TechnicalInnovationFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.WaterPressureAsphaltCover +{ + [TestFixture] + public class WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.WaterOverpressureAsphaltRevetment, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new WaterPressureAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaterPressureAsphaltCoverSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCover/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,89 @@ +// 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.Create; +using Application.Ringtoets.Storage.Create.WaterPressureAsphaltCover; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.WaterPressureAsphaltCover +{ + [TestFixture] + public class WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new WaterPressureAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCoverFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaterPressureAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -0,0 +1,104 @@ +// 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 System.Linq; + +using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.TestUtil; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone; + +namespace Application.Ringtoets.Storage.Test.Create.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + // Call + TestDelegate test = () => failureMechanism.Create(null); + + // Assert + var paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("registry", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Create_WithCollectorAndPropertiesSet_ReturnsFailureMechanismEntityWithPropertiesSet(bool isRelevant) + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism + { + IsRelevant = isRelevant, + Comments = "Some text" + }; + var registry = new PersistenceRegistry(); + + // Call + var entity = failureMechanism.Create(registry); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual((short)FailureMechanismType.WaveImpactOnAsphaltRevetment, entity.FailureMechanismType); + Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); + Assert.AreEqual(failureMechanism.Comments, entity.Comments); + } + + [Test] + public void Create_WithoutSections_EmptyFailureMechanismSectionEntities() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.IsEmpty(entity.FailureMechanismSectionEntities); + } + + [Test] + public void Create_WithSections_FailureMechanismSectionEntitiesCreated() + { + // Setup + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new TestFailureMechanismSection()); + + // Call + var entity = failureMechanism.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.Count); + Assert.AreEqual(1, entity.FailureMechanismSectionEntities.SelectMany(fms => fms.WaveImpactAsphaltCoverSectionResultEntities).Count()); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCover/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -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.Create; +using Application.Ringtoets.Storage.Create.WaveImpactAsphaltCover; +using Application.Ringtoets.Storage.TestUtil; + +using Core.Common.Base.Data; + +using NUnit.Framework; + +using Ringtoets.Integration.Data.StandAlone.SectionResults; + +namespace Application.Ringtoets.Storage.Test.Create.WaveImpactAsphaltCover +{ + [TestFixture] + public class WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest + { + [Test] + public void Create_WithoutPersistenceRegistry_ThrowsArgumentNullException() + { + // Setup + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + TestDelegate test = () => sectionResult.Create(null); + + // Assert + Assert.Throws(test); + } + + [Test] + public void Create_WithDifferentResults_ReturnsEntityWithExpectedResults( + [Values(true, false)] bool assessmentLayerOneResult, + [Values(0.2, 0.523)] double assessmentLayerTwoAResult, + [Values(3.2, 4.5)] double assessmentLayerThreeResult + ) + { + // Setup + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerOne = assessmentLayerOneResult, + AssessmentLayerTwoA = (RoundedDouble) assessmentLayerTwoAResult, + AssessmentLayerThree = (RoundedDouble) assessmentLayerThreeResult + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.AreEqual(Convert.ToByte(assessmentLayerOneResult), result.LayerOne); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerTwoAResult), result.LayerTwoA); + Assert.AreEqual(Convert.ToDecimal(assessmentLayerThreeResult), result.LayerThree); + } + + [Test] + public void Create_WithNaNLevel2aResult_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerTwoA = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerTwoA); + } + + [Test] + public void Create_WithNaNLevel3Result_ReturnsEntityWithExpectedResults() + { + // Setup + var sectionResult = new WaveImpactAsphaltCoverFailureMechanismSectionResult(new TestFailureMechanismSection()) + { + AssessmentLayerThree = (RoundedDouble) double.NaN + }; + + // Call + var result = sectionResult.Create(new PersistenceRegistry()); + + // Assert + Assert.IsNull(result.LayerThree); + } + } +} \ No newline at end of file Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCoverFailureMechanismCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01ff2c58c13df8f42661ae3e446dc2caaa94247e refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/WaveImpactAsphaltCoverFailureMechanismSectionResultCreateExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/CalculationGroupUpdateExtensionsTest.cs =================================================================== diff -u -r22bff0d2c96822e98da42382cd1c08128d275998 -r01ff2c58c13df8f42661ae3e446dc2caaa94247e --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/CalculationGroupUpdateExtensionsTest.cs (.../CalculationGroupUpdateExtensionsTest.cs) (revision 22bff0d2c96822e98da42382cd1c08128d275998) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/CalculationGroupUpdateExtensionsTest.cs (.../CalculationGroupUpdateExtensionsTest.cs) (revision 01ff2c58c13df8f42661ae3e446dc2caaa94247e) @@ -23,6 +23,7 @@ using System.Linq; using Application.Ringtoets.Storage.Create; +using Application.Ringtoets.Storage.Create.Piping; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.Exceptions; using Application.Ringtoets.Storage.TestUtil;