Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs
===================================================================
diff -u -r5b8f476716cb75977616203318fa250f608fe7a5 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision 5b8f476716cb75977616203318fa250f608fe7a5)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -87,17 +87,10 @@
{
LogNormalDistribution seepageLength = new LogNormalDistribution(2);
double seepageLengthMean = input.ExitPointL - input.EntryPointL;
- if (seepageLengthMean > 0)
- {
- seepageLength.Mean = (RoundedDouble) seepageLengthMean;
- seepageLength.StandardDeviation = (RoundedDouble) seepageLengthMean*seepageLengthStandardDeviationFraction;
- }
- else
- {
- seepageLength.Mean = (RoundedDouble) double.NaN;
- seepageLength.StandardDeviation = (RoundedDouble) double.NaN;
- }
+ seepageLength.Mean = (RoundedDouble) seepageLengthMean;
+ seepageLength.StandardDeviation = (RoundedDouble) seepageLengthMean*seepageLengthStandardDeviationFraction;
+
return seepageLength;
}
}
@@ -176,10 +169,6 @@
var zAtL = surfaceLine.GetZAtL(exitPointL);
return soilProfile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(zAtL);
}
- catch (ArgumentOutOfRangeException)
- {
- return double.NaN;
- }
catch (ArgumentException)
{
return double.NaN;
@@ -190,7 +179,12 @@
{
try
{
- thicknessCoverageLayer.Mean = (RoundedDouble) InputParameterCalculationService.CalculateThicknessCoverageLayer(input.WaterVolumetricWeight, PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), input.ExitPointL, input.SurfaceLine, input.StochasticSoilProfile.SoilProfile);
+ thicknessCoverageLayer.Mean = (RoundedDouble) InputParameterCalculationService.CalculateThicknessCoverageLayer(
+ input.WaterVolumetricWeight,
+ PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(),
+ input.ExitPointL,
+ input.SurfaceLine,
+ input.StochasticSoilProfile.SoilProfile);
}
catch (ArgumentOutOfRangeException)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs
===================================================================
diff -u -r04d96e936610eab56e9ddc09c055526efe9b9652 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 04d96e936610eab56e9ddc09c055526efe9b9652)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -89,7 +89,6 @@
/// length of .
/// [m]
///
- /// is less than 0.
public RoundedDouble EntryPointL
{
get
@@ -98,13 +97,14 @@
}
set
{
- RoundedDouble roundedValue = value.ToPrecision(entryPointL.NumberOfDecimalPlaces);
+ var newEntryPoint = value.ToPrecision(entryPointL.NumberOfDecimalPlaces);
- if (roundedValue < 0.0)
+ if (!double.IsNaN(exitPointL))
{
- throw new ArgumentOutOfRangeException("value", Resources.PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero);
+ ValidateEntryExitPoint(newEntryPoint, exitPointL);
}
- entryPointL = roundedValue;
+
+ entryPointL = newEntryPoint;
}
}
@@ -114,7 +114,6 @@
/// length of .
/// [m]
///
- /// is less than or equal to 0.
public RoundedDouble ExitPointL
{
get
@@ -123,17 +122,25 @@
}
set
{
- RoundedDouble roundedValue = value.ToPrecision(exitPointL.NumberOfDecimalPlaces);
+ var newExitPoint = value.ToPrecision(exitPointL.NumberOfDecimalPlaces);
- if (roundedValue <= 0.0)
+ if (!double.IsNaN(entryPointL))
{
- throw new ArgumentOutOfRangeException("value", Resources.PipingInput_ExitPointL_Value_must_be_greater_than_zero);
+ ValidateEntryExitPoint(entryPointL, newExitPoint);
}
- exitPointL = roundedValue;
+ exitPointL = newExitPoint;
}
}
+ private void ValidateEntryExitPoint(RoundedDouble entryPoint, RoundedDouble exitPoint)
+ {
+ if (entryPoint >= exitPoint)
+ {
+ throw new ArgumentOutOfRangeException(null, Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
+ }
+ }
+
///
/// Gets or sets the surface line.
///
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs
===================================================================
diff -u -r12a35732d53e73c149035a212f96d2a0e9604cff -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 12a35732d53e73c149035a212f96d2a0e9604cff)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.18444
+// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -160,24 +160,15 @@
}
///
- /// Looks up a localized string similar to De waarde voor het L-coördinaat van het intredepunt mag niet kleiner zijn dan 0..
+ /// Looks up a localized string similar to Het uittredepunt ligt niet voorbij het intredepunt..
///
- public static string PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero {
+ public static string PipingInput_EntryPointL_greater_or_equal_to_ExitPointL {
get {
- return ResourceManager.GetString("PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero", resourceCulture);
+ return ResourceManager.GetString("PipingInput_EntryPointL_greater_or_equal_to_ExitPointL", resourceCulture);
}
}
///
- /// Looks up a localized string similar to De waarde voor het L-coördinaat van het uittredepunt moet groter zijn dan 0..
- ///
- public static string PipingInput_ExitPointL_Value_must_be_greater_than_zero {
- get {
- return ResourceManager.GetString("PipingInput_ExitPointL_Value_must_be_greater_than_zero", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to De waarde moet tussen 0 en 1 zijn..
///
public static string PipingProbabilityAssessmentInput_A_Value_must_be_between_zero_and_one {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx
===================================================================
diff -u -r12a35732d53e73c149035a212f96d2a0e9604cff -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision 12a35732d53e73c149035a212f96d2a0e9604cff)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -168,12 +168,6 @@
Dijken en dammen - Piping
-
- De waarde voor het L-coördinaat van het uittredepunt moet groter zijn dan 0.
-
-
- De waarde voor het L-coördinaat van het intredepunt mag niet kleiner zijn dan 0.
-
Level {0} is below the bottom of the soil profile {1}.
@@ -183,4 +177,7 @@
De waarde moet tussen 0 en 1 zijn.
+
+ Het uittredepunt ligt niet voorbij het intredepunt.
+
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs
===================================================================
diff -u -r411b50528bbd83c02ffdcae699895529b2b34bf7 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision 411b50528bbd83c02ffdcae699895529b2b34bf7)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/RingtoetsPipingSurfaceLine.cs (.../RingtoetsPipingSurfaceLine.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -347,7 +347,7 @@
/// L-coordinate being monotonically non-decreasing
/// falls outside the L-coordiante span
/// defined by .
- private static void ValidateInRange(double localCoordinateL, Point2D[] geometryInLocalCoordinates)
+ public void ValidateInRange(double localCoordinateL, Point2D[] geometryInLocalCoordinates)
{
Point2D firstLocalPoint = geometryInLocalCoordinates.First();
Point2D lastLocalPoint = geometryInLocalCoordinates.Last();
Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs
===================================================================
diff -u -r73aa6b5e849110e5c7cb584cce2aeb36698e7eee -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision 73aa6b5e849110e5c7cb584cce2aeb36698e7eee)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Service/PipingCalculationService.cs (.../PipingCalculationService.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -105,7 +105,6 @@
var isSurfaceLineMissing = inputParameters.SurfaceLine == null;
var isExitPointLMissing = double.IsNaN(inputParameters.ExitPointL);
var isEntryPointLMissing = double.IsNaN(inputParameters.EntryPointL);
- var isExitPointLBeyondEntryPointL = inputParameters.ExitPointL > inputParameters.EntryPointL;
if (isHydraulicBoundaryLocationMissing)
{
@@ -132,11 +131,6 @@
validationResult.Add(Resources.PipingCalculationService_ValidateInput_No_value_for_ExitPointL);
}
- if (!isEntryPointLMissing && !isExitPointLMissing && !isExitPointLBeyondEntryPointL)
- {
- validationResult.Add(Resources.PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL);
- }
-
if (!isHydraulicBoundaryLocationMissing)
{
if (double.IsNaN(inputParameters.AssessmentLevel))
Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs
===================================================================
diff -u -r0f7eb2998561112d0013b667ee39c2316341d2fe -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0f7eb2998561112d0013b667ee39c2316341d2fe)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
//
// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Runtime Version:4.0.30319.17929
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -115,16 +115,6 @@
}
///
- /// Looks up a localized string similar to Het uittredepunt ligt niet voorbij het intredepunt..
- ///
- internal static string PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL {
- get {
- return ResourceManager.GetString("PipingCalculationService_ValidateInput_EntryPointL_greater_or_equal_to_ExitPointL" +
- "", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to Er is geen hydraulische randvoorwaardenlocatie geselecteerd..
///
internal static string PipingCalculationService_ValidateInput_No_HydraulicBoundaryLocation_selected {
Index: Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx
===================================================================
diff -u -r0f7eb2998561112d0013b667ee39c2316341d2fe -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision 0f7eb2998561112d0013b667ee39c2316341d2fe)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Service/Properties/Resources.resx (.../Resources.resx) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -153,7 +153,4 @@
Er is geen waarde voor het uittredepunt opgegeven.
-
- Het uittredepunt ligt niet voorbij het intredepunt.
-
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs
===================================================================
diff -u -r5b8f476716cb75977616203318fa250f608fe7a5 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision 5b8f476716cb75977616203318fa250f608fe7a5)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -311,36 +311,6 @@
}
[Test]
- public void ThicknessAquiferLayer_MeanSetExitPointSetBeyondSurfaceLine_ReturnMeanNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 3.0;
- var derivedInput = new DerivedPipingInput(input);
-
- // Call
- LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
-
- // Assert
- Assert.IsNaN(thicknessAquiferLayer.Mean);
- }
-
- [Test]
- public void ThicknessCoverageLayer_MeanSetExitPointSetBeyondSurfaceLine_ThicknessAquiferLayerNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 3.0;
- var derivedInput = new DerivedPipingInput(input);
-
- // Call
- LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
-
- // Assert
- Assert.IsNaN(thicknessCoverageLayer.Mean);
- }
-
- [Test]
public void ThicknessCoverageLayer_MeanSetSoilProfileSetToNull_ThicknessCoverageLayerNaN()
{
// Setup
@@ -537,23 +507,6 @@
}
[Test]
- public void SeepageLength_ExitPointSetBeyondEntryPoint_SeepageLengthNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 2;
- input.EntryPointL = (RoundedDouble) 3;
- var derivedInput = new DerivedPipingInput(input);
-
- // Call
- var seepageLength = derivedInput.SeepageLength;
-
- // Assert
- Assert.IsNaN(seepageLength.Mean);
- Assert.IsNaN(seepageLength.StandardDeviation);
- }
-
- [Test]
public void SeepageLength_EntryPointNaN_SeepageLengthNaN()
{
// Setup
Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs
===================================================================
diff -u -r6fa4176d058f2f332fedcf0c95ad5db3a60332ce -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 6fa4176d058f2f332fedcf0c95ad5db3a60332ce)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -152,51 +152,64 @@
}
[Test]
- public void ExitPointL_SetToNew_ValueIsRounded()
+ public void ExitPointL_ExitPointSmallerThanEntryPoint_ThrowsArgumentOutOfRangeException()
{
// Setup
- var pipingInput = new PipingInput(new GeneralPipingInput());
+ var pipingInput = new PipingInput(new GeneralPipingInput())
+ {
+ EntryPointL = (RoundedDouble) 3.5
+ };
const double value = 1.23456;
- int originalNumberOfDecimalPlaces = pipingInput.ExitPointL.NumberOfDecimalPlaces;
// Call
- pipingInput.ExitPointL = (RoundedDouble) value;
+ TestDelegate call = () => pipingInput.ExitPointL = (RoundedDouble)value;
// Assert
- Assert.AreEqual(originalNumberOfDecimalPlaces, pipingInput.ExitPointL.NumberOfDecimalPlaces);
- Assert.AreEqual(new RoundedDouble(originalNumberOfDecimalPlaces, value), pipingInput.ExitPointL);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
}
[Test]
- [TestCase(1e-6, Description = "Invalid ExitPointL due to rounding to 0.0")]
- [TestCase(0)]
- [TestCase(-1e-6)]
- [TestCase(-21)]
- public void ExitPointL_ValueLessThanOrEqualToZero_ThrowsArgumentOutOfRangeException(double value)
+ [TestCase(double.NaN)]
+ [TestCase(1.0)]
+ public void ExitPointL_SetToNew_ValueIsRounded(double entryPointValue)
{
// Setup
- var pipingInput = new PipingInput(new GeneralPipingInput());
+ var pipingInput = new PipingInput(new GeneralPipingInput())
+ {
+ SurfaceLine = CreateSurfaceLine(),
+ EntryPointL = (RoundedDouble) entryPointValue
+ };
+ const double value = 1.23456;
+ int originalNumberOfDecimalPlaces = pipingInput.ExitPointL.NumberOfDecimalPlaces;
+
// Call
- TestDelegate test = () => pipingInput.ExitPointL = (RoundedDouble) value;
+ pipingInput.ExitPointL = (RoundedDouble) value;
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Resources.PipingInput_ExitPointL_Value_must_be_greater_than_zero);
+ Assert.AreEqual(originalNumberOfDecimalPlaces, pipingInput.ExitPointL.NumberOfDecimalPlaces);
+ Assert.AreEqual(new RoundedDouble(originalNumberOfDecimalPlaces, value), pipingInput.ExitPointL);
}
[Test]
- [TestCase(-1e-2)]
- [TestCase(-21)]
- public void EntryPointL_ValueLessThanZero_ThrowsArgumentOutOfRangeException(double value)
+ public void EntryPointL_EntryPointGreaterThanExitPoint_ThrowsArgumentOutOfRangeException()
{
// Setup
- var pipingInput = new PipingInput(new GeneralPipingInput());
+ var pipingInput = new PipingInput(new GeneralPipingInput())
+ {
+ ExitPointL = (RoundedDouble)3.5
+ };
+ const double value = 5.0;
// Call
- TestDelegate test = () => pipingInput.EntryPointL = (RoundedDouble) value;
+ TestDelegate call = () => pipingInput.EntryPointL = (RoundedDouble)value;
// Assert
- TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, Resources.PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero);
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
}
[Test]
@@ -555,34 +568,6 @@
}
[Test]
- public void ThicknessAquiferLayer_MeanSetExitPointSetBeyondSurfaceLine_ThicknessAquiferLayerNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 3.0;
-
- // Call
- LogNormalDistribution thicknessAquiferLayer = input.ThicknessAquiferLayer;
-
- // Assert
- Assert.IsNaN(thicknessAquiferLayer.Mean);
- }
-
- [Test]
- public void ThicknessCoverageLayer_MeanSetExitPointSetBeyondSurfaceLine_ThicknessAquiferLayerNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 3.0;
-
- // Call
- LogNormalDistribution thicknessCoverageLayer = input.ThicknessCoverageLayer;
-
- // Assert
- Assert.IsNaN(thicknessCoverageLayer.Mean);
- }
-
- [Test]
public void ThicknessCoverageLayer_MeanSetSoilProfileSetToNull_ThicknessCoverageLayerNaN()
{
// Setup
@@ -780,24 +765,8 @@
Assert.AreEqual(0.5, seepageLength.Mean.Value);
Assert.AreEqual(0.05, seepageLength.StandardDeviation.Value);
}
-
+
[Test]
- public void SeepageLength_ExitPointSetBeyondEntryPoint_SeepageLengthNaN()
- {
- // Setup
- var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer();
- input.ExitPointL = (RoundedDouble) 2;
- input.EntryPointL = (RoundedDouble) 3;
-
- // Call
- var seepageLength = input.SeepageLength;
-
- // Assert
- Assert.IsNaN(seepageLength.Mean);
- Assert.IsNaN(seepageLength.StandardDeviation);
- }
-
- [Test]
public void SeepageLength_EntryPointNaN_SeepageLengthNaN()
{
// Setup
@@ -831,5 +800,17 @@
{
return Math.Pow(10.0, -roundedDouble.NumberOfDecimalPlaces);
}
+
+ private static RingtoetsPipingSurfaceLine CreateSurfaceLine()
+ {
+ var surfaceLine = new RingtoetsPipingSurfaceLine();
+ surfaceLine.SetGeometry(new[]
+ {
+ new Point3D(0, 0, 0),
+ new Point3D(2, 0, 2)
+ });
+
+ return surfaceLine;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs
===================================================================
diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -26,6 +26,7 @@
using Core.Common.Base.Data;
using Core.Common.Base.Geometry;
using Core.Common.Gui.PropertyBag;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
@@ -39,6 +40,8 @@
using Ringtoets.Piping.KernelWrapper.TestUtil;
using Ringtoets.Piping.Primitives;
+using RingtoetsPipingDataResources = Ringtoets.Piping.Data.Properties.Resources;
+
namespace Ringtoets.Piping.Forms.Test.PropertyClasses
{
[TestFixture]
@@ -352,23 +355,22 @@
}
[Test]
- public void EntryPointL_SetResultInInvalidSeePage_SeepageLengthValueNaN()
+ [TestCase(2.0)]
+ [TestCase(-5.0)]
+ public void ExitPointL_InvalidValue_ThrowsArgumentOutOfRangeException(double newExitPoint)
{
// Setup
var mocks = new MockRepository();
var assessmentSectionMock = mocks.StrictMock();
var inputObserver = mocks.StrictMock();
- inputObserver.Expect(o => o.UpdateObserver());
mocks.ReplayAll();
var surfaceLine = ValidSurfaceLine(0.0, 4.0);
var calculationItem = new PipingCalculationScenario(new GeneralPipingInput());
var failureMechanism = new PipingFailureMechanism();
- var inputParameters = new PipingInput(new GeneralPipingInput())
- {
- SurfaceLine = surfaceLine
- };
+ var inputParameters = new PipingInput(new GeneralPipingInput());
+ inputParameters.SurfaceLine = surfaceLine;
var properties = new PipingInputContextProperties
{
@@ -381,27 +383,30 @@
};
const double l = 2.0;
- properties.ExitPointL = (RoundedDouble) l;
+ properties.EntryPointL = (RoundedDouble) l;
inputParameters.Attach(inputObserver);
// Call
- properties.EntryPointL = (RoundedDouble) l;
+ TestDelegate call = () => properties.ExitPointL = (RoundedDouble) newExitPoint;
// Assert
- Assert.IsNaN(properties.SeepageLength.GetDesignValue());
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ RingtoetsPipingDataResources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
mocks.VerifyAll();
}
[Test]
- public void ExitPointL_SetResultInInvalidSeePage_ThrowsArgumentException()
+ [TestCase(2.0)]
+ [TestCase(5.0)]
+ public void entryPointL_InvalidValue_ThrowsArgumentOutOfRangeException(double newEntryPoint)
{
// Setup
var mocks = new MockRepository();
var assessmentSectionMock = mocks.StrictMock();
var inputObserver = mocks.StrictMock();
- inputObserver.Expect(o => o.UpdateObserver());
mocks.ReplayAll();
var surfaceLine = ValidSurfaceLine(0.0, 4.0);
@@ -422,15 +427,17 @@
};
const double l = 2.0;
- properties.EntryPointL = (RoundedDouble) l;
+ properties.ExitPointL = (RoundedDouble) l;
inputParameters.Attach(inputObserver);
// Call
- properties.ExitPointL = (RoundedDouble) l;
+ TestDelegate call = () => properties.EntryPointL = (RoundedDouble) newEntryPoint;
// Assert
- Assert.IsNaN(properties.SeepageLength.GetDesignValue());
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ RingtoetsPipingDataResources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
mocks.VerifyAll();
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationRowTest.cs
===================================================================
diff -u -rbd3056331b8727d6f9758d1f4e5979694d439398 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationRowTest.cs (.../PipingCalculationRowTest.cs) (revision bd3056331b8727d6f9758d1f4e5979694d439398)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationRowTest.cs (.../PipingCalculationRowTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -24,6 +24,7 @@
using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.Controls.DataGrid;
+using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
@@ -33,6 +34,8 @@
using Ringtoets.Piping.Data.TestUtil;
using Ringtoets.Piping.Forms.Views;
+using RingtoetsPipingDataResources = Ringtoets.Piping.Data.Properties.Resources;
+
namespace Ringtoets.Piping.Forms.Test.Views
{
[TestFixture]
@@ -267,51 +270,101 @@
}
[Test]
- public void EntryPointL_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
+ public void EntryPointL_OnValidChange_NotifyObserverAndCalculationPropertyChanged()
{
// Setup
- var newValue = new Random().Next();
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+ var newValue = 0.1;
+
var calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
var row = new PipingCalculationRow(calculation);
- int counter = 0;
- using (new Observer(() => counter++)
- {
- Observable = calculation.InputParameters
- })
- {
- // Call
- row.EntryPointL = (RoundedDouble)newValue;
+ calculation.InputParameters.Attach(observer);
- // Assert
- Assert.AreEqual(1, counter);
- Assert.AreEqual(new RoundedDouble(2, newValue), calculation.InputParameters.EntryPointL);
- }
+ // Call
+ row.EntryPointL = (RoundedDouble)newValue;
+
+ // Assert
+ Assert.AreEqual(new RoundedDouble(2, newValue), calculation.InputParameters.EntryPointL);
+ mocks.VerifyAll();
}
[Test]
- public void ExitPointL_AlwaysOnChange_NotifyObserverAndCalculationPropertyChanged()
+ [TestCase(0.2)]
+ [TestCase(1.0)]
+ public void EntryPointL_EntryPointNotBeforeExitPoint_ThrowsArgumentOutOfRangeExceptionDoesNotNotifyObservers(double newValue)
{
// Setup
- var newValue = new Random().Next();
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
var calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
var row = new PipingCalculationRow(calculation);
- int counter = 0;
- using (new Observer(() => counter++)
- {
- Observable = calculation.InputParameters
- })
- {
- // Call
- row.ExitPointL = (RoundedDouble)newValue;
+ calculation.InputParameters.Attach(observer);
- // Assert
- Assert.AreEqual(1, counter);
- Assert.AreEqual(new RoundedDouble(2, newValue), calculation.InputParameters.ExitPointL);
- }
+ // Call
+ TestDelegate call = () => row.EntryPointL = (RoundedDouble) newValue;
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ RingtoetsPipingDataResources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
+ mocks.VerifyAll();
}
+
+ [Test]
+ public void ExitPointL_OnValidChange_NotifyObserverAndCalculationPropertyChanged()
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ observer.Expect(o => o.UpdateObserver());
+ mocks.ReplayAll();
+
+ var newValue = 0.3;
+
+ var calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
+ var row = new PipingCalculationRow(calculation);
+
+ calculation.InputParameters.Attach(observer);
+
+ // Call
+ row.ExitPointL = (RoundedDouble)newValue;
+
+ // Assert
+ Assert.AreEqual(new RoundedDouble(2, newValue), calculation.InputParameters.ExitPointL);
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ [TestCase(0.0)]
+ [TestCase(-0.2)]
+ public void ExitPointL_ExitPointNotBeyondEntryPoint_ThrowsArgumentOutOfRangeExceptionDoesNotNotifyObservers(double newValue)
+ {
+ // Setup
+ var mocks = new MockRepository();
+ var observer = mocks.StrictMock();
+ mocks.ReplayAll();
+
+ var calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
+ var row = new PipingCalculationRow(calculation);
+
+ calculation.InputParameters.Attach(observer);
+
+ // Call
+ TestDelegate call = () => row.ExitPointL = (RoundedDouble)newValue;
+
+ // Assert
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(
+ call,
+ RingtoetsPipingDataResources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL);
+ mocks.VerifyAll();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs
===================================================================
diff -u -r6fa4176d058f2f332fedcf0c95ad5db3a60332ce -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision 6fa4176d058f2f332fedcf0c95ad5db3a60332ce)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Views/PipingCalculationsViewTest.cs (.../PipingCalculationsViewTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -41,6 +41,8 @@
using Ringtoets.Piping.Forms.Views;
using Ringtoets.Piping.Primitives;
+using RingtoetsPipingDataResources = Ringtoets.Piping.Data.Properties.Resources;
+
namespace Ringtoets.Piping.Forms.Test.Views
{
[TestFixture]
@@ -441,14 +443,12 @@
[TestCase("1e-6", phreaticLevelExitMeanColumnIndex)]
[TestCase("1e+6", phreaticLevelExitMeanColumnIndex)]
[TestCase("14.3", phreaticLevelExitMeanColumnIndex)]
- [TestCase("1", entryPointLColumnIndex)]
- [TestCase("1e-6", entryPointLColumnIndex)]
- [TestCase("1e+6", entryPointLColumnIndex)]
- [TestCase("14.3", entryPointLColumnIndex)]
- [TestCase("1", exitPointLColumnIndex)]
- [TestCase("1e-2", exitPointLColumnIndex)]
- [TestCase("1e+6", exitPointLColumnIndex)]
- [TestCase("14.3", exitPointLColumnIndex)]
+ [TestCase("2.2", entryPointLColumnIndex)]
+ [TestCase("0.022e+2", entryPointLColumnIndex)]
+ [TestCase("220e-2", entryPointLColumnIndex)]
+ [TestCase("5.5", exitPointLColumnIndex)]
+ [TestCase("0.055e+2", exitPointLColumnIndex)]
+ [TestCase("550e-2", exitPointLColumnIndex)]
public void FailureMechanismResultView_EditValueValid_DoNotShowErrorToolTipAndEditValue(string newValue, int cellIndex)
{
// Setup
@@ -823,7 +823,7 @@
[TestCase(dampingFactorExitMeanColumnIndex, 1.1, 0, 1)]
[TestCase(phreaticLevelExitMeanColumnIndex, 1.1, 0, 1)]
[TestCase(entryPointLColumnIndex, 1.1, 0, 1)]
- [TestCase(exitPointLColumnIndex, 1.1, 0, 1)]
+ [TestCase(exitPointLColumnIndex, 5.5, 0, 1)]
public void PipingCalculationsView_EditingPropertyViaDataGridView_ObserversCorrectlyNotified(int cellIndex, object newValue, int expectedPipingCalculationCounter, int expectedPipingCalculationInputCounter)
{
// Setup
@@ -849,6 +849,37 @@
Assert.AreEqual(expectedPipingCalculationInputCounter, pipingCalculationInputCounter);
}
+ [Test]
+ [TestCase(entryPointLColumnIndex, 6.6)]
+ [TestCase(entryPointLColumnIndex, 4.44)]
+ [TestCase(exitPointLColumnIndex, 2.22)]
+ [TestCase(exitPointLColumnIndex, 1.1)]
+ public void PipingCalculationsView_InvalidEntryOrExitPoint_ShowsErrorTooltip(int cellIndex, object newValue)
+ {
+ // Setup
+ var pipingCalculationView = ShowFullyConfiguredPipingCalculationsView();
+
+ var data = (CalculationGroup)pipingCalculationView.Data;
+ var pipingCalculation = (PipingCalculationScenario)data.Children.First();
+ var pipingCalculationCounter = 0;
+ var pipingCalculationInputCounter = 0;
+ var pipingCalculationObserver = new Observer(() => pipingCalculationCounter++);
+ var pipingCalculationInputObserver = new Observer(() => pipingCalculationInputCounter++);
+
+ pipingCalculation.Attach(pipingCalculationObserver);
+ pipingCalculation.InputParameters.Attach(pipingCalculationInputObserver);
+
+ var dataGridView = (DataGridView)new ControlTester("dataGridView").TheObject;
+
+ // Call
+ dataGridView.Rows[0].Cells[cellIndex].Value = newValue is double ? (RoundedDouble)(double)newValue : newValue;
+
+ // Assert
+ Assert.AreEqual(RingtoetsPipingDataResources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL, dataGridView.Rows[0].ErrorText);
+ Assert.AreEqual(0, pipingCalculationCounter);
+ Assert.AreEqual(0, pipingCalculationInputCounter);
+ }
+
private const int isRelevantColumnIndex = 0;
private const int contributionColumnIndex = 1;
private const int nameColumnIndex = 2;
Index: Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs
===================================================================
diff -u -r8293556a04e3650c9978df7a50f8f8ad0d792ed8 -rc33fbb6a840ef596c665774b609f82b948f3b512
--- Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision 8293556a04e3650c9978df7a50f8f8ad0d792ed8)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Service.Test/PipingCalculationServiceTest.cs (.../PipingCalculationServiceTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512)
@@ -208,37 +208,6 @@
}
[Test]
- [TestCase(0.5)]
- [TestCase(0.5+1e-6)]
- [TestCase(0.6)]
- [TestCase(1.6)]
- public void Validate_CalculationWithExitPointLBeforeEntryPointL_LogsErrorAndReturnsFalse(double entryPointL)
- {
- // Setup
- const string name = "";
-
- PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
- calculation.InputParameters.ExitPointL = (RoundedDouble) 0.5;
- calculation.InputParameters.EntryPointL = (RoundedDouble) entryPointL;
- calculation.Name = name;
-
- // Call
- bool isValid = false;
- Action call = () => isValid = PipingCalculationService.Validate(calculation);
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- var msgs = messages.ToArray();
- Assert.AreEqual(3, msgs.Length);
- StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First());
- StringAssert.StartsWith("Validatie mislukt: Het uittredepunt ligt niet voorbij het intredepunt.", msgs[1]);
- StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last());
- });
- Assert.IsFalse(isValid);
- }
-
- [Test]
public void Validate_CalculationWithoutSurfaceLine_LogsErrorAndReturnsFalse()
{
// Setup
@@ -293,33 +262,6 @@
}
[Test]
- public void Validate_CalculationWithExitPointPastLocalizedSurfaceLine_LogsErrorAndReturnsFalse()
- {
- // Setup
- const string name = "";
-
- PipingCalculation calculation = PipingCalculationFactory.CreateCalculationWithValidInput();
- calculation.InputParameters.ExitPointL = (RoundedDouble) 1.1;
- calculation.Name = name;
-
- // Call
- bool isValid = false;
- Action call = () => isValid = PipingCalculationService.Validate(calculation);
-
- // Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- var msgs = messages.ToArray();
- Assert.AreEqual(4, msgs.Length);
- StringAssert.StartsWith(String.Format("Validatie van '{0}' gestart om: ", name), msgs.First());
- StringAssert.StartsWith("Validatie mislukt: Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer.", msgs[1]);
- StringAssert.StartsWith("Validatie mislukt: Kan de totale deklaagdikte bij het uittredepunt niet afleiden op basis van de invoer.", msgs[2]);
- StringAssert.StartsWith(String.Format("Validatie van '{0}' beëindigd om: ", name), msgs.Last());
- });
- Assert.IsFalse(isValid);
- }
-
- [Test]
public void PerformValidatedCalculation_ValidPipingCalculation_LogStartAndEndOfValidatingInputsAndCalculation()
{
// Setup