Index: Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs
===================================================================
diff -u -re3c8135a137a664bc323012ca829d606ebee6bff -r9bded049d932924a8bed22d6758d24a0303e8ea0
--- Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs (.../AggregatedDuneLocation.cs) (revision e3c8135a137a664bc323012ca829d606ebee6bff)
+++ Riskeer/DuneErosion/src/Riskeer.DuneErosion.Forms/Views/AggregatedDuneLocation.cs (.../AggregatedDuneLocation.cs) (revision 9bded049d932924a8bed22d6758d24a0303e8ea0)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
@@ -122,6 +123,66 @@
}
///
+ /// Creates a new instance of .
+ ///
+ /// The id of the dune location.
+ /// The name of the dune location.
+ /// The location of the dune location
+ /// The coastal area id of the dune location.
+ /// The offset of the dune location.
+ /// The d50 of the dune location.
+ /// The results of the
+ /// water level calculations for different target probabilities.
+ /// The results of the
+ /// wave height calculations for different target probabilities.
+ /// The results of the
+ /// wave period calculations for different target probabilities.
+ /// Thrown when ,
+ /// , ,
+ /// or
+ /// is null.
+ public AggregatedDuneLocation(long id, string name, Point2D location, int coastalAreaId, RoundedDouble offset, RoundedDouble d50,
+ IEnumerable> waterLevelCalculationsForTargetProbabilities,
+ IEnumerable> waveHeightCalculationsForTargetProbabilities,
+ IEnumerable> wavePeriodCalculationsForTargetProbabilities)
+ {
+ if (name == null)
+ {
+ throw new ArgumentNullException(nameof(name));
+ }
+
+ if (location == null)
+ {
+ throw new ArgumentNullException(nameof(location));
+ }
+
+ if (waterLevelCalculationsForTargetProbabilities == null)
+ {
+ throw new ArgumentNullException(nameof(waterLevelCalculationsForTargetProbabilities));
+ }
+
+ if (waveHeightCalculationsForTargetProbabilities == null)
+ {
+ throw new ArgumentNullException(nameof(waveHeightCalculationsForTargetProbabilities));
+ }
+
+ if (wavePeriodCalculationsForTargetProbabilities == null)
+ {
+ throw new ArgumentNullException(nameof(wavePeriodCalculationsForTargetProbabilities));
+ }
+
+ Id = id;
+ Name = name;
+ Location = location;
+ CoastalAreaId = coastalAreaId;
+ Offset = offset;
+ D50 = d50;
+ WaterLevelCalculationsForTargetProbabilities = waterLevelCalculationsForTargetProbabilities;
+ WaveHeightCalculationsForTargetProbabilities = waveHeightCalculationsForTargetProbabilities;
+ WavePeriodCalculationsForTargetProbabilities = wavePeriodCalculationsForTargetProbabilities;
+ }
+
+ ///
/// Gets the id of the dune location.
///
public long Id { get; }
@@ -225,5 +286,20 @@
/// Gets the result of the wave period for the factorized lower limit norm.
///
public RoundedDouble WavePeriodForFactorizedLowerLimitNorm { get; }
+
+ ///
+ /// Gets the results of the water level calculations for different target probabilities.
+ ///
+ public IEnumerable> WaterLevelCalculationsForTargetProbabilities { get; }
+
+ ///
+ /// Gets the results of the wave height calculations for different target probabilities.
+ ///
+ public IEnumerable> WaveHeightCalculationsForTargetProbabilities { get; }
+
+ ///
+ /// Gets the results of the wave period calculations for different target probabilities.
+ ///
+ public IEnumerable> WavePeriodCalculationsForTargetProbabilities { get; }
}
}
\ No newline at end of file
Index: Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/AggregatedDuneLocationTest.cs
===================================================================
diff -u -re3c8135a137a664bc323012ca829d606ebee6bff -r9bded049d932924a8bed22d6758d24a0303e8ea0
--- Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/AggregatedDuneLocationTest.cs (.../AggregatedDuneLocationTest.cs) (revision e3c8135a137a664bc323012ca829d606ebee6bff)
+++ Riskeer/DuneErosion/test/Riskeer.DuneErosion.Forms.Test/Views/AggregatedDuneLocationTest.cs (.../AggregatedDuneLocationTest.cs) (revision 9bded049d932924a8bed22d6758d24a0303e8ea0)
@@ -20,6 +20,7 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.TestUtil;
@@ -35,27 +36,29 @@
public void Constructor_NameNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new AggregatedDuneLocation(0, null, new Point2D(0, 0), 0, new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble());
+ void Call() => new AggregatedDuneLocation(0, null, new Point2D(0, 0), 0, new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble());
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("name", exception.ParamName);
}
[Test]
public void Constructor_LocationNull_ThrowsArgumentNullException()
{
// Call
- TestDelegate call = () => new AggregatedDuneLocation(0, string.Empty, null, 0, new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
- new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble());
+ void Call() => new AggregatedDuneLocation(0, string.Empty, null, 0, new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble(), new RoundedDouble(), new RoundedDouble(),
+ new RoundedDouble(), new RoundedDouble());
// Assert
- var exception = Assert.Throws(call);
+ var exception = Assert.Throws(Call);
Assert.AreEqual("location", exception.ParamName);
}
@@ -128,5 +131,83 @@
Assert.AreEqual(wavePeriodForLowerLimitNorm, aggregatedDuneLocation.WavePeriodForLowerLimitNorm);
Assert.AreEqual(wavePeriodForFactorizedLowerLimitNorm, aggregatedDuneLocation.WavePeriodForFactorizedLowerLimitNorm);
}
+
+ [Test]
+ public void Constructor_WaterLevelCalculationsForTargetProbabilitiesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new AggregatedDuneLocation(0, string.Empty, new Point2D(0, 0), 0,
+ RoundedDouble.NaN, RoundedDouble.NaN, null,
+ Array.Empty>(),
+ Array.Empty>());
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("waterLevelCalculationsForTargetProbabilities", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WaveHeightCalculationsForTargetProbabilitiesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new AggregatedDuneLocation(0, string.Empty, new Point2D(0, 0), 0,
+ RoundedDouble.NaN, RoundedDouble.NaN,
+ Array.Empty>(),
+ null,
+ Array.Empty>());
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("waveHeightCalculationsForTargetProbabilities", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_WavePeriodCalculationsForTargetProbabilitiesNull_ThrowsArgumentNullException()
+ {
+ // Call
+ void Call() => new AggregatedDuneLocation(0, string.Empty, new Point2D(0, 0), 0,
+ RoundedDouble.NaN, RoundedDouble.NaN,
+ Array.Empty>(),
+ Array.Empty>(),
+ null);
+
+ // Assert
+ var exception = Assert.Throws(Call);
+ Assert.AreEqual("wavePeriodCalculationsForTargetProbabilities", exception.ParamName);
+ }
+
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ var random = new Random(21);
+
+ long id = random.Next();
+ const string name = "DuneLocationName";
+ var location = new Point2D(random.NextDouble(), random.NextDouble());
+ int coastalAreaId = random.Next();
+ RoundedDouble offset = random.NextRoundedDouble();
+ RoundedDouble d50 = random.NextRoundedDouble();
+ var waterLevelCalculationsForTargetProbabilities = new List>();
+ var waveHeightCalculationsForTargetProbabilities = new List>();
+ var wavePeriodCalculationsForTargetProbabilities = new List>();
+
+ // Call
+ var aggregatedDuneLocation = new AggregatedDuneLocation(id, name, location, coastalAreaId, offset, d50,
+ waterLevelCalculationsForTargetProbabilities,
+ waveHeightCalculationsForTargetProbabilities,
+ wavePeriodCalculationsForTargetProbabilities);
+
+ // Assert
+ Assert.AreEqual(id, aggregatedDuneLocation.Id);
+ Assert.AreEqual(name, aggregatedDuneLocation.Name);
+ Assert.AreSame(location, aggregatedDuneLocation.Location);
+ Assert.AreEqual(coastalAreaId, aggregatedDuneLocation.CoastalAreaId);
+ Assert.AreEqual(offset, aggregatedDuneLocation.Offset);
+ Assert.AreEqual(d50, aggregatedDuneLocation.D50);
+ Assert.AreSame(waterLevelCalculationsForTargetProbabilities, aggregatedDuneLocation.WaterLevelCalculationsForTargetProbabilities);
+ Assert.AreSame(waveHeightCalculationsForTargetProbabilities, aggregatedDuneLocation.WaveHeightCalculationsForTargetProbabilities);
+ Assert.AreSame(wavePeriodCalculationsForTargetProbabilities, aggregatedDuneLocation.WavePeriodCalculationsForTargetProbabilities);
+ }
}
}
\ No newline at end of file