Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresCalculationCreateExtensionsTest.cs =================================================================== diff -u -r41a37c93cb0b3e36ff7023c9f42b4e6225598b55 -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresCalculationCreateExtensionsTest.cs (.../HeightStructuresCalculationCreateExtensionsTest.cs) (revision 41a37c93cb0b3e36ff7023c9f42b4e6225598b55) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/HeightStructures/HeightStructuresCalculationCreateExtensionsTest.cs (.../HeightStructuresCalculationCreateExtensionsTest.cs) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -25,6 +25,7 @@ using Application.Ringtoets.Storage.DbContext; using Application.Ringtoets.Storage.TestUtil; using Core.Common.Base.Data; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Structures; @@ -65,47 +66,47 @@ Comments = comments, InputParameters = { - StructureNormalOrientation = (RoundedDouble) GetRandomDoubleFromRange(random, 0, 360), + StructureNormalOrientation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 0, 360), ModelFactorSuperCriticalFlow = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, -9999.9999, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, -9999.9999, 9999.9999) }, AllowedLevelIncreaseStorage = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, StorageStructureArea = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - CoefficientOfVariation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + CoefficientOfVariation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, FlowWidthAtBottomProtection = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, CriticalOvertoppingDischarge = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - CoefficientOfVariation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + CoefficientOfVariation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, FailureProbabilityStructureWithErosion = random.NextDouble(), WidthFlowApertures = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), - CoefficientOfVariation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), + CoefficientOfVariation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, StormDuration = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - CoefficientOfVariation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + CoefficientOfVariation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, DeviationWaveDirection = (RoundedDouble) random.NextDouble(), LevelCrestStructure = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, UseBreakWater = true, UseForeshore = false, @@ -338,11 +339,5 @@ // Assert Assert.AreSame(foreshoreProfileEntity, entity.ForeshoreProfileEntity); } - - private static double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) - { - double difference = upperLimit - lowerLimit; - return lowerLimit + random.NextDouble()*difference; - } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs =================================================================== diff -u -rfa2d88ba58e524c1d132a21df4e0adf9fa6570c4 -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision fa2d88ba58e524c1d132a21df4e0adf9fa6570c4) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.DbContext; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data; @@ -73,29 +74,29 @@ EntryPointL = (RoundedDouble) entryPoint, PhreaticLevelExit = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, DampingFactorExit = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, SaturatedVolumicWeightOfCoverageLayer = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 10.0, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - Shift = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 10.0) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 10.0, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + Shift = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 10.0) }, Diameter70 = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) }, DarcyPermeability = { - Mean = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StandardDeviation = (RoundedDouble) GetRandomDoubleFromRange(random, 1e-6, 9999.9999) + Mean = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StandardDeviation = (RoundedDouble) RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999) } } }; @@ -262,7 +263,7 @@ PipingCalculationEntity entity = calculation.Create(registry, 0); // Assert - Assert.AreEqual(1, entity.PipingCalculationOutputEntities.Count()); + Assert.AreEqual(1, entity.PipingCalculationOutputEntities.Count); } [Test] @@ -287,11 +288,5 @@ // Assert Assert.AreEqual(1, entity.PipingSemiProbabilisticOutputEntities.Count); } - - private double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) - { - double difference = upperLimit - lowerLimit; - return lowerLimit + random.NextDouble()*difference; - } } } \ No newline at end of file Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresCalculationEntityReadExtensionsTest.cs =================================================================== diff -u -ra843a58b071689fc00a9859b93c28c80ca5931f3 -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresCalculationEntityReadExtensionsTest.cs (.../HeightStructuresCalculationEntityReadExtensionsTest.cs) (revision a843a58b071689fc00a9859b93c28c80ca5931f3) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/HeightStructures/HeightStructuresCalculationEntityReadExtensionsTest.cs (.../HeightStructuresCalculationEntityReadExtensionsTest.cs) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -26,6 +26,7 @@ using Application.Ringtoets.Storage.Serializers; using Core.Common.Base.Data; using Core.Common.Base.Geometry; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.Structures; @@ -64,21 +65,21 @@ Comments = comments, UseForeshore = Convert.ToByte(false), UseBreakWater = Convert.ToByte(false), - StructureNormalOrientation = GetRandomDoubleFromRange(random, 0, 360), - ModelFactorSuperCriticalFlowMean = GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), - AllowedLevelIncreaseStorageMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - AllowedLevelIncreaseStorageStandardDeviation = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - FlowWidthAtBottomProtectionMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - FlowWidthAtBottomProtectionStandardDeviation = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - CriticalOvertoppingDischargeMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - CriticalOvertoppingDischargeCoefficientOfVariation = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StructureNormalOrientation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 0, 360), + ModelFactorSuperCriticalFlowMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, -9999.9999, 9999.9999), + AllowedLevelIncreaseStorageMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + AllowedLevelIncreaseStorageStandardDeviation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + FlowWidthAtBottomProtectionMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + FlowWidthAtBottomProtectionStandardDeviation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + CriticalOvertoppingDischargeMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + CriticalOvertoppingDischargeCoefficientOfVariation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), FailureProbabilityStructureWithErosion = random.NextDouble(), - WidthFlowAperturesMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - WidthFlowAperturesCoefficientOfVariation = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - StormDurationMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - LevelCrestStructureMean = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - LevelCrestStructureStandardDeviation = GetRandomDoubleFromRange(random, 1e-6, 9999.9999), - DeviationWaveDirection = GetRandomDoubleFromRange(random, -360, 360) + WidthFlowAperturesMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + WidthFlowAperturesCoefficientOfVariation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + StormDurationMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + LevelCrestStructureMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + LevelCrestStructureStandardDeviation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 9999.9999), + DeviationWaveDirection = RandomNumberGenerator.GetRandomDoubleFromRange(random, -360, 360) }; var collector = new ReadConversionCollector(); @@ -109,7 +110,7 @@ AssertRoundedDouble(entity.LevelCrestStructureMean, input.LevelCrestStructure.Mean); AssertRoundedDouble(entity.LevelCrestStructureStandardDeviation, input.LevelCrestStructure.StandardDeviation); AssertRoundedDouble(entity.DeviationWaveDirection, input.DeviationWaveDirection); - + Assert.IsEmpty(input.ForeshoreGeometry); Assert.IsNull(input.ForeshoreProfile); Assert.IsNull(input.HydraulicBoundaryLocation); @@ -166,11 +167,5 @@ { Assert.AreEqual((RoundedDouble) entityValue.ToNullAsNaN(), roundedDouble, roundedDouble.GetAccuracy()); } - - private static double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) - { - double difference = upperLimit - lowerLimit; - return lowerLimit + random.NextDouble()*difference; - } } } \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj =================================================================== diff -u -r7d6e4c28a40fb056c182d0691dda2b2e88aeebfd -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 7d6e4c28a40fb056c182d0691dda2b2e88aeebfd) +++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -67,6 +67,7 @@ True Resources.resx + Index: Core/Common/test/Core.Common.TestUtil.Test/RandomNumberGeneratorTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.TestUtil.Test/RandomNumberGeneratorTest.cs (revision 0) +++ Core/Common/test/Core.Common.TestUtil.Test/RandomNumberGeneratorTest.cs (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -0,0 +1,97 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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 NUnit.Framework; + +namespace Core.Common.TestUtil.Test +{ + [TestFixture] + public class RandomNumberGeneratorTest + { + [Test] + public void GetRandomDoubleFromRange_RandomIsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => RandomNumberGenerator.GetRandomDoubleFromRange(null, 0, 0); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("random", paramName); + } + + [Test] + public void GetRandomDoubleFromRange_LowerLimitLargerThanUpperLimit_ThrowsArgumentException() + { + // Setup + var random = new Random(); + + // Call + TestDelegate test = () => RandomNumberGenerator.GetRandomDoubleFromRange(random, 1, 0); + + // Assert + string message = Assert.Throws(test).Message; + Assert.AreEqual("lowerLimit is larger than upperLimit", message); + } + + [Test] + [TestCase(double.MinValue, double.MaxValue)] + [TestCase(double.NegativeInfinity, 0)] + [TestCase(0, double.PositiveInfinity)] + [TestCase(double.NaN, 0)] + [TestCase(0, double.NaN)] + public void GetRandomDoubleFromRange_LimitsTooLarge_ThrowsNotFiniteNumberException(double lowerLimit, double upperLimit) + { + // Setup + var random = new Random(); + + // Call + TestDelegate test = () => RandomNumberGenerator.GetRandomDoubleFromRange(random, lowerLimit, upperLimit); + + // Assert + string message = Assert.Throws(test).Message; + string expectedMessage = string.Format("Creating a new random value with lower limit {0} " + + "and upper limit {1} did not result in a finite value.", + lowerLimit, upperLimit); + Assert.AreEqual(expectedMessage, message); + } + + [Test] + [TestCase(double.MinValue, 0)] + [TestCase(0, double.MaxValue)] + [TestCase(-10, 0)] + [TestCase(0, 0)] + [TestCase(0, 10)] + [TestCase(0, 10)] + public void GetRandomDoubleFromRange_VariousLimits_RandomNumberBetweenLimits(double lowerLimit, double upperLimit) + { + // Setup + var random = new Random(); + + // Call + var randomValue = RandomNumberGenerator.GetRandomDoubleFromRange(random, lowerLimit, upperLimit); + + // Assert + Assert.LessOrEqual(randomValue, upperLimit); + Assert.GreaterOrEqual(randomValue, lowerLimit); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj =================================================================== diff -u -r7d6e4c28a40fb056c182d0691dda2b2e88aeebfd -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj (.../Core.Common.TestUtil.csproj) (revision 7d6e4c28a40fb056c182d0691dda2b2e88aeebfd) +++ Core/Common/test/Core.Common.TestUtil/Core.Common.TestUtil.csproj (.../Core.Common.TestUtil.csproj) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -101,6 +101,7 @@ True True + Index: Core/Common/test/Core.Common.TestUtil/RandomNumberGenerator.cs =================================================================== diff -u --- Core/Common/test/Core.Common.TestUtil/RandomNumberGenerator.cs (revision 0) +++ Core/Common/test/Core.Common.TestUtil/RandomNumberGenerator.cs (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -0,0 +1,65 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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; + +namespace Core.Common.TestUtil +{ + /// + /// Helper class for generating random numbers. + /// + public static class RandomNumberGenerator + { + /// + /// Generates a new pseudo-random number between and . + /// + /// A pseudo-random number generator. + /// The lower limit of the new random number. + /// The upper limit of the new random number. + /// A new random number. + /// Thrown when is null. + /// Thrown when is larger than . + /// Thrown when the generated value is not finite. + public static double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) + { + if (random == null) + { + throw new ArgumentNullException("random"); + } + + if (lowerLimit > upperLimit) + { + throw new ArgumentException("lowerLimit is larger than upperLimit"); + } + + double difference = upperLimit - lowerLimit; + double randomValue = lowerLimit + random.NextDouble()*difference; + if (double.IsInfinity(randomValue) || double.IsNaN(randomValue)) + { + string message = string.Format("Creating a new random value with lower limit {0} " + + "and upper limit {1} did not result in a finite value.", + lowerLimit, upperLimit); + throw new NotFiniteNumberException(message, randomValue); + } + return randomValue; + } + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs =================================================================== diff -u -r41a37c93cb0b3e36ff7023c9f42b4e6225598b55 -r03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5 --- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 41a37c93cb0b3e36ff7023c9f42b4e6225598b55) +++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 03a0bbc245b8da50ca603f18d5b9b8fb2d7593c5) @@ -426,9 +426,9 @@ new PipingSoilLayer(10.5) { IsAquifer = false, - BelowPhreaticLevelDeviation = GetRandomDoubleFromRange(random, 1e-6, 999.999), - BelowPhreaticLevelMean = GetRandomDoubleFromRange(random, 10.0, 999.999), - BelowPhreaticLevelShift = GetRandomDoubleFromRange(random, 1e-6, 10.0) + BelowPhreaticLevelDeviation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 999.999), + BelowPhreaticLevelMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 10.0, 999.999), + BelowPhreaticLevelShift = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 10.0) }, incompletePipingSoilLayer }, @@ -486,9 +486,9 @@ new PipingSoilLayer(10.5) { IsAquifer = false, - BelowPhreaticLevelDeviation = GetRandomDoubleFromRange(random, 1e-6, 999.999), - BelowPhreaticLevelMean = GetRandomDoubleFromRange(random, 10.0, 999.999), - BelowPhreaticLevelShift = GetRandomDoubleFromRange(random, 1e-6, 10.0) + BelowPhreaticLevelDeviation = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 999.999), + BelowPhreaticLevelMean = RandomNumberGenerator.GetRandomDoubleFromRange(random, 10.0, 999.999), + BelowPhreaticLevelShift = RandomNumberGenerator.GetRandomDoubleFromRange(random, 1e-6, 10.0) }, incompletePipingSoilLayer }, @@ -806,11 +806,5 @@ Assert.AreEqual(input.SandParticlesVolumicWeight, sellmeijerCalculator.GammaSubParticles); Assert.AreEqual(input.Gravity, sellmeijerCalculator.Gravity); } - - private double GetRandomDoubleFromRange(Random random, double lowerLimit, double upperLimit) - { - double difference = upperLimit - lowerLimit; - return lowerLimit + random.NextDouble()*difference; - } } } \ No newline at end of file