Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocation.cs
===================================================================
diff -u
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocation.cs (revision 0)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocation.cs (revision 510415935cbdf34b1c927c7cd87d4aff20dcf728)
@@ -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 Core.Common.Base.Data;
+using Core.Common.Base.Geometry;
+
+namespace Ringtoets.DuneErosion.Data
+{
+ ///
+ /// Location of a dune.
+ ///
+ public class DuneLocation
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Name of the .
+ /// X-coordinate of the .
+ /// Y-coordinate of the .
+ /// Coastal area id of the .
+ /// Offset of the .
+ /// Orientation of the .
+ /// D50 of the .
+ /// Thrown when is null.
+ public DuneLocation(string name, double coordinateX, double coordinateY, int coastalAreaId, double offset, double orientation, double d50)
+ {
+ if (name == null)
+ {
+ throw new ArgumentNullException("name");
+ }
+
+ Name = name;
+ Location = new Point2D(coordinateX, coordinateY);
+ CoastalAreaId = coastalAreaId;
+ Offset = new RoundedDouble(2, offset);
+ Orientation = new RoundedDouble(1, orientation);
+ D50 = new RoundedDouble(6, d50);
+ }
+
+ ///
+ /// Gets the name of the dune location.
+ ///
+ public string Name { get; private set; }
+
+ ///
+ /// Gets the location of the dune location.
+ ///
+ public Point2D Location { get; private set; }
+
+ ///
+ /// Gets the coastal area id of the dune location.
+ ///
+ public int CoastalAreaId { get; private set; }
+
+ ///
+ /// Gets the offset of the dune location.
+ ///
+ public RoundedDouble Offset { get; private set; }
+
+ ///
+ /// Gets the orientation of the dune location.
+ ///
+ public RoundedDouble Orientation { get; private set; }
+
+ ///
+ /// Gets the D50 of the dune location.
+ ///
+ public RoundedDouble D50 { get; private set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r510415935cbdf34b1c927c7cd87d4aff20dcf728
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj (.../Ringtoets.DuneErosion.Data.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/Ringtoets.DuneErosion.Data.csproj (.../Ringtoets.DuneErosion.Data.csproj) (revision 510415935cbdf34b1c927c7cd87d4aff20dcf728)
@@ -41,6 +41,7 @@
+
True
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs
===================================================================
diff -u
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs (revision 0)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationTest.cs (revision 510415935cbdf34b1c927c7cd87d4aff20dcf728)
@@ -0,0 +1,100 @@
+// 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 NUnit.Framework;
+using Ringtoets.Common.Data.TestUtil;
+
+namespace Ringtoets.DuneErosion.Data.Test
+{
+ [TestFixture]
+ public class DuneLocationTest
+ {
+ [Test]
+ public void Constructor_NameNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new DuneLocation(null, 0.0, 0.0, 0, 0.0, 0.0, 0.0);
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("name", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ const string name = "Dune location";
+ const double coordinateX = 10.0;
+ const double coordinateY = 12.0;
+ const int coastalAreaId = 3;
+ const double offset = 4.29;
+ const double orientation = 4.2;
+ const double d50 = 0.123456;
+
+ // Call
+ var duneLocation = new DuneLocation(name, coordinateX, coordinateY, coastalAreaId, offset, orientation, d50);
+
+ // Assert
+ Assert.AreEqual(name, duneLocation.Name);
+ Assert.AreEqual(coordinateX, duneLocation.Location.X);
+ Assert.AreEqual(coordinateY, duneLocation.Location.Y);
+ Assert.AreEqual(coastalAreaId, duneLocation.CoastalAreaId);
+ Assert.AreEqual(offset, duneLocation.Offset.Value);
+ Assert.AreEqual(orientation, duneLocation.Orientation.Value);
+ Assert.AreEqual(d50, duneLocation.D50.Value);
+ }
+
+ [Test]
+ public void Constructor_WithOffset_OffsetRounded()
+ {
+ // Call
+ var duneLocation = new DuneLocation("dune", 0.0, 0.0, 0, 4.298, 0.0, 0.0);
+
+ // Assert
+ Assert.AreEqual(2, duneLocation.Offset.NumberOfDecimalPlaces);
+ Assert.AreEqual(4.30, duneLocation.Offset, duneLocation.Offset.GetAccuracy());
+ }
+
+ [Test]
+ public void Constructor_WithOrientation_OrientationRounded()
+ {
+ // Call
+ var duneLocation = new DuneLocation("dune", 0.0, 0.0, 0, 0.0, 8.214, 0.0);
+
+ // Assert
+ Assert.AreEqual(1, duneLocation.Orientation.NumberOfDecimalPlaces);
+ Assert.AreEqual(8.2, duneLocation.Orientation, duneLocation.Orientation.GetAccuracy());
+ }
+
+ [Test]
+ public void Constructor_WithD50_D50Rounded()
+ {
+ // Call
+ var duneLocation = new DuneLocation("dune", 0.0, 0.0, 0, 0.0, 0.0, 0.1234567);
+
+ // Assert
+ Assert.AreEqual(6, duneLocation.D50.NumberOfDecimalPlaces);
+ Assert.AreEqual(0.123457, duneLocation.D50, duneLocation.D50.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj
===================================================================
diff -u -r23d1e296e2da4364fbfe346e68d582dfcf966bb0 -r510415935cbdf34b1c927c7cd87d4aff20dcf728
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision 23d1e296e2da4364fbfe346e68d582dfcf966bb0)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/Ringtoets.DuneErosion.Data.Test.csproj (.../Ringtoets.DuneErosion.Data.Test.csproj) (revision 510415935cbdf34b1c927c7cd87d4aff20dcf728)
@@ -51,6 +51,7 @@
+
@@ -68,6 +69,10 @@
{D4200F43-3F72-4F42-AF0A-8CED416A38EC}
Ringtoets.Common.Data
+
+ {4843D6E5-066F-4795-94F5-1D53932DD03C}
+ Ringtoets.Common.Data.TestUtil
+
{D1068432-C172-4AA6-847B-D9DEB4C6DE26}
Ringtoets.DuneErosion.Data