Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs =================================================================== diff -u -r5f1c70d7eea83fca2ef6305a87a8098820ded1d9 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs (.../GeneralResultConverterTest.cs) (revision 5f1c70d7eea83fca2ef6305a87a8098820ded1d9) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/GeneralResultConverterTest.cs (.../GeneralResultConverterTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -31,8 +31,10 @@ using GeneralResult = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.GeneralResult; using HydraGeneralResult = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.GeneralResult; using HydraWindDirection = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.WindDirection; -using HydraWindStochast = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.Stochast; +using HydraStochast = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.Stochast; +using HydraRealizedStochast = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.RealizedStochast; using HydraSubMechanismIllustrationPoint = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.SubMechanismIllustrationPoint; +using HydraIllustrationPointResult = Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints.IllustrationPointResult; using WindDirection = Ringtoets.Common.Data.Hydraulics.IllustrationPoints.WindDirection; namespace Ringtoets.Common.Service.Test.IllustrationPoints @@ -63,7 +65,7 @@ { Beta = random.NextDouble(), GoverningWind = hydraGoverningWindDirection, - Stochasts = new List(), + Stochasts = new List(), IllustrationPoints = new Dictionary() }; @@ -89,7 +91,10 @@ new WindDirectionClosingSituation(hydraWindDirection, closingSituation); double beta = random.NextDouble(); - var hydraIllustrationPoint = new HydraSubMechanismIllustrationPoint("Illustration Point", beta); + var hydraIllustrationPoint = new HydraSubMechanismIllustrationPoint("Illustration Point", + Enumerable.Empty(), + Enumerable.Empty(), + beta); var hydraIllustrationTreeNode = new IllustrationPointTreeNode(hydraIllustrationPoint); double governingWindDirectionAngle = random.NextDouble(); @@ -98,7 +103,7 @@ { Beta = random.NextDouble(), GoverningWind = governingHydraWindDirection, - Stochasts = new List(), + Stochasts = new List(), IllustrationPoints = new Dictionary { { @@ -132,7 +137,7 @@ { // Setup var random = new Random(21); - + const string closingSituation = "Closing situation"; double windDirectionAngle = random.NextDouble(); var hydraWindDirection = new HydraWindDirection("SSE", windDirectionAngle); @@ -150,7 +155,7 @@ { Beta = random.NextDouble(), GoverningWind = governingHydraWindDirection, - Stochasts = new List(), + Stochasts = new List(), IllustrationPoints = new Dictionary { { Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs =================================================================== diff -u -r5f1c70d7eea83fca2ef6305a87a8098820ded1d9 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs (.../IllustrationPointConverterTest.cs) (revision 5f1c70d7eea83fca2ef6305a87a8098820ded1d9) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs (.../IllustrationPointConverterTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -66,17 +66,13 @@ }; double beta = random.NextDouble(); - var subMechanismIllustrationPoint = new SubMechanismIllustrationPoint("name", beta) + var subMechanismIllustrationPoint = new SubMechanismIllustrationPoint("name", new[] { - Results = - { - hydraIllustrationPointResult - }, - Stochasts = - { - hydraRealizedStochast - } - }; + hydraRealizedStochast + }, new[] + { + hydraIllustrationPointResult + }, beta); // Call IllustrationPoint illustrationPoint = IllustrationPointConverter.CreateIllustrationPoint(subMechanismIllustrationPoint); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs =================================================================== diff -u -r5f1c70d7eea83fca2ef6305a87a8098820ded1d9 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs (.../WindDirectionClosingSituationIllustrationPointConverterTest.cs) (revision 5f1c70d7eea83fca2ef6305a87a8098820ded1d9) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs (.../WindDirectionClosingSituationIllustrationPointConverterTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -40,11 +40,16 @@ [Test] public void CreateWindDirectionClosingScenarioIllustrationPoint_HydraWindDirectionNull_ThrowsArgumentNullException() { + // Setup + var hydraSubMechanismIllustrationPoint = new HydraSubMechanismIllustrationPoint("name", + Enumerable.Empty(), + Enumerable.Empty(), + 123); + // Call TestDelegate call = () => WindDirectionClosingSituationIllustrationPointConverter.CreateWindDirectionClosingScenarioIllustrationPoint( - null, - new HydraSubMechanismIllustrationPoint("name", 123)); + null, hydraSubMechanismIllustrationPoint); // Assert string paramName = Assert.Throws(call).ParamName; @@ -55,7 +60,7 @@ public void CreateWindDirectionClosingScenarioIllustrationPoint_SubMechanismIllustrationPointNull_ThrowsArgumentNullException() { // Setup - var hydraWindDirection = new HydraRingTestWindDirection(); + var hydraWindDirection = new HydraRingTestWindDirection(); // Call TestDelegate call = () => @@ -94,17 +99,13 @@ }; double beta = random.NextDouble(); - var subMechanismIllustrationPoint = new HydraSubMechanismIllustrationPoint("name", beta) + var subMechanismIllustrationPoint = new HydraSubMechanismIllustrationPoint("name", new[] { - Results = - { - hydraIllustrationPointResult - }, - Stochasts = - { - hydraRealizedStochast - } - }; + hydraRealizedStochast + }, new[] + { + hydraIllustrationPointResult + }, beta); // Call WindDirectionClosingSituationIllustrationPoint combination = Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/SubmechanismIllustrationPoint.cs =================================================================== diff -u -r5f1c70d7eea83fca2ef6305a87a8098820ded1d9 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/SubmechanismIllustrationPoint.cs (.../SubmechanismIllustrationPoint.cs) (revision 5f1c70d7eea83fca2ef6305a87a8098820ded1d9) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/SubmechanismIllustrationPoint.cs (.../SubmechanismIllustrationPoint.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -33,20 +33,36 @@ /// Creates a new instance of . /// /// The name of the illustration point. + /// A collection of + /// that are associated with this illustration point. + /// A collection of + /// that are associated with this + /// illustration point. /// The beta value of the illustration point /// Thrown when /// is null. - public SubMechanismIllustrationPoint(string name, double beta) + public SubMechanismIllustrationPoint(string name, + IEnumerable stochasts, + IEnumerable illustrationPointResults, + double beta) { if (name == null) { throw new ArgumentNullException(nameof(name)); } + if (stochasts == null) + { + throw new ArgumentNullException(nameof(stochasts)); + } + if (illustrationPointResults == null) + { + throw new ArgumentNullException(nameof(illustrationPointResults)); + } Name = name; Beta = beta; - Stochasts = new List(); - Results = new List(); + Stochasts = stochasts; + Results = illustrationPointResults; } @@ -58,7 +74,7 @@ /// /// Gets the stochasts that were realized. /// - public ICollection Stochasts { get; } + public IEnumerable Stochasts { get; } /// /// Gets the beta values that were realized. @@ -68,6 +84,6 @@ /// /// Gets the output variables. /// - public ICollection Results { get; } + public IEnumerable Results { get; } } } \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs =================================================================== diff -u -r02bec66c8cb3d6e26100d11cb842428144f91965 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs (.../IllustrationPointsParser.cs) (revision 02bec66c8cb3d6e26100d11cb842428144f91965) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs (.../IllustrationPointsParser.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -132,12 +132,18 @@ { string submechanismIllustrationPointName = subMechanisms.First().Value; double subMechanismIllustrationPointBeta = subMechanismBetaValues.First().Value; + + var illustrationPointStochasts = new List(); + AddRange(illustrationPointStochasts, subMechanismStochasts.First().Value); + + var illustrationPointResults = new List(); + AddRange(illustrationPointResults, subMechanismResults.First().Value); + var illustrationPoint = new SubMechanismIllustrationPoint(submechanismIllustrationPointName, + illustrationPointStochasts, + illustrationPointResults, subMechanismIllustrationPointBeta); - AddRange(illustrationPoint.Results, subMechanismResults.First().Value); - AddRange(illustrationPoint.Stochasts, subMechanismStochasts.First().Value); - rootIllustrationPoints[CreateFaultTreeKey(windDirectionClosingSituation)] = new IllustrationPointTreeNode(illustrationPoint); } @@ -347,19 +353,25 @@ { var dataKey = new ThreeKeyIndex(windDirectionClosingSituation.Item1, windDirectionClosingSituation.Item3, subMechanismId); - string submechanismIllustrationPointName = subMechanisms[subMechanismId]; - double subMechanismIllustrationPointBeta = subMechanismBetaValues[dataKey]; - var illustrationPoint = new SubMechanismIllustrationPoint(submechanismIllustrationPointName, - subMechanismIllustrationPointBeta); + var illustrationPointStochasts = new List(); + var illustrationPointResults = new List(); if (subMechanismStochasts.ContainsKey(dataKey)) { - AddRange(illustrationPoint.Stochasts, subMechanismStochasts[dataKey]); + AddRange(illustrationPointStochasts, subMechanismStochasts[dataKey]); } if (subMechanismResults.ContainsKey(dataKey)) { - AddRange(illustrationPoint.Results, subMechanismResults[dataKey]); + AddRange(illustrationPointResults, subMechanismResults[dataKey]); } + + string submechanismIllustrationPointName = subMechanisms[subMechanismId]; + double subMechanismIllustrationPointBeta = subMechanismBetaValues[dataKey]; + var illustrationPoint = new SubMechanismIllustrationPoint(submechanismIllustrationPointName, + illustrationPointStochasts, + illustrationPointResults, + subMechanismIllustrationPointBeta); + return new IllustrationPointTreeNode(illustrationPoint); } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs =================================================================== diff -u -r5f1c70d7eea83fca2ef6305a87a8098820ded1d9 -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs (.../SubMechanismIllustrationPointTest.cs) (revision 5f1c70d7eea83fca2ef6305a87a8098820ded1d9) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/SubMechanismIllustrationPointTest.cs (.../SubMechanismIllustrationPointTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) @@ -20,6 +20,8 @@ // All rights reserved. using System; +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints; @@ -32,29 +34,57 @@ public void Constructor_NameNull_ThrowsArgumentNullException() { // Call - TestDelegate call = () => new SubMechanismIllustrationPoint(null, 123); + TestDelegate call = () => new SubMechanismIllustrationPoint(null, + Enumerable.Empty(), + Enumerable.Empty(), + 123); // Assert var exception = Assert.Throws(call); Assert.AreEqual("name", exception.ParamName); } [Test] - public void Constructor_WithParameter_ReturnsNewInstance() + public void Constructor_StochastNull_ThrowsArgumentNullException() { + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Name", null, Enumerable.Empty(), 123); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("stochasts", exception.ParamName); + } + + [Test] + public void Constructor_IllustrationPointResultsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new SubMechanismIllustrationPoint("Name", Enumerable.Empty(), null, 123); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("illustrationPointResults", exception.ParamName); + } + + [Test] + public void Constructor_WithParameters_ReturnsNewInstance() + { // Setup const string name = "Name"; var random = new Random(21); double beta = random.NextDouble(); + IEnumerable stochasts = Enumerable.Empty(); + IEnumerable illustrationPointResults = Enumerable.Empty(); + // Call - var illustrationPoint = new SubMechanismIllustrationPoint(name, beta); + var illustrationPoint = new SubMechanismIllustrationPoint(name, stochasts, illustrationPointResults, beta); // Assert Assert.IsInstanceOf(illustrationPoint); - Assert.IsEmpty(illustrationPoint.Stochasts); - Assert.IsEmpty(illustrationPoint.Results); + Assert.AreSame(stochasts, illustrationPoint.Stochasts); + Assert.AreSame(illustrationPointResults, illustrationPoint.Results); Assert.AreEqual(beta, illustrationPoint.Beta); } }