Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Data/DuneLocation.cs =================================================================== diff -u -r2ba330f4b2da07e3769d9573bd22d53435975240 -rc657c1124d87ec256c10ea111c5a37ce9deb55d5 --- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Data/DuneLocation.cs (.../DuneLocation.cs) (revision 2ba330f4b2da07e3769d9573bd22d53435975240) +++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Data/DuneLocation.cs (.../DuneLocation.cs) (revision c657c1124d87ec256c10ea111c5a37ce9deb55d5) @@ -22,6 +22,7 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Riskeer.Common.Data.Hydraulics; namespace Riskeer.DuneErosion.Data { @@ -33,27 +34,31 @@ /// /// Creates a new instance of . /// - /// Id of the . /// Name of the . - /// The coordinate of the . + /// The that belongs + /// to this . /// The container of the properties for the . - /// Thrown when - /// or is null. - public DuneLocation(long id, string name, Point2D location, ConstructionProperties properties) + /// Thrown when any parameter is null. + public DuneLocation(string name, HydraulicBoundaryLocation hydraulicBoundaryLocation, ConstructionProperties properties) { if (name == null) { throw new ArgumentNullException(nameof(name)); } + if (hydraulicBoundaryLocation == null) + { + throw new ArgumentNullException(nameof(hydraulicBoundaryLocation)); + } + if (properties == null) { throw new ArgumentNullException(nameof(properties)); } - Id = id; + Id = hydraulicBoundaryLocation.Id; Name = name; - Location = location; + Location = hydraulicBoundaryLocation.Location; CoastalAreaId = properties.CoastalAreaId; Offset = new RoundedDouble(1, properties.Offset); Orientation = new RoundedDouble(1, properties.Orientation); Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Data.Test/DuneLocationTest.cs =================================================================== diff -u -r9e9976818f1b446948c3bf815cafe2e023f98ac1 -rc657c1124d87ec256c10ea111c5a37ce9deb55d5 --- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Data.Test/DuneLocationTest.cs (.../DuneLocationTest.cs) (revision 9e9976818f1b446948c3bf815cafe2e023f98ac1) +++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Data.Test/DuneLocationTest.cs (.../DuneLocationTest.cs) (revision c657c1124d87ec256c10ea111c5a37ce9deb55d5) @@ -20,8 +20,8 @@ // All rights reserved. using System; -using Core.Common.Base.Geometry; using NUnit.Framework; +using Riskeer.Common.Data.Hydraulics; using Riskeer.Common.Data.TestUtil; namespace Riskeer.DuneErosion.Data.Test @@ -33,38 +33,48 @@ public void Constructor_NameNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new DuneLocation(0, null, new Point2D(0.0, 0.0), new DuneLocation.ConstructionProperties()); + void Call() => new DuneLocation(null, new TestHydraulicBoundaryLocation(), new DuneLocation.ConstructionProperties()); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("name", exception.ParamName); } [Test] + public void Constructor_HydraulicBoundaryLocationNull_ThrowsArgumentNullException() + { + // Call + void Call() => new DuneLocation(string.Empty, null, new DuneLocation.ConstructionProperties()); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("hydraulicBoundaryLocation", exception.ParamName); + } + + [Test] public void Constructor_PropertiesNull_ThrowArgumentNullException() { // Call - TestDelegate test = () => new DuneLocation(0, string.Empty, new Point2D(0.0, 0.0), null); + void Call() => new DuneLocation(string.Empty, new TestHydraulicBoundaryLocation(), null); // Assert - var exception = Assert.Throws(test); + var exception = Assert.Throws(Call); Assert.AreEqual("properties", exception.ParamName); } [Test] public void Constructor_ExpectedValues() { // Setup - const long id = 0; const string name = "Dune location"; - var location = new Point2D(10.0, 12.0); + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "hydraulic boundary location", 10.0, 12.0); const int coastalAreaId = 3; const double offset = 4.2; const double orientation = 4.2; const double d50 = 0.123456; // Call - var duneLocation = new DuneLocation(id, name, location, + var duneLocation = new DuneLocation(name, hydraulicBoundaryLocation, new DuneLocation.ConstructionProperties { CoastalAreaId = coastalAreaId, @@ -74,9 +84,9 @@ }); // Assert - Assert.AreEqual(id, duneLocation.Id); + Assert.AreEqual(hydraulicBoundaryLocation.Id, duneLocation.Id); Assert.AreEqual(name, duneLocation.Name); - Assert.AreSame(location, duneLocation.Location); + Assert.AreSame(hydraulicBoundaryLocation.Location, duneLocation.Location); Assert.AreEqual(coastalAreaId, duneLocation.CoastalAreaId); Assert.AreEqual(offset, duneLocation.Offset.Value); Assert.AreEqual(orientation, duneLocation.Orientation.Value); @@ -87,7 +97,7 @@ public void Constructor_WithOffset_OffsetRounded() { // Call - var duneLocation = new DuneLocation(0, "dune", new Point2D(0.0, 0.0), + var duneLocation = new DuneLocation("dune", new TestHydraulicBoundaryLocation(), new DuneLocation.ConstructionProperties { Offset = 4.298 @@ -102,7 +112,7 @@ public void Constructor_WithOrientation_OrientationRounded() { // Call - var duneLocation = new DuneLocation(0, "dune", new Point2D(0.0, 0.0), + var duneLocation = new DuneLocation("dune", new TestHydraulicBoundaryLocation(), new DuneLocation.ConstructionProperties { Orientation = 8.214 @@ -117,7 +127,7 @@ public void Constructor_WithD50_D50Rounded() { // Call - var duneLocation = new DuneLocation(0, "dune", new Point2D(0.0, 0.0), + var duneLocation = new DuneLocation("dune", new TestHydraulicBoundaryLocation(), new DuneLocation.ConstructionProperties { D50 = 0.1234567