Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj
===================================================================
diff -u -r1b46ad78fa9971fa15b74ca1e7904acf3483f24a -r13e40c4b5b76b2a155c4490fdeb7b9644fde18f3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 1b46ad78fa9971fa15b74ca1e7904acf3483f24a)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Application.Ringtoets.Storage.csproj (.../Application.Ringtoets.Storage.csproj) (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -127,6 +127,7 @@
+
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs
===================================================================
diff -u -r062281754a35164e1095479c9f1ccb8ee821f939 -r13e40c4b5b76b2a155c4490fdeb7b9644fde18f3
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs (.../Point2DCreateExtensions.cs) (revision 062281754a35164e1095479c9f1ccb8ee821f939)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Create/Point2DCreateExtensions.cs (.../Point2DCreateExtensions.cs) (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -65,5 +65,25 @@
return entity;
}
+
+ ///
+ /// Creates a based on the
+ /// information of the .
+ ///
+ /// The point to create a database entity for.
+ /// A value representing the position of the point in an
+ /// ordered collection.
+ /// A new .
+ internal static StochasticSoilModelSegmentPointEntity CreateStochasticSoilModelSegmentPointEntity(this Point2D point, int order)
+ {
+ var entity = new StochasticSoilModelSegmentPointEntity
+ {
+ X = Convert.ToDecimal(point.X),
+ Y = Convert.ToDecimal(point.Y),
+ Order = order
+ };
+
+ return entity;
+ }
}
}
\ No newline at end of file
Index: Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelSegmentPointEntityReadExtensions.cs
===================================================================
diff -u
--- Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelSegmentPointEntityReadExtensions.cs (revision 0)
+++ Application/Ringtoets/src/Application.Ringtoets.Storage/Read/StochasticSoilModelSegmentPointEntityReadExtensions.cs (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -0,0 +1,49 @@
+// 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.Read
+{
+ ///
+ /// This class defines extension methods for read operations for a
+ /// based on the .
+ ///
+ internal static class StochasticSoilModelSegmentPointEntityReadExtensions
+ {
+ ///
+ /// Reads the and use the information to construct a .
+ ///
+ /// The to create for.
+ /// A new .
+ internal static Point2D Read(this StochasticSoilModelSegmentPointEntity entity)
+ {
+ return new Point2D(Convert.ToDouble(entity.X),
+ Convert.ToDouble(entity.Y));
+ }
+ }
+}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj
===================================================================
diff -u -rfe68c3f7cae5946b93d9e27eb532b176a6b26b84 -r13e40c4b5b76b2a155c4490fdeb7b9644fde18f3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision fe68c3f7cae5946b93d9e27eb532b176a6b26b84)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Application.Ringtoets.Storage.Test.csproj (.../Application.Ringtoets.Storage.Test.csproj) (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -106,6 +106,7 @@
+
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs
===================================================================
diff -u -r35408ec0912670519b01cff44a19a3e2fb12d8d6 -r13e40c4b5b76b2a155c4490fdeb7b9644fde18f3
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs (.../Point2DCreateExtensionsTest.cs) (revision 35408ec0912670519b01cff44a19a3e2fb12d8d6)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Point2DCreateExtensionsTest.cs (.../Point2DCreateExtensionsTest.cs) (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -21,6 +21,8 @@
using System;
using Application.Ringtoets.Storage.Create;
+using Application.Ringtoets.Storage.DbContext;
+
using Core.Common.Base.Geometry;
using NUnit.Framework;
@@ -72,5 +74,30 @@
Assert.AreEqual(Convert.ToDecimal(y), entity.Y);
Assert.AreEqual(order, entity.Order);
}
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(100)]
+ [TestCase(Int32.MaxValue)]
+ [TestCase(Int32.MinValue)]
+ public void CreateStochasticSoilModelSegmentPointEntity_Always_NewStochasticSoilModelSegmentPointEntityWithPropertiesSet(int order)
+ {
+ // Setup
+ var random = new Random(21);
+ double x = random.NextDouble();
+ double y = random.NextDouble();
+ var point = new Point2D(x, y);
+
+ // Call
+ StochasticSoilModelSegmentPointEntity entity = point.CreateStochasticSoilModelSegmentPointEntity(order);
+
+ // Assert
+ Assert.AreEqual(Convert.ToDecimal(x), entity.X);
+ Assert.AreEqual(Convert.ToDecimal(y), entity.Y);
+ Assert.AreEqual(order, entity.Order);
+
+ Assert.AreEqual(0, entity.StochasticSoilModelSegmentPointEntityId);
+ Assert.AreEqual(0, entity.StochasticSoilModelEntityId);
+ }
}
}
\ No newline at end of file
Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs
===================================================================
diff -u
--- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs (revision 0)
+++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/StochasticSoilModelSegmentPointEntityReadExtensionsTest.cs (revision 13e40c4b5b76b2a155c4490fdeb7b9644fde18f3)
@@ -0,0 +1,35 @@
+using System;
+
+using Application.Ringtoets.Storage.DbContext;
+using Application.Ringtoets.Storage.Read;
+
+using Core.Common.Base.Geometry;
+
+using NUnit.Framework;
+
+namespace Application.Ringtoets.Storage.Test.Read
+{
+ [TestFixture]
+ public class StochasticSoilModelSegmentPointEntityReadExtensionsTest
+ {
+ [Test]
+ [TestCase(1.1, -2.2)]
+ [TestCase(-3.3, 4.4)]
+ public void Read_ValidEntity_ReturnPoint2D(double x, double y)
+ {
+ // Setup
+ var entity = new StochasticSoilModelSegmentPointEntity
+ {
+ X = Convert.ToDecimal(x),
+ Y = Convert.ToDecimal(y)
+ };
+
+ // Call
+ Point2D point = entity.Read();
+
+ // Assert
+ Assert.AreEqual(x, point.X);
+ Assert.AreEqual(y, point.Y);
+ }
+ }
+}
\ No newline at end of file