Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs =================================================================== diff -u -raf50d3e2a0d74d0220363e7120c6fbf1923870f4 -r875712a38626d27da8b94038d38aec9783e8d95e --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision af50d3e2a0d74d0220363e7120c6fbf1923870f4) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/DikeProfileTest.cs (.../DikeProfileTest.cs) (revision 875712a38626d27da8b94038d38aec9783e8d95e) @@ -22,8 +22,6 @@ using System; using Core.Common.Base.Data; using Core.Common.Base.Geometry; -using Core.Common.TestUtil; - using NUnit.Framework; namespace Ringtoets.GrassCoverErosionInwards.Data.Test @@ -70,53 +68,32 @@ } [Test] - [TestCase(123.456789)] - [TestCase(-1e-3, Description = "Valid orientation due to rounding to 0.0")] - [TestCase(360 + 1e-3, Description = "Valid orientation due to rounding to 360.0")] - public void Orientation_SetValue_GetValueRoundedToGivenNumberOfDecimalPlaces(double orientation) + public void X0_SetNewValue_GetsNewValue([Random(-9999.99, 9999.99, 1)] double newValue) { // Setup var dikeProfile = new DikeProfile(new Point2D(0, 0)); - var orignalNumberOfDecimals = dikeProfile.Orientation.NumberOfDecimalPlaces; // Call - dikeProfile.Orientation = (RoundedDouble) orientation; + dikeProfile.X0 = newValue; // Assert - Assert.AreEqual(orignalNumberOfDecimals, dikeProfile.Orientation.NumberOfDecimalPlaces); - Assert.AreEqual(new RoundedDouble(orignalNumberOfDecimals, orientation), dikeProfile.Orientation); + Assert.AreEqual(newValue, dikeProfile.X0); } [Test] - [TestCase(-987.65)] - [TestCase(-1e-2)] - [TestCase(360 + 1e-2)] - [TestCase(875.12)] - public void Orientation_SetIllegalValue_ThrowsArgumentOutOfRangeException(double invalidNewValue) + public void Orientation_SetToValueWithTooManyDecimalPlaces_ValueIsRounded() { // Setup var dikeProfile = new DikeProfile(new Point2D(0, 0)); - // Call - TestDelegate call = () => dikeProfile.Orientation = (RoundedDouble) invalidNewValue; + int originalNumberOfDecimalPlaces = dikeProfile.Orientation.NumberOfDecimalPlaces; - // Assert - string expectedMessage = String.Format("De dijkprofiel oriƫntatie waarde {0} moet in het interval [0, 360] liggen.", - new RoundedDouble(dikeProfile.Orientation.NumberOfDecimalPlaces, invalidNewValue)); - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); - } - - [Test] - public void X0_SetNewValue_GetsNewValue([Random(-9999.99, 9999.99, 1)] double newValue) - { - // Setup - var dikeProfile = new DikeProfile(new Point2D(0, 0)); - // Call - dikeProfile.X0 = newValue; + dikeProfile.Orientation = new RoundedDouble(5, 1.23456); // Assert - Assert.AreEqual(newValue, dikeProfile.X0); + Assert.AreEqual(originalNumberOfDecimalPlaces, dikeProfile.Orientation.NumberOfDecimalPlaces); + Assert.AreEqual(1.23, dikeProfile.Orientation.Value); } [Test]