Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Sensors/SensorPLLineCreatorTest.cs =================================================================== diff -u -r4627 -r5659 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Sensors/SensorPLLineCreatorTest.cs (.../SensorPLLineCreatorTest.cs) (revision 4627) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Sensors/SensorPLLineCreatorTest.cs (.../SensorPLLineCreatorTest.cs) (revision 5659) @@ -1255,12 +1255,45 @@ } } + [TestCase(8.001)] + [TestCase(10.0)] + public void CreatePlLine_Pl1WithRiverLevelHigherThanSurface_Throws(double riverLevel) + { + // setup + SetUpSensorData(riverLevel, out IDictionary sensorValues, out SensorLocation sensorLocation); + + var creator = new SensorPlLine1Creator(sensorLocation, sensorValues); + // call + Assert.That(() => creator.CreatePlLine(), Throws.TypeOf(typeof(SurfaceLineException)).With.Message.Contains("should NOT be higher than surface line")); + } + [TestCase(-0.001)] [TestCase(-10.0)] - [TestCase(10.0)] - public void CreatePlLine_Pl1WithIllegalWaterLevel_Throws(double riverLevel) + public void CreatePlLine_Pl1WithRiverLevelBelowDikeToeAtRiver_DoesNotThrow(double riverLevel) { // setup + SetUpSensorData(riverLevel, out IDictionary sensorValues, out SensorLocation sensorLocation); + var creator = new SensorPlLine1Creator(sensorLocation, sensorValues); + // call + Assert.DoesNotThrow(() => creator.CreatePlLine()); + } + + private Location CreateConfiguredLocation(string name, double riverLevel, double polderLevel) + { + var location = new Location(name) + { + RiverLevel = riverLevel + }; + var scenario = new DesignScenario + { + PolderLevel = polderLevel + }; + location.Scenarios.Add(scenario); + return location; + } + + private void SetUpSensorData(double riverLevel, out IDictionary sensorValues, out SensorLocation sensorLocation) + { var surfaceLine = new SurfaceLine2 { CharacteristicPoints = @@ -1336,7 +1369,7 @@ repository.Add(sensor3); repository.Add(sensor4); - IDictionary sensorValues = new Dictionary + sensorValues = new Dictionary { { sensor1, 1 @@ -1352,37 +1385,10 @@ } }; - SensorLocation sensorLocation = location.SensorLocation; - - var creator = new SensorPlLine1Creator(sensorLocation, sensorValues); - // call - if (riverLevel > 8) - { - Assert.That(() => creator.CreatePlLine(), Throws.TypeOf(typeof(SurfaceLineException)).With.Message.Contains("should NOT be higher than surface line")); - } - - if (riverLevel < 0) - { - Assert.That(() => creator.CreatePlLine(), - Throws.TypeOf(typeof(SurfaceLineException)).With.Message - .Contains("should be higher than dike toe at river side")); - } + sensorLocation = location.SensorLocation; } - private Location CreateConfiguredLocation(string name, double riverLevel, double polderLevel) - { - var location = new Location(name) - { - RiverLevel = riverLevel - }; - var scenario = new DesignScenario - { - PolderLevel = polderLevel - }; - location.Scenarios.Add(scenario); - return location; - } - + #region Setup [SetUp]