Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj =================================================================== diff -u -r8e213638a22dd9f04d965d875bb58156db019be5 -r36d13a2d6fade97d565f186f5eaec5d382cba27a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 8e213638a22dd9f04d965d875bb58156db019be5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -79,6 +79,7 @@ + @@ -408,6 +409,7 @@ + Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensions.cs (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -0,0 +1,57 @@ +// Copyright (C) Stichting Deltares 2017. 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.MacroStabilityInwards.Primitives; + +namespace Application.Ringtoets.Storage.Create.MacroStabilityInwards +{ + /// + /// Extension methods for related to creating + /// a . + /// + internal static class MacroStabilityInwardsPreconsolidationStressCreateExtensions + { + /// + /// Creates a based on the information + /// of the . + /// + /// PreconsolidationStress to create a database entity for. + /// A new . + /// Thrown when is null. + public static MacroStabilityInwardsPreconsolidationStressEntity Create(this MacroStabilityInwardsPreconsolidationStress preconsolidationStress) + { + if (preconsolidationStress == null) + { + throw new ArgumentNullException(nameof(preconsolidationStress)); + } + + return new MacroStabilityInwardsPreconsolidationStressEntity + { + CoordinateX = preconsolidationStress.XCoordinate, + CoordinateZ = preconsolidationStress.ZCoordinate, + PreconsolidationStressMean = preconsolidationStress.PreconsolidationStressMean, + PreconsolidationStressCoefficientOfVariation = preconsolidationStress.PreconsolidationStressCoefficientOfVariation + }; + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensions.cs =================================================================== diff -u -r8e213638a22dd9f04d965d875bb58156db019be5 -r36d13a2d6fade97d565f186f5eaec5d382cba27a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensions.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensions.cs) (revision 8e213638a22dd9f04d965d875bb58156db019be5) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/MacroStabilityInwards/MacroStabilityInwardsSoilProfile2DCreateExtensions.cs (.../MacroStabilityInwardsSoilProfile2DCreateExtensions.cs) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -39,7 +39,7 @@ /// /// The soil profile to create a database entity for. /// The object keeping track of create operations. - /// A new or one from the + /// A new or one from the /// if it was created for the earlier. /// Thrown when any input parameter is null. public static MacroStabilityInwardsSoilProfileTwoDEntity Create(this MacroStabilityInwardsSoilProfile2D soilProfile, Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensions.cs =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensions.cs (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensions.cs (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -0,0 +1,56 @@ +// Copyright (C) Stichting Deltares 2017. 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.MacroStabilityInwards.Primitives; + +namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards +{ + /// + /// This class defines extension methods for read operations for a + /// based on the . + /// + internal static class MacroStabilityInwardsPreconsolidationStressReadExtensions + { + /// + /// Reads the and use the information + /// to construct a . + /// + /// The to create + /// for. + /// A new . + /// Thrown when is null. + public static MacroStabilityInwardsPreconsolidationStress Read(this MacroStabilityInwardsPreconsolidationStressEntity entity) + { + if (entity == null) + { + throw new ArgumentNullException(nameof(entity)); + } + + return new MacroStabilityInwardsPreconsolidationStress(entity.CoordinateX, + entity.CoordinateZ, + entity.PreconsolidationStressMean, + entity.PreconsolidationStressCoefficientOfVariation + ); + } + } +} \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSectionResultEntityReadExtensions.cs =================================================================== diff -u -r85cf65b38e2e96810139a8490fec8eb5b95837a6 -r36d13a2d6fade97d565f186f5eaec5d382cba27a --- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSectionResultEntityReadExtensions.cs (.../MacroStabilityInwardsSectionResultEntityReadExtensions.cs) (revision 85cf65b38e2e96810139a8490fec8eb5b95837a6) +++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/MacroStabilityInwards/MacroStabilityInwardsSectionResultEntityReadExtensions.cs (.../MacroStabilityInwardsSectionResultEntityReadExtensions.cs) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -28,8 +28,8 @@ namespace Application.Ringtoets.Storage.Read.MacroStabilityInwards { /// - /// This class defines extension methods for read operations for a based on the - /// . + /// This class defines extension methods for read operations for a + /// based on the . /// internal static class MacroStabilityInwardsSectionResultEntityReadExtensions { Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj =================================================================== diff -u -r8e213638a22dd9f04d965d875bb58156db019be5 -r36d13a2d6fade97d565f186f5eaec5d382cba27a --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 8e213638a22dd9f04d965d875bb58156db019be5) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -98,6 +98,7 @@ + @@ -146,6 +147,7 @@ + Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest.cs (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -0,0 +1,65 @@ +// Copyright (C) Stichting Deltares 2017. 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.MacroStabilityInwards; +using Application.Ringtoets.Storage.DbContext; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Application.Ringtoets.Storage.Test.Create.MacroStabilityInwards +{ + [TestFixture] + public class MacroStabilityInwardsPreconsolidationStressCreateExtensionsTest + { + [Test] + public void Create_PreconsolidationStressNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ((MacroStabilityInwardsPreconsolidationStress) null).Create(); + + // Assert + string parameterName = Assert.Throws(test).ParamName; + Assert.AreEqual("preconsolidationStress", parameterName); + } + + [Test] + public void Create_WithValidProperties_ReturnsEntityWithPropertiesSet() + { + // Setup + var random = new Random(31); + var stress = new MacroStabilityInwardsPreconsolidationStress(random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble()); + + // Call + MacroStabilityInwardsPreconsolidationStressEntity entity = stress.Create(); + + // Assert + Assert.IsNotNull(entity); + Assert.AreEqual(stress.XCoordinate, entity.CoordinateX); + Assert.AreEqual(stress.ZCoordinate, entity.CoordinateZ); + Assert.AreEqual(stress.PreconsolidationStressMean, entity.PreconsolidationStressMean); + Assert.AreEqual(stress.PreconsolidationStressCoefficientOfVariation, entity.PreconsolidationStressCoefficientOfVariation); + } + } +} \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensionsTest.cs =================================================================== diff -u --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensionsTest.cs (revision 0) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/MacroStabilityInwards/MacroStabilityInwardsPreconsolidationStressReadExtensionsTest.cs (revision 36d13a2d6fade97d565f186f5eaec5d382cba27a) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. 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.MacroStabilityInwards; +using NUnit.Framework; +using Ringtoets.MacroStabilityInwards.Primitives; + +namespace Application.Ringtoets.Storage.Test.Read.MacroStabilityInwards +{ + [TestFixture] + public class MacroStabilityInwardsPreconsolidationStressReadExtensionsTest + { + [Test] + public void Read_EntityNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => ((MacroStabilityInwardsPreconsolidationStressEntity) null).Read(); + + // Assert + var exception = Assert.Throws(test); + Assert.AreEqual("entity", exception.ParamName); + } + + [Test] + public void Read_WithValues_ReturnsExpectedMacroStabilityInwardsPreconsolidationStress() + { + // Setup + var random = new Random(31); + var entity = new MacroStabilityInwardsPreconsolidationStressEntity + { + CoordinateX = random.NextDouble(), + CoordinateZ = random.NextDouble(), + PreconsolidationStressMean = random.NextDouble(), + PreconsolidationStressCoefficientOfVariation = random.NextDouble() + }; + + // Call + MacroStabilityInwardsPreconsolidationStress stress = entity.Read(); + + // Assert + Assert.IsNotNull(stress); + Assert.AreEqual(entity.CoordinateX, stress.XCoordinate); + Assert.AreEqual(entity.CoordinateZ, stress.ZCoordinate); + Assert.AreEqual(entity.PreconsolidationStressMean, stress.PreconsolidationStressMean); + Assert.AreEqual(entity.PreconsolidationStressCoefficientOfVariation, stress.PreconsolidationStressCoefficientOfVariation); + } + } +} \ No newline at end of file