Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs =================================================================== diff -u -raa019c917497b6ef42da091940f29e64fd82fc19 -r7d4fdb527410c89577828ea5d84896945341bae8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision aa019c917497b6ef42da091940f29e64fd82fc19) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Service.Test/GrassCoverErosionInwardsCalculationServiceTest.cs (.../GrassCoverErosionInwardsCalculationServiceTest.cs) (revision 7d4fdb527410c89577828ea5d84896945341bae8) @@ -22,6 +22,7 @@ using System; using System.IO; using System.Linq; +using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Core.Common.TestUtil; using NUnit.Framework; @@ -31,7 +32,6 @@ using Ringtoets.Common.Data.DikeProfiles; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.GrassCoverErosionInwards.Data; -using Ringtoets.HydraRing.Calculation.Calculator; using Ringtoets.HydraRing.Calculation.Calculator.Factory; using Ringtoets.HydraRing.Calculation.Parsers; using Ringtoets.HydraRing.Calculation.TestUtil.Calculator; @@ -186,7 +186,8 @@ Name = name, InputParameters = { - HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2) + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2), + Orientation = (RoundedDouble) 0 } }; @@ -245,6 +246,50 @@ } [Test] + public void Validate_ValidInputAndInvalidOrientation_ReturnsFalse() + { + // Setup + var grassCoverErosionInwardsFailureMechanism = new GrassCoverErosionInwardsFailureMechanism(); + + var mockRepository = new MockRepository(); + var assessmentSectionStub = CreateAssessmentSectionStub(grassCoverErosionInwardsFailureMechanism, mockRepository); + mockRepository.ReplayAll(); + + const string name = ""; + + GrassCoverErosionInwardsCalculation calculation = new GrassCoverErosionInwardsCalculation() + { + Name = name, + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 2, 2), + DikeProfile = new DikeProfile(new Point2D(0, 0), new RoughnessPoint[0], new Point2D[0], + null, new DikeProfile.ConstructionProperties() + { + Orientation = (RoundedDouble) double.NaN + }) + } + }; + + // Call + bool isValid = false; + Action call = () => isValid = new GrassCoverErosionInwardsCalculationService().Validate(calculation, assessmentSectionStub); + + // 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[0]); + Assert.AreEqual("Validatie mislukt: Er is geen concreet getal ingevoerd voor 'oriƫntatie'.", msgs[1]); + StringAssert.StartsWith(string.Format("Validatie van '{0}' beƫindigd om: ", name), msgs[2]); + }); + Assert.IsFalse(isValid); + + mockRepository.VerifyAll(); + } + + [Test] [TestCase(true, 10.0)] [TestCase(false, 10.0)] [TestCase(false, double.NaN)]