Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IDistribution.cs
===================================================================
diff -u -r1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IDistribution.cs (.../IDistribution.cs) (revision 1e4d77c17c6eac78bfd705efdff9e52b4fca2c7e)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IDistribution.cs (.../IDistribution.cs) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -27,6 +27,7 @@
///
/// This object represents a probabilistic distribution.
///
+ ///
public interface IDistribution
{
///
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IVariationCoefficientDistribution.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IVariationCoefficientDistribution.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/IVariationCoefficientDistribution.cs (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -0,0 +1,47 @@
+// Copyright (C) Stichting Deltares 2016. 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;
+
+namespace Ringtoets.Common.Data.Probabilistics
+{
+ ///
+ /// This object represents a probabilistic distribution.
+ ///
+ ///
+ public interface IVariationCoefficientDistribution
+ {
+ ///
+ /// Gets or sets the mean (expected value, E(X)) of the distribution.
+ ///
+ /// As cannot be negative, the absolute
+ /// value of the mean is used when the standard deviation needs to be calculated.
+ RoundedDouble Mean { get; set; }
+
+ ///
+ /// Gets or sets the coefficient of variation (CV, also known as relative standard
+ /// deviation (SRD). Defined as standard deviation / |E(X)|) of the distribution.
+ ///
+ /// Coefficient of variation is less than 0.
+ RoundedDouble CoefficientOfVariation { get; set; }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs
===================================================================
diff -u -r76c9a075334836aec744c911c62442e8e4ebcd0f -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs (.../LogNormalDistribution.cs) (revision 76c9a075334836aec744c911c62442e8e4ebcd0f)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/LogNormalDistribution.cs (.../LogNormalDistribution.cs) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -28,6 +28,7 @@
///
/// Class representing a log-normal distribution.
///
+ ///
public class LogNormalDistribution : IDistribution
{
private RoundedDouble mean;
@@ -79,9 +80,11 @@
}
///
- /// Gets or sets the mean of the normal distribution which is the log of the log-normal distribution.
+ /// Gets or sets the mean of the normal distribution which is the log of the
+ /// log-normal distribution.
///
- /// Expected value is less than or equal to 0.
+ /// Expected value is less than or
+ /// equal to 0 or less then .
public RoundedDouble Mean
{
get
@@ -106,12 +109,11 @@
}
///
- /// Gets or sets the standard deviation of the normal distribution which is the log of the log-normal distribution.
+ /// Gets or sets the standard deviation of the normal distribution which is the
+ /// log of the log-normal distribution.
///
- /// Thrown when either:
- /// - Standard deviation is less than 0.
- /// - The mean is smaller than the shift.
- ///
+ /// Thrown when standard deviation
+ /// is less than 0.
public RoundedDouble StandardDeviation
{
get
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs
===================================================================
diff -u -r7f759fbabca9c41e75d229269f1b21581b373b5f -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision 7f759fbabca9c41e75d229269f1b21581b373b5f)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -28,6 +28,7 @@
///
/// Class representing a normal (or Gaussian) distribution.
///
+ ///
public class NormalDistribution : IDistribution
{
private RoundedDouble standardDeviation;
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientLogNormalDistribution.cs (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -0,0 +1,98 @@
+// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.Common.Data.Properties;
+
+namespace Ringtoets.Common.Data.Probabilistics
+{
+ ///
+ /// Class representing a log-normal distribution expressed in terms of a coefficient
+ /// of variation instead of standard deviation.
+ ///
+ ///
+ public class VariationCoefficientLogNormalDistribution : IVariationCoefficientDistribution
+ {
+ private RoundedDouble mean;
+ private RoundedDouble coefficientOfVariation;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The number of decimal places.
+ ///
+ /// Thrown when is not in range [1, ].
+ ///
+ public VariationCoefficientLogNormalDistribution(int numberOfDecimalPlaces)
+ {
+ mean = new RoundedDouble(numberOfDecimalPlaces, 1.0);
+ coefficientOfVariation = new RoundedDouble(numberOfDecimalPlaces, 1.0);
+ }
+
+ ///
+ /// Gets or sets the mean of the normal distribution which is the log of the log-normal distribution.
+ ///
+ /// Expected value is less than or equal to 0.
+ public RoundedDouble Mean
+ {
+ get
+ {
+ return mean;
+ }
+ set
+ {
+ RoundedDouble roundedValue = value.ToPrecision(mean.NumberOfDecimalPlaces);
+
+ if (roundedValue <= 0)
+ {
+ throw new ArgumentOutOfRangeException("value", Resources.LogNormalDistribution_Mean_must_be_greater_than_zero);
+ }
+
+ mean = roundedValue;
+ }
+ }
+
+ ///
+ /// Gets or sets the coefficient of variation of the normal distribution which is
+ /// the log of the log-normal distribution.
+ ///
+ /// Thrown when set to a value less then 0.
+ public RoundedDouble CoefficientOfVariation
+ {
+ get
+ {
+ return coefficientOfVariation;
+ }
+ set
+ {
+ RoundedDouble roundedValue = value.ToPrecision(coefficientOfVariation.NumberOfDecimalPlaces);
+
+ if (roundedValue < 0)
+ {
+ throw new ArgumentOutOfRangeException("value", Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero);
+ }
+
+ coefficientOfVariation = roundedValue;
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Probabilistics/VariationCoefficientNormalDistribution.cs (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -0,0 +1,82 @@
+// Copyright (C) Stichting Deltares 2016. 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 Ringtoets.Common.Data.Properties;
+
+namespace Ringtoets.Common.Data.Probabilistics
+{
+ ///
+ /// Class representing a normal (or Gaussian) distribution expressed in terms of a
+ /// coefficient of variation instead of standard deviation.
+ ///
+ ///
+ public class VariationCoefficientNormalDistribution : IVariationCoefficientDistribution
+ {
+ private RoundedDouble coefficientOfVariation;
+ private RoundedDouble mean;
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The number of decimal places of the distribution.
+ ///
+ /// Thrown when is not in range [0, ].
+ ///
+ public VariationCoefficientNormalDistribution(int numberOfDecimalPlaces)
+ {
+ mean = new RoundedDouble(numberOfDecimalPlaces, 1.0);
+ coefficientOfVariation = new RoundedDouble(numberOfDecimalPlaces, 1.0);
+ }
+
+ public RoundedDouble Mean
+ {
+ get
+ {
+ return mean;
+ }
+ set
+ {
+ mean = value.ToPrecision(mean.NumberOfDecimalPlaces);
+ }
+ }
+
+ public RoundedDouble CoefficientOfVariation
+ {
+ get
+ {
+ return coefficientOfVariation;
+ }
+ set
+ {
+ RoundedDouble roundedValue = value.ToPrecision(coefficientOfVariation.NumberOfDecimalPlaces);
+
+ if (roundedValue < 0)
+ {
+ throw new ArgumentOutOfRangeException("value", Resources.CoefficientOfVariation_Should_be_greater_or_equal_to_zero);
+ }
+
+ coefficientOfVariation = value.ToPrecision(coefficientOfVariation.NumberOfDecimalPlaces);
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -ra8ffe20fbe684f5020f5158354b33fad488baac9 -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision a8ffe20fbe684f5020f5158354b33fad488baac9)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -1,28 +1,7 @@
-// Copyright (C) Stichting Deltares 2016. 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.
-
-//------------------------------------------------------------------------------
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.18444
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -182,6 +161,15 @@
}
///
+ /// Looks up a localized string similar to Variatiecoëfficiënt (CV) moet groter of gelijk zijn aan 0..
+ ///
+ public static string CoefficientOfVariation_Should_be_greater_or_equal_to_zero {
+ get {
+ return ResourceManager.GetString("CoefficientOfVariation_Should_be_greater_or_equal_to_zero", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to De waarde voor de toegestane bijdrage aan de faalkans moet in interval [0, 100] liggen..
///
public static string Contribution_Value_should_be_in_interval_0_100 {
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx
===================================================================
diff -u -ra8ffe20fbe684f5020f5158354b33fad488baac9 -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision a8ffe20fbe684f5020f5158354b33fad488baac9)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -222,4 +222,7 @@
Nieuwe berekening
+
+ Variatiecoëfficiënt (CV) moet groter of gelijk zijn aan 0.
+
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj
===================================================================
diff -u -re2197d5a4596fc769d89bd2f661d657490017d76 -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision e2197d5a4596fc769d89bd2f661d657490017d76)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Ringtoets.Common.Data.csproj (.../Ringtoets.Common.Data.csproj) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -48,6 +48,9 @@
+
+
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientLogNormalDistributionTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientLogNormalDistributionTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientLogNormalDistributionTest.cs (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -0,0 +1,126 @@
+// Copyright (C) Stichting Deltares 2016. 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.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+
+namespace Ringtoets.Common.Data.Test.Probabilistics
+{
+ [TestFixture]
+ public class VariationCoefficientLogNormalDistributionTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ const int numberOfDecimals = 3;
+
+ // Call
+ var distribution = new VariationCoefficientLogNormalDistribution(numberOfDecimals);
+
+ // Assert
+ Assert.IsInstanceOf(distribution);
+ Assert.AreEqual(numberOfDecimals, distribution.Mean.NumberOfDecimalPlaces);
+ Assert.AreEqual(1.0, distribution.Mean.Value);
+ Assert.AreEqual(numberOfDecimals, distribution.CoefficientOfVariation.NumberOfDecimalPlaces);
+ Assert.AreEqual(1.0, distribution.CoefficientOfVariation.Value);
+ }
+
+ [Test]
+ [TestCase(-1)]
+ [TestCase(16)]
+ public void Constructor_InvalidNumberOfDecimalPlaces_ThrowArgumentOutOfRangeException(int numberOfDecimals)
+ {
+ // Call
+ TestDelegate call = () => new VariationCoefficientLogNormalDistribution(numberOfDecimals);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Value must be in range [0, 15].");
+ }
+
+ [Test]
+ [TestCase(0.005, 0.01)]
+ [TestCase(34.56789, 34.57)]
+ public void Mean_SetNewValue_ReturnNewlySetValue(double actualSetValue, double expectedRoundedValue)
+ {
+ // Setup
+ var distribution = new VariationCoefficientLogNormalDistribution(2);
+
+ // Call
+ distribution.Mean = (RoundedDouble)actualSetValue;
+
+ // Assert
+ Assert.AreEqual(expectedRoundedValue, distribution.Mean.Value);
+ }
+
+ [Test]
+ [TestCase(0.004)]
+ [TestCase(-1.2)]
+ public void Mean_NegativeOrZeroValue_ThrowArgumentOutOfRangeException(double invalidCoefficient)
+ {
+ // Setup
+ var distribution = new VariationCoefficientLogNormalDistribution(2);
+
+ // Call
+ TestDelegate call = () => distribution.Mean = (RoundedDouble)invalidCoefficient;
+
+ // Assert
+ string expectedMessage = "Gemiddelde moet groter zijn dan 0.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ [TestCase(-0.004, 0.0)]
+ [TestCase(0.0, 0.0)]
+ [TestCase(34.56789, 34.57)]
+ public void CoefficientOfVariation_SetNewValue_ReturnNewlySetValue(
+ double actualSetValue, double expectedRoundedValue)
+ {
+ // Setup
+ var distribution = new VariationCoefficientLogNormalDistribution(2);
+
+ // Call
+ distribution.CoefficientOfVariation = (RoundedDouble)actualSetValue;
+
+ // Assert
+ Assert.AreEqual(expectedRoundedValue, distribution.CoefficientOfVariation.Value);
+ }
+
+ [Test]
+ [TestCase(-0.005)]
+ [TestCase(-1.2)]
+ public void CoefficientOfVariation_NegativeValue_ThrowArgumentOutOfRangeException(double invalidCoefficient)
+ {
+ // Setup
+ var distribution = new VariationCoefficientLogNormalDistribution(2);
+
+ // Call
+ TestDelegate call = () => distribution.CoefficientOfVariation = (RoundedDouble)invalidCoefficient;
+
+ // Assert
+ string expectedMessage = "Variatiecoëfficiënt (CV) moet groter of gelijk zijn aan 0.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientNormalDistributionTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientNormalDistributionTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probabilistics/VariationCoefficientNormalDistributionTest.cs (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -0,0 +1,110 @@
+// Copyright (C) Stichting Deltares 2016. 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.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+
+namespace Ringtoets.Common.Data.Test.Probabilistics
+{
+ [TestFixture]
+ public class VariationCoefficientNormalDistributionTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Setup
+ const int numberOfDecimalPlaces = 4;
+
+ // Call
+ var distribution = new VariationCoefficientNormalDistribution(numberOfDecimalPlaces);
+
+ // Assert
+ Assert.IsInstanceOf(distribution);
+ Assert.AreEqual(numberOfDecimalPlaces, distribution.Mean.NumberOfDecimalPlaces);
+ Assert.AreEqual(1.0, distribution.Mean.Value);
+ Assert.AreEqual(numberOfDecimalPlaces, distribution.CoefficientOfVariation.NumberOfDecimalPlaces);
+ Assert.AreEqual(1.0, distribution.CoefficientOfVariation.Value);
+ }
+
+ [Test]
+ [TestCase(-1)]
+ [TestCase(16)]
+ public void Constructor_InvalidNumberOfDecimalPlaces_ThrowsArgumentOutOfRangeException(int numberOfDecimalPlaces)
+ {
+ // Setup
+
+ // Call
+ TestDelegate call = () => new VariationCoefficientNormalDistribution(numberOfDecimalPlaces);
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Value must be in range [0, 15].");
+ }
+
+ [Test]
+ public void Mean_SetNewValue_ReturnNewlySetValue()
+ {
+ // Setup
+ var distribution = new VariationCoefficientNormalDistribution(2);
+
+ // Call
+ distribution.Mean = (RoundedDouble) 12.34567;
+
+ // Assert
+ Assert.AreEqual(12.35, distribution.Mean.Value);
+ }
+
+ [Test]
+ [TestCase(-0.004, 0.0)]
+ [TestCase(0.0, 0.0)]
+ [TestCase(34.56789, 34.57)]
+ public void CoefficientOfVariation_SetNewValue_ReturnNewlySetValue(
+ double actualSetValue, double expectedRoundedValue)
+ {
+ // Setup
+ var distribution = new VariationCoefficientNormalDistribution(2);
+
+ // Call
+ distribution.CoefficientOfVariation = (RoundedDouble)actualSetValue;
+
+ // Assert
+ Assert.AreEqual(expectedRoundedValue, distribution.CoefficientOfVariation.Value);
+ }
+
+ [Test]
+ [TestCase(-0.005)]
+ [TestCase(-1.2)]
+ public void CoefficientOfVariation_NegativeValue_ThrowArgumentOutOfRangeException(double invalidCoefficient)
+ {
+ // Setup
+ var distribution = new VariationCoefficientNormalDistribution(2);
+
+ // Call
+ TestDelegate call = () => distribution.CoefficientOfVariation = (RoundedDouble)invalidCoefficient;
+
+ // Assert
+ string expectedMessage = "Variatiecoëfficiënt (CV) moet groter of gelijk zijn aan 0.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj
===================================================================
diff -u -re2197d5a4596fc769d89bd2f661d657490017d76 -r238800aea14ad46b711dc0520d9416a05f6693ae
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision e2197d5a4596fc769d89bd2f661d657490017d76)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Ringtoets.Common.Data.Test.csproj (.../Ringtoets.Common.Data.Test.csproj) (revision 238800aea14ad46b711dc0520d9416a05f6693ae)
@@ -60,6 +60,8 @@
+
+