Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -radbfca968beb93b87561607f2b0fd9a23bdfc6bd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision adbfca968beb93b87561607f2b0fd9a23bdfc6bd) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -60,9 +60,12 @@ Properties\GlobalAssembly.cs + + + @@ -220,11 +223,15 @@ RingtoetsEntities.tt + + + + @@ -326,7 +333,6 @@ - Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs (.../ClosingStructuresFailureMechanismCreateExtensions.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensions.cs (.../ClosingStructuresFailureMechanismCreateExtensions.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -44,6 +44,7 @@ var entity = mechanism.Create(FailureMechanismType.ReliabilityClosingOfStructure, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); + AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); return entity; } @@ -71,5 +72,10 @@ entity.ForeshoreProfileEntities.Add(foreshoreProfileEntity); } } + + private static void AddEntitiesForFailureMechanismMeta(GeneralClosingStructuresInput generalInput, FailureMechanismEntity entity) + { + entity.ClosingStructureFailureMechanismMetaEntities.Add(generalInput.Create()); + } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,48 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.ClosingStructures.Data; + +namespace Application.Ringtoets.Storage.Create.ClosingStructures +{ + /// + /// Extension methods for related to creating + /// a . + /// + internal static class GeneralClosingStructuresInputCreateExtensions + { + /// + /// Creates a based on + /// the information of the . + /// + /// The general input to create a database entity for. + /// A new . + internal static ClosingStructureFailureMechanismMetaEntity Create(this GeneralClosingStructuresInput input) + { + return new ClosingStructureFailureMechanismMetaEntity + { + N2A = input.N2A, + C = input.C.Value.ToNaNAsNull() + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,47 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Create.HeightStructures +{ + /// + /// Extension methods for related to creating + /// a . + /// + internal static class GeneralHeightStructuresInputCreateExtensions + { + /// + /// Creates a based on + /// the information of the . + /// + /// The general input to create a database entity for. + /// A new . + internal static HeightStructuresFailureMechanismMetaEntity Create(this GeneralHeightStructuresInput input) + { + return new HeightStructuresFailureMechanismMetaEntity + { + N = input.N + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensions.cs (.../HeightStructuresFailureMechanismCreateExtensions.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -41,9 +41,10 @@ /// Thrown when is null. internal static FailureMechanismEntity Create(this HeightStructuresFailureMechanism mechanism, PersistenceRegistry registry) { - var entity = mechanism.Create(FailureMechanismType.StructureHeight, registry); + FailureMechanismEntity entity = mechanism.Create(FailureMechanismType.StructureHeight, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); + AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); return entity; } @@ -71,5 +72,10 @@ entity.ForeshoreProfileEntities.Add(foreshoreProfileEntity); } } + + private static void AddEntitiesForFailureMechanismMeta(GeneralHeightStructuresInput generalInput, FailureMechanismEntity entity) + { + entity.HeightStructuresFailureMechanismMetaEntities.Add(generalInput.Create()); + } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,47 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.StabilityPointStructures.Data; + +namespace Application.Ringtoets.Storage.Create.StabilityPointStructures +{ + /// + /// Extension methods for related to creating + /// a . + /// + internal static class GeneralStabilityPointStructuresInputCreateExtensions + { + /// + /// Creates a based on + /// the information of the . + /// + /// The general input to create a database entity for. + /// A new . + internal static StabilityPointStructuresFailureMechanismMetaEntity Create(this GeneralStabilityPointStructuresInput input) + { + return new StabilityPointStructuresFailureMechanismMetaEntity + { + N = input.N + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs (.../StabilityPointStructuresFailureMechanismCreateExtensions.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensions.cs (.../StabilityPointStructuresFailureMechanismCreateExtensions.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -44,6 +44,7 @@ var entity = mechanism.Create(FailureMechanismType.StabilityPointStructures, registry); AddEntitiesForSectionResults(mechanism.SectionResults, registry); AddEntitiesForForeshoreProfiles(mechanism.ForeshoreProfiles, entity, registry); + AddEntitiesForFailureMechanismMeta(mechanism.GeneralInput, entity); return entity; } @@ -71,5 +72,10 @@ entity.ForeshoreProfileEntities.Add(foreshoreProfileEntity); } } + + private static void AddEntitiesForFailureMechanismMeta(GeneralStabilityPointStructuresInput generalInput, FailureMechanismEntity entity) + { + entity.StabilityPointStructuresFailureMechanismMetaEntities.Add(generalInput.Create()); + } } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,50 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using Ringtoets.ClosingStructures.Data; + +namespace Application.Ringtoets.Storage.Read.ClosingStructures +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class ClosingStructuresFailureMechanismMetaEntityReadExtensions + { + /// + /// Read the and use the + /// information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static GeneralClosingStructuresInput Read(this ClosingStructureFailureMechanismMetaEntity entity) + { + return new GeneralClosingStructuresInput + { + N2A = entity.N2A, + C = (RoundedDouble) entity.C.ToNullAsNaN() + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/FailureMechanismEntityReadExtensions.cs (.../FailureMechanismEntityReadExtensions.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.Read.ClosingStructures; using Application.Ringtoets.Storage.Read.GrassCoverErosionInwards; using Application.Ringtoets.Storage.Read.GrassCoverErosionOutwards; +using Application.Ringtoets.Storage.Read.HeightStructures; using Application.Ringtoets.Storage.Read.Piping; using Application.Ringtoets.Storage.Read.StabilityPointStructures; using Application.Ringtoets.Storage.Read.WaveImpactAsphaltCover; @@ -221,6 +222,7 @@ entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadHeightStructuresMechanismSectionResults(failureMechanism, collector); entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + entity.ReadGeneralInput(failureMechanism.GeneralInput); } private static void ReadHeightStructuresMechanismSectionResults(this FailureMechanismEntity entity, HeightStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) @@ -234,6 +236,12 @@ } } + private static void ReadGeneralInput(this FailureMechanismEntity entity, GeneralHeightStructuresInput generalInput) + { + GeneralHeightStructuresInput generalHeightStructuresInput = entity.HeightStructuresFailureMechanismMetaEntities.First().Read(); + generalInput.N = generalHeightStructuresInput.N; + } + #endregion #region Strength Stability Lengthwise Construction @@ -330,6 +338,7 @@ entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadClosingStructuresMechanismSectionResults(failureMechanism, collector); entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + entity.ReadGeneralInput(failureMechanism.GeneralInput); } private static void ReadClosingStructuresMechanismSectionResults(this FailureMechanismEntity entity, ClosingStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) @@ -343,6 +352,13 @@ } } + private static void ReadGeneralInput(this FailureMechanismEntity entity, GeneralClosingStructuresInput generalInput) + { + GeneralClosingStructuresInput generalClosingStructuresInput = entity.ClosingStructureFailureMechanismMetaEntities.First().Read(); + generalInput.C = generalClosingStructuresInput.C; + generalInput.N2A = generalClosingStructuresInput.N2A; + } + #endregion #region Macrostability Inwards @@ -692,6 +708,7 @@ entity.ReadCommonFailureMechanismProperties(failureMechanism, collector); entity.ReadStabilityPointStructuresMechanismSectionResults(failureMechanism, collector); entity.ReadForeshoreProfiles(failureMechanism.ForeshoreProfiles, collector); + entity.ReadGeneralInput(failureMechanism.GeneralInput); } private static void ReadStabilityPointStructuresMechanismSectionResults(this FailureMechanismEntity entity, StabilityPointStructuresFailureMechanism failureMechanism, ReadConversionCollector collector) @@ -705,6 +722,12 @@ } } + private static void ReadGeneralInput(this FailureMechanismEntity entity, GeneralStabilityPointStructuresInput generalInput) + { + GeneralStabilityPointStructuresInput generalStabilityPointStructuresInput = entity.StabilityPointStructuresFailureMechanismMetaEntities.First().Read(); + generalInput.N = generalStabilityPointStructuresInput.N; + } + #endregion } } \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,48 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Read.HeightStructures +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class HeightStructuresFailureMechanismMetaEntityReadExtensions + { + /// + /// Read the and use the + /// information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static GeneralHeightStructuresInput Read(this HeightStructuresFailureMechanismMetaEntity entity) + { + return new GeneralHeightStructuresInput + { + N = entity.N + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,53 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Read.HeightStructures +{ + /// + /// This class defines extension methods for read operations for a based on the + /// . + /// + internal static class HeightStructuresSectionResultEntityReadExtensions + { + /// + /// Reads the and use the information to construct a + /// . + /// + /// The to create for. + /// The target of the read operation. + /// A new . + /// Thrown when is null. + internal static void Read(this HeightStructuresSectionResultEntity entity, HeightStructuresFailureMechanismSectionResult sectionResult) + { + if (sectionResult == null) + { + throw new ArgumentNullException("sectionResult"); + } + sectionResult.AssessmentLayerOne = Convert.ToBoolean(entity.LayerOne); + sectionResult.AssessmentLayerThree = (RoundedDouble) entity.LayerThree.ToNullAsNaN(); + } + } +} \ No newline at end of file Fisheye: Tag cc91baaea7dfcc12765017b57ffc768c7d02f7a1 refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Storage/Read/HeightStructuresSectionResultEntityReadExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensions.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,48 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Ringtoets.StabilityPointStructures.Data; + +namespace Application.Ringtoets.Storage.Read.StabilityPointStructures +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class StabilityPointStructureFailureMechanismMetaEntityReadExtensions + { + /// + /// Read the and use the + /// information to construct a . + /// + /// The + /// to create for. + /// A new . + internal static GeneralStabilityPointStructuresInput Read(this StabilityPointStructuresFailureMechanismMetaEntity entity) + { + return new GeneralStabilityPointStructuresInput + { + N = entity.N + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r1a062846c75d2d86454dc052adc7a5993b79963e -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 1a062846c75d2d86454dc052adc7a5993b79963e) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -77,15 +77,22 @@ Properties\GlobalAssembly.cs + + + + + + + @@ -189,7 +196,6 @@ - Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (.../ClosingStructuresFailureMechanismCreateExtensionsTest.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/ClosingStructuresFailureMechanismCreateExtensionsTest.cs (.../ClosingStructuresFailureMechanismCreateExtensionsTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.Create.ClosingStructures; using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; +using Core.Common.Base.Data; using NUnit.Framework; using Ringtoets.ClosingStructures.Data; @@ -56,7 +57,12 @@ var failureMechanism = new ClosingStructuresFailureMechanism { IsRelevant = isRelevant, - Comments = "Some text" + Comments = "Some text", + GeneralInput = + { + C = (RoundedDouble) 0.76, + N2A = 5 + } }; var registry = new PersistenceRegistry(); @@ -68,6 +74,10 @@ Assert.AreEqual((short) FailureMechanismType.ReliabilityClosingOfStructure, entity.FailureMechanismType); Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); Assert.AreEqual(failureMechanism.Comments, entity.Comments); + + ClosingStructureFailureMechanismMetaEntity metaEntity = entity.ClosingStructureFailureMechanismMetaEntities.First(); + Assert.AreEqual(failureMechanism.GeneralInput.C.Value, metaEntity.C); + Assert.AreEqual(failureMechanism.GeneralInput.N2A, metaEntity.N2A); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/ClosingStructures/GeneralClosingStructuresInputCreateExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,80 @@ +// 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.ClosingStructures; +using Application.Ringtoets.Storage.DbContext; +using Core.Common.Base.Data; +using NUnit.Framework; +using Ringtoets.ClosingStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Create.ClosingStructures +{ + [TestFixture] + public class GeneralClosingStructuresInputCreateExtensionsTest + { + [Test] + public void Create_ValidInput_ReturnMetaEntity() + { + // Setup + var random = new Random(45); + var generalinput = new GeneralClosingStructuresInput + { + N2A = random.Next(1, 20), + C = (RoundedDouble) 1.23 + }; + + // Call + ClosingStructureFailureMechanismMetaEntity entity = generalinput.Create(); + + // Assert + Assert.AreEqual(generalinput.N2A, entity.N2A); + Assert.AreEqual(generalinput.C.Value, entity.C); + + Assert.IsNull(entity.FailureMechanismEntity); + Assert.AreEqual(0, entity.ClosingStructureFailureMechanismMetaEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + } + + [Test] + public void Create_ValidInputWithNaN_ReturnMetaEntity() + { + // Setup + var random = new Random(45); + var generalinput = new GeneralClosingStructuresInput + { + N2A = random.Next(1, 20), + C = (RoundedDouble) double.NaN + }; + + // Call + ClosingStructureFailureMechanismMetaEntity entity = generalinput.Create(); + + // Assert + Assert.AreEqual(generalinput.N2A, entity.N2A); + Assert.IsNull(entity.C); + + Assert.IsNull(entity.FailureMechanismEntity); + Assert.AreEqual(0, entity.ClosingStructureFailureMechanismMetaEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/GeneralHeightStructuresInputCreateExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,54 @@ +// 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.HeightStructures; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Create.HeightStructures +{ + [TestFixture] + public class GeneralHeightStructuresInputCreateExtensionsTest + { + [Test] + public void Create_ValidInput_ReturnMetaEntity() + { + // Setup + var random = new Random(1); + var generalinput = new GeneralHeightStructuresInput + { + N = random.Next(1, 20) + }; + + // Call + HeightStructuresFailureMechanismMetaEntity entity = generalinput.Create(); + + // Assert + Assert.AreEqual(generalinput.N, entity.N); + + Assert.IsNull(entity.FailureMechanismEntity); + Assert.AreEqual(0, entity.HeightStructuresFailureMechanismMetaEntity1); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresFailureMechanismCreateExtensionsTest.cs (.../HeightStructuresFailureMechanismCreateExtensionsTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -56,18 +56,25 @@ var failureMechanism = new HeightStructuresFailureMechanism { IsRelevant = isRelevant, - Comments = "Some text" + Comments = "Some text", + GeneralInput = + { + N = 7 + } }; var registry = new PersistenceRegistry(); // Call - var entity = failureMechanism.Create(registry); + FailureMechanismEntity entity = failureMechanism.Create(registry); // Assert Assert.IsNotNull(entity); Assert.AreEqual((short) FailureMechanismType.StructureHeight, entity.FailureMechanismType); Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); Assert.AreEqual(failureMechanism.Comments, entity.Comments); + + HeightStructuresFailureMechanismMetaEntity metaEntity = entity.HeightStructuresFailureMechanismMetaEntities.First(); + Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/GeneralStabilityPointStructuresInputCreateExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,54 @@ +// 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.StabilityPointStructures; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.StabilityPointStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Create.StabilityPointStructures +{ + [TestFixture] + public class GeneralStabilityPointStructuresInputCreateExtensionsTest + { + [Test] + public void Create_ValidInput_ReturnMetaEntity() + { + // Setup + var random = new Random(4); + var generalinput = new GeneralStabilityPointStructuresInput + { + N = random.Next(1, 20) + }; + + // Call + StabilityPointStructuresFailureMechanismMetaEntity entity = generalinput.Create(); + + // Assert + Assert.AreEqual(generalinput.N, entity.N); + + Assert.IsNull(entity.FailureMechanismEntity); + Assert.AreEqual(0, entity.StrengthStabilityPointConstructionFailureMechanismMetaEntityId); + Assert.AreEqual(0, entity.FailureMechanismEntityId); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/StabilityPointStructures/StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs (.../StabilityPointStructuresFailureMechanismCreateExtensionsTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -56,7 +56,11 @@ var failureMechanism = new StabilityPointStructuresFailureMechanism { IsRelevant = isRelevant, - Comments = "Some text" + Comments = "Some text", + GeneralInput = + { + N = 4 + } }; var registry = new PersistenceRegistry(); @@ -68,6 +72,9 @@ Assert.AreEqual((short) FailureMechanismType.StabilityPointStructures, entity.FailureMechanismType); Assert.AreEqual(Convert.ToByte(isRelevant), entity.IsRelevant); Assert.AreEqual(failureMechanism.Comments, entity.Comments); + + var metaEntity = entity.StabilityPointStructuresFailureMechanismMetaEntities.First(); + Assert.AreEqual(failureMechanism.GeneralInput.N, metaEntity.N); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -888,6 +888,8 @@ private static void AssertHeightStructuresFailureMechanism(HeightStructuresFailureMechanism expectedFailureMechanism, HeightStructuresFailureMechanism actualFailureMechanism) { + Assert.AreEqual(expectedFailureMechanism.GeneralInput.N, actualFailureMechanism.GeneralInput.N); + AssertForeshoreProfiles(expectedFailureMechanism.ForeshoreProfiles, actualFailureMechanism.ForeshoreProfiles); } @@ -898,6 +900,9 @@ private static void AssertClosingStructuresFailureMechanism(ClosingStructuresFailureMechanism expectedFailureMechanism, ClosingStructuresFailureMechanism actualFailureMechanism) { + Assert.AreEqual(expectedFailureMechanism.GeneralInput.N2A, actualFailureMechanism.GeneralInput.N2A); + Assert.AreEqual(expectedFailureMechanism.GeneralInput.C, actualFailureMechanism.GeneralInput.C); + AssertForeshoreProfiles(expectedFailureMechanism.ForeshoreProfiles, actualFailureMechanism.ForeshoreProfiles); } @@ -908,6 +913,8 @@ private static void AssertStabilityPointStructuresFailureMechanism(StabilityPointStructuresFailureMechanism expectedFailureMechanism, StabilityPointStructuresFailureMechanism actualFailureMechanism) { + Assert.AreEqual(expectedFailureMechanism.GeneralInput.N, actualFailureMechanism.GeneralInput.N); + AssertForeshoreProfiles(expectedFailureMechanism.ForeshoreProfiles, actualFailureMechanism.ForeshoreProfiles); } Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs =================================================================== diff -u -r2973c5f790a5131e427bd5f73e2a620044199639 -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision 2973c5f790a5131e427bd5f73e2a620044199639) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/AssessmentSectionEntityReadExtensionsTest.cs (.../AssessmentSectionEntityReadExtensionsTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -795,16 +795,119 @@ [Test] [TestCase(true)] [TestCase(false)] + public void Read_WithHeightStructuresWithProperties_ReturnsHeightStructuresWithProperties(bool isRelevant) + { + // Setup + var entity = CreateAssessmentSectionEntity(); + const string comments = "Some text"; + + var failureMechanismEntity = new FailureMechanismEntity + { + FailureMechanismType = (int)FailureMechanismType.StructureHeight, + CalculationGroupEntity = new CalculationGroupEntity(), + IsRelevant = Convert.ToByte(isRelevant), + Comments = comments, + HeightStructuresFailureMechanismMetaEntities = + { + new HeightStructuresFailureMechanismMetaEntity + { + N = 5 + } + } + }; + entity.FailureMechanismEntities.Add(failureMechanismEntity); + + var collector = new ReadConversionCollector(); + + // Call + var section = entity.Read(collector); + + // Assert + Assert.AreEqual(isRelevant, section.HeightStructures.IsRelevant); + Assert.AreEqual(comments, section.HeightStructures.Comments); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithClosingStructuresWithProperties_ReturnsClosingStructuresWithProperties(bool isRelevant) + { + // Setup + var entity = CreateAssessmentSectionEntity(); + const string comments = "Some text"; + + var failureMechanismEntity = new FailureMechanismEntity + { + FailureMechanismType = (int)FailureMechanismType.ReliabilityClosingOfStructure, + CalculationGroupEntity = new CalculationGroupEntity(), + IsRelevant = Convert.ToByte(isRelevant), + Comments = comments, + ClosingStructureFailureMechanismMetaEntities = + { + new ClosingStructureFailureMechanismMetaEntity + { + C = 1.1, + N2A = 3 + } + } + }; + entity.FailureMechanismEntities.Add(failureMechanismEntity); + + var collector = new ReadConversionCollector(); + + // Call + var section = entity.Read(collector); + + // Assert + Assert.AreEqual(isRelevant, section.ClosingStructures.IsRelevant); + Assert.AreEqual(comments, section.ClosingStructures.Comments); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithStabilityPointStructuresWithProperties_ReturnsStabilityPointStructuresWithProperties(bool isRelevant) + { + // Setup + var entity = CreateAssessmentSectionEntity(); + const string comments = "Some text"; + + var failureMechanismEntity = new FailureMechanismEntity + { + FailureMechanismType = (int)FailureMechanismType.StabilityPointStructures, + CalculationGroupEntity = new CalculationGroupEntity(), + IsRelevant = Convert.ToByte(isRelevant), + Comments = comments, + StabilityPointStructuresFailureMechanismMetaEntities = + { + new StabilityPointStructuresFailureMechanismMetaEntity + { + N = 5 + } + } + }; + entity.FailureMechanismEntities.Add(failureMechanismEntity); + + var collector = new ReadConversionCollector(); + + // Call + var section = entity.Read(collector); + + // Assert + Assert.AreEqual(isRelevant, section.StabilityPointStructures.IsRelevant); + Assert.AreEqual(comments, section.StabilityPointStructures.Comments); + } + + [Test] + [TestCase(true)] + [TestCase(false)] public void Read_WithStandAloneFailureMechanisms_ReturnsNewAssessmentSectionWithFailureMechanismsSet(bool isRelevant) { // Setup var entity = CreateAssessmentSectionEntity(); var macrostabilityInwardsEntityComment = "2"; var macrostabilityOutwardsEntityComment = "3"; var microstabilityEntityComment = "4"; - var structureHeightEntityComment = "5"; - var closingEntityComment = "16"; - var failingOfConstructionPointEntityComment = "22"; var failingOfConstructionLengthwiseEntityComment = "23"; var waterPressureEntityComment = "78"; var grassCoverSlipoffOutwardsEntityComment = "134"; @@ -815,9 +918,6 @@ entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, macrostabilityInwardsEntityComment, FailureMechanismType.MacrostabilityInwards)); entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, macrostabilityOutwardsEntityComment, FailureMechanismType.MacrostabilityOutwards)); entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, microstabilityEntityComment, FailureMechanismType.Microstability)); - entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, structureHeightEntityComment, FailureMechanismType.StructureHeight)); - entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, closingEntityComment, FailureMechanismType.ReliabilityClosingOfStructure)); - entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, failingOfConstructionPointEntityComment, FailureMechanismType.StabilityPointStructures)); entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, failingOfConstructionLengthwiseEntityComment, FailureMechanismType.StrengthAndStabilityParallelConstruction)); entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, waterPressureEntityComment, FailureMechanismType.WaterOverpressureAsphaltRevetment)); entity.FailureMechanismEntities.Add(CreateFailureMechanismEntity(isRelevant, grassCoverSlipoffOutwardsEntityComment, FailureMechanismType.GrassRevetmentSlidingOutwards)); @@ -834,9 +934,6 @@ AssertFailureMechanismEqual(isRelevant, macrostabilityInwardsEntityComment, 2, section.MacrostabilityInwards); AssertFailureMechanismEqual(isRelevant, macrostabilityOutwardsEntityComment, 2, section.MacrostabilityOutwards); AssertFailureMechanismEqual(isRelevant, microstabilityEntityComment, 2, section.Microstability); - AssertFailureMechanismEqual(isRelevant, structureHeightEntityComment, 2, section.HeightStructures); - AssertFailureMechanismEqual(isRelevant, closingEntityComment, 2, section.ClosingStructures); - AssertFailureMechanismEqual(isRelevant, failingOfConstructionPointEntityComment, 2, section.StabilityPointStructures); AssertFailureMechanismEqual(isRelevant, failingOfConstructionLengthwiseEntityComment, 2, section.StrengthStabilityLengthwiseConstruction); AssertFailureMechanismEqual(isRelevant, waterPressureEntityComment, 2, section.WaterPressureAsphaltCover); AssertFailureMechanismEqual(isRelevant, grassCoverSlipoffOutwardsEntityComment, 2, section.GrassCoverSlipOffOutwards); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/ClosingStructures/ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,50 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.ClosingStructures; +using NUnit.Framework; +using Ringtoets.ClosingStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Read.ClosingStructures +{ + [TestFixture] + public class ClosingStructuresFailureMechanismMetaEntityReadExtensionsTest + { + [Test] + public void Read_Always_ReturnHeightStructuresGeneralInput() + { + // Setup + var entity = new ClosingStructureFailureMechanismMetaEntity + { + N2A = 3, + C = 2.2 + }; + + // Call + GeneralClosingStructuresInput generalInput = entity.Read(); + + // Assert + Assert.AreEqual(entity.N2A, generalInput.N2A); + Assert.AreEqual(entity.C, generalInput.C.Value); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/FailureMechanismEntityReadExtensionsTest.cs (.../FailureMechanismEntityReadExtensionsTest.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -836,6 +836,7 @@ public void ReadAsHeightStructuresFailureMechanism_WithForshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup + const int generalInputN = 7; var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -853,6 +854,13 @@ GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), Order = 0 }, + }, + HeightStructuresFailureMechanismMetaEntities = + { + new HeightStructuresFailureMechanismMetaEntity + { + N = generalInputN + } } }; var collector = new ReadConversionCollector(); @@ -869,6 +877,8 @@ ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; Assert.AreEqual("Child1", child2.Name); + + Assert.AreEqual(generalInputN, failureMechanism.GeneralInput.N); } #endregion @@ -879,6 +889,9 @@ public void ReadAsClosingStructuresFailureMechanism_WithForshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup + const double generalInputC = 1.1; + const int generalInputN2A = 3; + var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -895,7 +908,15 @@ Name = "Child2", GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), Order = 0 - }, + } + }, + ClosingStructureFailureMechanismMetaEntities = + { + new ClosingStructureFailureMechanismMetaEntity + { + C = generalInputC, + N2A = generalInputN2A + } } }; var collector = new ReadConversionCollector(); @@ -912,6 +933,9 @@ ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; Assert.AreEqual("Child1", child2.Name); + + Assert.AreEqual(generalInputC, failureMechanism.GeneralInput.C.Value); + Assert.AreEqual(generalInputN2A, failureMechanism.GeneralInput.N2A); } #endregion @@ -922,6 +946,8 @@ public void ReadAsStabilityPointStructuresFailureMechanism_WithForshoreProfiles_ReturnFailureMechanismWithForeshoreProfilesSet() { // Setup + const int generalInputN = 5; + var entity = new FailureMechanismEntity { CalculationGroupEntity = new CalculationGroupEntity(), @@ -938,7 +964,14 @@ Name = "Child2", GeometryXml = new Point2DXmlSerializer().ToXml(Enumerable.Empty()), Order = 0 - }, + } + }, + StabilityPointStructuresFailureMechanismMetaEntities = + { + new StabilityPointStructuresFailureMechanismMetaEntity + { + N = generalInputN + } } }; var collector = new ReadConversionCollector(); @@ -955,6 +988,8 @@ ForeshoreProfile child2 = failureMechanism.ForeshoreProfiles[1]; Assert.AreEqual("Child1", child2.Name); + + Assert.AreEqual(generalInputN, failureMechanism.GeneralInput.N); } #endregion Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresFailureMechanismMetaEntityReadExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,48 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.HeightStructures; +using NUnit.Framework; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Read.HeightStructures +{ + [TestFixture] + public class HeightStructuresFailureMechanismMetaEntityReadExtensionsTest + { + [Test] + public void Read_Always_ReturnHeightStructuresGeneralInput() + { + // Setup + var entity = new HeightStructuresFailureMechanismMetaEntity + { + N = 3 + }; + + // Call + GeneralHeightStructuresInput generalInput = entity.Read(); + + // Assert + Assert.AreEqual(entity.N, generalInput.N); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresSectionResultEntityReadExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,102 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read; +using Application.Ringtoets.Storage.Read.HeightStructures; +using Application.Ringtoets.Storage.TestUtil; +using NUnit.Framework; +using Ringtoets.HeightStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Read.HeightStructures +{ + [TestFixture] + public class HeightStructuresSectionResultEntityReadExtensionsTest + { + [Test] + public void Read_SectionResultIsNull_ThrowArgumentNullException() + { + // Setup + var entity = new HeightStructuresSectionResultEntity(); + + // Call + TestDelegate call = () => entity.Read(null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("sectionResult", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithDecimalParameterValues_ReturnHeightStructuresSectionResultWithDoubleParameterValues(bool layerOne) + { + // Setup + var random = new Random(21); + double layerThree = random.NextDouble(); + var collector = new ReadConversionCollector(); + + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new HeightStructuresSectionResultEntity + { + LayerThree = layerThree, + LayerOne = Convert.ToByte(layerOne), + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNotNull(sectionResult); + Assert.AreEqual(layerOne, sectionResult.AssessmentLayerOne); + Assert.AreEqual(layerThree, sectionResult.AssessmentLayerThree, 1e-6); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Read_WithNullParameterValues_ReturnHeightStructuresSectionResultWithNullParameters(bool layerOne) + { + // Setup + var collector = new ReadConversionCollector(); + var failureMechanismSectionEntity = new FailureMechanismSectionEntity(); + collector.Read(failureMechanismSectionEntity, new TestFailureMechanismSection()); + var entity = new HeightStructuresSectionResultEntity + { + LayerOne = Convert.ToByte(layerOne), + LayerThree = null, + FailureMechanismSectionEntity = failureMechanismSectionEntity + }; + var sectionResult = new HeightStructuresFailureMechanismSectionResult(new TestFailureMechanismSection()); + + // Call + entity.Read(sectionResult); + + // Assert + Assert.IsNaN(sectionResult.AssessmentLayerThree); + } + } +} \ No newline at end of file Fisheye: Tag cc91baaea7dfcc12765017b57ffc768c7d02f7a1 refers to a dead (removed) revision in file `Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructuresSectionResultEntityReadExtensionsTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StabilityPointStructures/StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest.cs (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -0,0 +1,48 @@ +// 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 Application.Ringtoets.Storage.DbContext; +using Application.Ringtoets.Storage.Read.StabilityPointStructures; +using NUnit.Framework; +using Ringtoets.StabilityPointStructures.Data; + +namespace Application.Ringtoets.Storage.Test.Read.StabilityPointStructures +{ + [TestFixture] + public class StabilityPointStructureFailureMechanismMetaEntityReadExtensionsTest + { + [Test] + public void Read_Always_ReturnHeightStructuresGeneralInput() + { + // Setup + var entity = new StabilityPointStructuresFailureMechanismMetaEntity + { + N = 3 + }; + + // Call + GeneralStabilityPointStructuresInput generalInput = entity.Read(); + + // Assert + Assert.AreEqual(entity.N, generalInput.N); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs =================================================================== diff -u -rbeb484b744b2d77062ca98ef4ebf7cd32ee5a0cd -rcc91baaea7dfcc12765017b57ffc768c7d02f7a1 --- Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision beb484b744b2d77062ca98ef4ebf7cd32ee5a0cd) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.TestUtil/RingtoetsProjectTestHelper.cs (.../RingtoetsProjectTestHelper.cs) (revision cc91baaea7dfcc12765017b57ffc768c7d02f7a1) @@ -96,16 +96,19 @@ HeightStructuresFailureMechanism heightStructuresFailureMechanism = assessmentSection.HeightStructures; AddForeshoreProfiles(heightStructuresFailureMechanism.ForeshoreProfiles); + ConfigureHeightStructuresFailureMechanism(heightStructuresFailureMechanism); AddSections(heightStructuresFailureMechanism); SetSectionResults(heightStructuresFailureMechanism.SectionResults); ClosingStructuresFailureMechanism closingStructuresFailureMechanism = assessmentSection.ClosingStructures; AddForeshoreProfiles(closingStructuresFailureMechanism.ForeshoreProfiles); + ConfigureClosingStructuresFailureMechanism(closingStructuresFailureMechanism); AddSections(closingStructuresFailureMechanism); SetSectionResults(closingStructuresFailureMechanism.SectionResults); StabilityPointStructuresFailureMechanism stabilityPointStructuresFailureMechanism = assessmentSection.StabilityPointStructures; AddForeshoreProfiles(stabilityPointStructuresFailureMechanism.ForeshoreProfiles); + ConfigureStabilityPointStructuresFailureMechanism(stabilityPointStructuresFailureMechanism); AddSections(stabilityPointStructuresFailureMechanism); SetSectionResults(stabilityPointStructuresFailureMechanism.SectionResults); @@ -358,6 +361,34 @@ return hydraulicBoundaryDatabase; } + #region HeightStructures FailureMechanism + + private static void ConfigureHeightStructuresFailureMechanism(HeightStructuresFailureMechanism failureMechanism) + { + failureMechanism.GeneralInput.N = 5; + } + + #endregion + + #region ClosingStructures FailureMechanism + + private static void ConfigureClosingStructuresFailureMechanism(ClosingStructuresFailureMechanism failureMechanism) + { + failureMechanism.GeneralInput.N2A = 6; + failureMechanism.GeneralInput.C = (RoundedDouble) 0.77; + } + + #endregion + + #region StabilityPointStructures FailureMechanism + + private static void ConfigureStabilityPointStructuresFailureMechanism(StabilityPointStructuresFailureMechanism failureMechanism) + { + failureMechanism.GeneralInput.N = 8; + } + + #endregion + #region Piping FailureMechanism private static void ConfigurePipingFailureMechanism(PipingFailureMechanism pipingFailureMechanism, AssessmentSection assessmentSection)