Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs =================================================================== diff -u -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs (.../IllustrationPointConverterTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointConverterTest.cs (.../IllustrationPointConverterTest.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -52,11 +52,8 @@ { // Setup var random = new Random(21); - var hydraIllustrationPointResult = new HydraIllustrationPointResult - { - Description = "HydraIllustrationPointResult", - Value = random.NextDouble() - }; + var hydraIllustrationPointResult = new HydraIllustrationPointResult("HydraIllustrationPointResult", + random.NextDouble()); var hydraRealizedStochast = new HydraRealizedStochast { Alpha = random.NextDouble(), Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointResultConverterTest.cs =================================================================== diff -u -r0fd23ff8e68b5f0d18d344d104bc68216cb49b51 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointResultConverterTest.cs (.../IllustrationPointResultConverterTest.cs) (revision 0fd23ff8e68b5f0d18d344d104bc68216cb49b51) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/IllustrationPointResultConverterTest.cs (.../IllustrationPointResultConverterTest.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -47,11 +47,8 @@ { // Setup var random = new Random(21); - var hydraIllustrationPointResult = new HydraIllustrationPointResult - { - Description = "Description", - Value = random.NextDouble() - }; + var hydraIllustrationPointResult = new HydraIllustrationPointResult("Description", + random.NextDouble()); // Call IllustrationPointResult illustrationPointResult = IllustrationPointResultConverter.CreateIllustrationPointResult(hydraIllustrationPointResult); Index: Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs =================================================================== diff -u -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs (.../WindDirectionClosingSituationIllustrationPointConverterTest.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) +++ Ringtoets/Common/test/Ringtoets.Common.Service.Test/IllustrationPoints/WindDirectionClosingSituationIllustrationPointConverterTest.cs (.../WindDirectionClosingSituationIllustrationPointConverterTest.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -85,11 +85,8 @@ var windDirectionClosingSituation = new HydraWindDirectionClosingSituation(hydraWindDirection, closingScenario); - var hydraIllustrationPointResult = new HydraIllustrationPointResult - { - Description = "HydraIllustrationPointResult", - Value = random.NextDouble() - }; + var hydraIllustrationPointResult = new HydraIllustrationPointResult("HydraIllustrationPointResult", + random.NextDouble()); var hydraRealizedStochast = new HydraRealizedStochast { Alpha = random.NextDouble(), @@ -109,7 +106,8 @@ // Call WindDirectionClosingSituationIllustrationPoint combination = - WindDirectionClosingSituationIllustrationPointConverter.CreateWindDirectionClosingScenarioIllustrationPoint(windDirectionClosingSituation, subMechanismIllustrationPoint); + WindDirectionClosingSituationIllustrationPointConverter.CreateWindDirectionClosingScenarioIllustrationPoint( + windDirectionClosingSituation, subMechanismIllustrationPoint); // Assert WindDirection windDirection = combination.WindDirection; Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/IllustrationPointResult.cs =================================================================== diff -u -r0fd23ff8e68b5f0d18d344d104bc68216cb49b51 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/IllustrationPointResult.cs (.../IllustrationPointResult.cs) (revision 0fd23ff8e68b5f0d18d344d104bc68216cb49b51) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Output/IllustrationPoints/IllustrationPointResult.cs (.../IllustrationPointResult.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; + namespace Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints { /// @@ -27,13 +29,31 @@ public class IllustrationPointResult { /// - /// Gets or sets the description. + /// Creates a new instance of . /// - public string Description { get; set; } + /// The description. + /// The output of the sub mechanism illustration point. + /// Thrown when + /// is null. + public IllustrationPointResult(string description, double value) + { + if (description == null) + { + throw new ArgumentNullException(nameof(description)); + } + Description = description; + Value = value; + } + /// - /// Gets or sets the value. + /// Gets the description. /// - public double Value { get; set; } = double.NaN; + public string Description { get; } + + /// + /// Gets the value. + /// + public double Value { get; } } } \ No newline at end of file Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs =================================================================== diff -u -ra6da010d4a68dbf5b4571ea39850ee92f62d2496 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs (.../IllustrationPointsParser.cs) (revision a6da010d4a68dbf5b4571ea39850ee92f62d2496) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Parsers/IllustrationPoints/IllustrationPointsParser.cs (.../IllustrationPointsParser.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -262,11 +262,7 @@ subMechanismResults[key] = new List(); } - subMechanismResults[key].Add(new IllustrationPointResult - { - Description = description, - Value = value - }); + subMechanismResults[key].Add(new IllustrationPointResult(description, value)); } } Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs =================================================================== diff -u -r0fd23ff8e68b5f0d18d344d104bc68216cb49b51 -r2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78 --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs (.../IllustrationPointResultTest.cs) (revision 0fd23ff8e68b5f0d18d344d104bc68216cb49b51) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Data/Output/IllustrationPoints/IllustrationPointResultTest.cs (.../IllustrationPointResultTest.cs) (revision 2bda1fe026b3f2c9bf6f4d0254e3292bbd887f78) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using NUnit.Framework; using Ringtoets.HydraRing.Calculation.Data.Output.IllustrationPoints; @@ -28,14 +29,29 @@ public class IllustrationPointResultTest { [Test] + public void Constructor_DescriptionNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new IllustrationPointResult(null, 0); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("description", paramName); + } + + [Test] public void Constructor_Always_ReturnsNewInstance() { + // Setup + const string description = "some description"; + const double value = 123; + // Call - var result = new IllustrationPointResult(); + var result = new IllustrationPointResult(description, value); // Assert - Assert.IsNull(result.Description); - Assert.IsNaN(result.Value); + Assert.AreEqual(description, result.Description); + Assert.AreEqual(value, result.Value); } } } \ No newline at end of file