Index: Ringtoets/Common/src/Ringtoets.Common.Util/AggregatedHydraulicBoundaryLocation.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Util/AggregatedHydraulicBoundaryLocation.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Util/AggregatedHydraulicBoundaryLocation.cs (revision 174c7e1a90b17034a5d75a995037cd32f696b55d) @@ -0,0 +1,146 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Base.Geometry; + +namespace Ringtoets.Common.Util +{ + /// + /// Class that holds all the information of a hydraulic boundary location and calculations. + /// + public class AggregatedHydraulicBoundaryLocation + { + /// + /// Creates a new instance of + /// + /// The id of the hydraulic boundary location. + /// The name of the hydraulic boundary location. + /// The location of the hydraulic boundary location. + /// The result of the + /// water level calculation for factorized signaling norm. + /// The result of the water level + /// calculation for signaling norm. + /// The result of the water level + /// calculation for lower limit norm. + /// The result of the + /// water level calculation for factorized lower limit norm. + /// The result of the + /// wave height calculation for factorized signaling norm. + /// The result of the wave height + /// calculation for signaling norm. + /// The result of the wave height + /// calculation for lower limit norm. + /// The result of the + /// wave height calculation for factorized lower limit norm. + /// Thrown when or + /// is null. + public AggregatedHydraulicBoundaryLocation( + long id, string name, Point2D location, + RoundedDouble waterLevelCalculationForFactorizedSignalingNorm, + RoundedDouble waterLevelCalculationForSignalingNorm, + RoundedDouble waterLevelCalculationForLowerLimitNorm, + RoundedDouble waterLevelCalculationForFactorizedLowerLimitNorm, + RoundedDouble waveHeightCalculationForFactorizedSignalingNorm, + RoundedDouble waveHeightCalculationForSignalingNorm, + RoundedDouble waveHeightCalculationForLowerLimitNorm, + RoundedDouble waveHeightCalculationForFactorizedLowerLimitNorm) + { + if (name == null) + { + throw new ArgumentNullException(nameof(name)); + } + + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + Id = id; + Name = name; + Location = location; + WaterLevelCalculationForFactorizedSignalingNorm = waterLevelCalculationForFactorizedSignalingNorm; + WaterLevelCalculationForSignalingNorm = waterLevelCalculationForSignalingNorm; + WaterLevelCalculationForLowerLimitNorm = waterLevelCalculationForLowerLimitNorm; + WaterLevelCalculationForFactorizedLowerLimitNorm = waterLevelCalculationForFactorizedLowerLimitNorm; + WaveHeightCalculationForFactorizedSignalingNorm = waveHeightCalculationForFactorizedSignalingNorm; + WaveHeightCalculationForSignalingNorm = waveHeightCalculationForSignalingNorm; + WaveHeightCalculationForLowerLimitNorm = waveHeightCalculationForLowerLimitNorm; + WaveHeightCalculationForFactorizedLowerLimitNorm = waveHeightCalculationForFactorizedLowerLimitNorm; + } + + /// + /// Gets the id of the hydraulic boundary location. + /// + public long Id { get; } + + /// + /// Gets the name of the hydraulic boundary location. + /// + public string Name { get; } + + /// + /// Gets the location of the hydraulic boundary location. + /// + public Point2D Location { get; } + + /// + /// Gets the result of the water level calculation for factorized signaling norm. + /// + public RoundedDouble WaterLevelCalculationForFactorizedSignalingNorm { get; } + + /// + /// Gets the result of the water level calculation for signaling norm. + /// + public RoundedDouble WaterLevelCalculationForSignalingNorm { get; } + + /// + /// Gets the result of the water level calculation for lower limit norm. + /// + public RoundedDouble WaterLevelCalculationForLowerLimitNorm { get; } + + /// + /// Gets the result of the water level calculation for factorized lower limit norm. + /// + public RoundedDouble WaterLevelCalculationForFactorizedLowerLimitNorm { get; } + + /// + /// Gets the result of the wave height calculation for factorized signaling norm. + /// + public RoundedDouble WaveHeightCalculationForFactorizedSignalingNorm { get; } + + /// + /// Gets the result of the wave height calculation for signaling norm. + /// + public RoundedDouble WaveHeightCalculationForSignalingNorm { get; } + + /// + /// Gets the result of the wave height calculation for lower limit norm. + /// + public RoundedDouble WaveHeightCalculationForLowerLimitNorm { get; } + + /// + /// Gets the result of the wave height calculation for factorized lower limit norm. + /// + public RoundedDouble WaveHeightCalculationForFactorizedLowerLimitNorm { get; } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Util/Ringtoets.Common.Util.csproj =================================================================== diff -u -rfcad48d7beb394e1ac15cfe4289a7381e05aa883 -r174c7e1a90b17034a5d75a995037cd32f696b55d --- Ringtoets/Common/src/Ringtoets.Common.Util/Ringtoets.Common.Util.csproj (.../Ringtoets.Common.Util.csproj) (revision fcad48d7beb394e1ac15cfe4289a7381e05aa883) +++ Ringtoets/Common/src/Ringtoets.Common.Util/Ringtoets.Common.Util.csproj (.../Ringtoets.Common.Util.csproj) (revision 174c7e1a90b17034a5d75a995037cd32f696b55d) @@ -11,6 +11,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Util.Test/AggregatedHydraulicBoundaryLocationTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Util.Test/AggregatedHydraulicBoundaryLocationTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Util.Test/AggregatedHydraulicBoundaryLocationTest.cs (revision 174c7e1a90b17034a5d75a995037cd32f696b55d) @@ -0,0 +1,101 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.TestUtil; +using NUnit.Framework; + +namespace Ringtoets.Common.Util.Test +{ + [TestFixture] + public class AggregatedHydraulicBoundaryLocationTest + { + [Test] + public void Constructor_NameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new AggregatedHydraulicBoundaryLocation(0, null, new Point2D(0, 0), + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("name", exception.ParamName); + } + + [Test] + public void Constructor_LocationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new AggregatedHydraulicBoundaryLocation(0, string.Empty, null, + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble(), + new RoundedDouble(), new RoundedDouble()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("location", exception.ParamName); + } + + [Test] + public void Constructor_WithAllData_ExpectedValues() + { + // Setup + const string name = "location"; + + var random = new Random(39); + long id = random.Next(); + var location = new Point2D(random.NextDouble(), random.NextDouble()); + RoundedDouble waterLevelCalculationForFactorizedSignalingNorm = random.NextRoundedDouble(); + RoundedDouble waterLevelCalculationForSignalingNorm = random.NextRoundedDouble(); + RoundedDouble waterLevelCalculationForLowerLimitNorm = random.NextRoundedDouble(); + RoundedDouble waterLevelCalculationForFactorizedLowerLimitNorm = random.NextRoundedDouble(); + RoundedDouble waveHeightCalculationForFactorizedSignalingNorm = random.NextRoundedDouble(); + RoundedDouble waveHeightCalculationForSignalingNorm = random.NextRoundedDouble(); + RoundedDouble waveHeightCalculationForLowerLimitNorm = random.NextRoundedDouble(); + RoundedDouble waveHeightCalculationForFactorizedLowerLimitNorm = random.NextRoundedDouble(); + + // Call + var aggregatedLocation = new AggregatedHydraulicBoundaryLocation( + id, name, location, waterLevelCalculationForFactorizedSignalingNorm, waterLevelCalculationForSignalingNorm, + waterLevelCalculationForLowerLimitNorm, waterLevelCalculationForFactorizedLowerLimitNorm, waveHeightCalculationForFactorizedSignalingNorm, + waveHeightCalculationForSignalingNorm, waveHeightCalculationForLowerLimitNorm, waveHeightCalculationForFactorizedLowerLimitNorm); + + // Assert + Assert.AreEqual(id, aggregatedLocation.Id); + Assert.AreEqual(name, aggregatedLocation.Name); + Assert.AreSame(location, aggregatedLocation.Location); + Assert.AreEqual(waterLevelCalculationForFactorizedSignalingNorm, aggregatedLocation.WaterLevelCalculationForFactorizedSignalingNorm); + Assert.AreEqual(waterLevelCalculationForSignalingNorm, aggregatedLocation.WaterLevelCalculationForSignalingNorm); + Assert.AreEqual(waterLevelCalculationForLowerLimitNorm, aggregatedLocation.WaterLevelCalculationForLowerLimitNorm); + Assert.AreEqual(waterLevelCalculationForFactorizedLowerLimitNorm, aggregatedLocation.WaterLevelCalculationForFactorizedLowerLimitNorm); + Assert.AreEqual(waveHeightCalculationForFactorizedSignalingNorm, aggregatedLocation.WaveHeightCalculationForFactorizedSignalingNorm); + Assert.AreEqual(waveHeightCalculationForSignalingNorm, aggregatedLocation.WaveHeightCalculationForSignalingNorm); + Assert.AreEqual(waveHeightCalculationForLowerLimitNorm, aggregatedLocation.WaveHeightCalculationForLowerLimitNorm); + Assert.AreEqual(waveHeightCalculationForFactorizedLowerLimitNorm, aggregatedLocation.WaveHeightCalculationForFactorizedLowerLimitNorm); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Util.Test/Ringtoets.Common.Util.Test.csproj =================================================================== diff -u -rfcad48d7beb394e1ac15cfe4289a7381e05aa883 -r174c7e1a90b17034a5d75a995037cd32f696b55d --- Ringtoets/Common/test/Ringtoets.Common.Util.Test/Ringtoets.Common.Util.Test.csproj (.../Ringtoets.Common.Util.Test.csproj) (revision fcad48d7beb394e1ac15cfe4289a7381e05aa883) +++ Ringtoets/Common/test/Ringtoets.Common.Util.Test/Ringtoets.Common.Util.Test.csproj (.../Ringtoets.Common.Util.Test.csproj) (revision 174c7e1a90b17034a5d75a995037cd32f696b55d) @@ -19,6 +19,7 @@ +