Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs =================================================================== diff -u -r9779d1ab6b555c557e8fd18f4430ad207bd003da -re56b96f63d7f5098e36566ea556f45af5c142320 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision 9779d1ab6b555c557e8fd18f4430ad207bd003da) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Service.Test/StabilityStoneCoverWaveConditionsCalculationServiceTest.cs (.../StabilityStoneCoverWaveConditionsCalculationServiceTest.cs) (revision e56b96f63d7f5098e36566ea556f45af5c142320) @@ -24,6 +24,7 @@ using System.Linq; using Core.Common.Base.Data; using Core.Common.TestUtil; +using Core.Common.Utils; using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; @@ -350,7 +351,7 @@ } [Test] - public void Calculate_GeneralInpuNull_ThrowArgumentNullException() + public void Calculate_GeneralInputNull_ThrowArgumentNullException() { // Setup var mocks = new MockRepository(); @@ -850,16 +851,16 @@ validFilePath); // Assert + RoundedDouble[] waterLevels = calculation.InputParameters.WaterLevels.ToArray(); + RoundedDouble waterLevelUpperBoundaryRevetment = waterLevels[0]; + RoundedDouble waterLevelMiddleRevetment = waterLevels[1]; + RoundedDouble waterLevelLowerBoundaryRevetment = waterLevels[2]; + TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); Assert.AreEqual(25, msgs.Length); - RoundedDouble[] waterLevels = calculation.InputParameters.WaterLevels.ToArray(); - RoundedDouble waterLevelUpperBoundaryRevetment = waterLevels[0]; - RoundedDouble waterLevelMiddleRevetment = waterLevels[1]; - RoundedDouble waterLevelLowerBoundaryRevetment = waterLevels[2]; - CalculationServiceTestHelper.AssertCalculationStartMessage(calculation.Name, msgs[0]); Assert.AreEqual($"Berekening '{calculation.Name}' voor blokken gestart.", msgs[1]); @@ -893,8 +894,10 @@ WaveConditionsOutput[] blocksWaveConditionsOutputs = calculation.Output.BlocksOutput.ToArray(); Assert.AreEqual(3, blocksWaveConditionsOutputs.Length); - AssertFailedCalculationOutput(blocksWaveConditionsOutputs[0]); + double targetNorm = assessmentSectionStub.FailureMechanismContribution.Norm; + AssertFailedCalculationOutput(waterLevelUpperBoundaryRevetment, targetNorm, blocksWaveConditionsOutputs[0]); + WaveConditionsOutput[] columnsWaveConditionsOutputs = calculation.Output.ColumnsOutput.ToArray(); Assert.AreEqual(3, columnsWaveConditionsOutputs.Length); } @@ -951,6 +954,11 @@ validFilePath); // Assert + RoundedDouble[] waterLevels = calculation.InputParameters.WaterLevels.ToArray(); + RoundedDouble waterLevelUpperBoundaryRevetment = waterLevels[0]; + RoundedDouble waterLevelMiddleRevetment = waterLevels[1]; + RoundedDouble waterLevelLowerBoundaryRevetment = waterLevels[2]; + TestHelper.AssertLogMessages(call, messages => { string[] msgs = messages.ToArray(); @@ -970,11 +978,6 @@ Assert.AreEqual($"Berekening '{calculation.Name}' voor blokken beƫindigd.", msgs[11]); Assert.AreEqual($"Berekening '{calculation.Name}' voor zuilen gestart.", msgs[12]); - RoundedDouble[] waterLevels = calculation.InputParameters.WaterLevels.ToArray(); - RoundedDouble waterLevelUpperBoundaryRevetment = waterLevels[0]; - RoundedDouble waterLevelMiddleRevetment = waterLevels[1]; - RoundedDouble waterLevelLowerBoundaryRevetment = waterLevels[2]; - Assert.AreEqual($"Berekening '{calculation.Name}' voor waterstand '{waterLevelUpperBoundaryRevetment}' gestart.", msgs[13]); Assert.AreEqual($"Berekening '{calculation.Name}' is mislukt voor waterstand '{waterLevelUpperBoundaryRevetment}'. {detailedReport}", msgs[14]); StringAssert.StartsWith("Golfcondities berekening is uitgevoerd op de tijdelijke locatie", msgs[15]); @@ -997,23 +1000,28 @@ WaveConditionsOutput[] columnsWaveConditionsOutputs = calculation.Output.ColumnsOutput.ToArray(); Assert.AreEqual(3, columnsWaveConditionsOutputs.Length); - AssertFailedCalculationOutput(columnsWaveConditionsOutputs[0]); + + double targetNorm = assessmentSectionStub.FailureMechanismContribution.Norm; + AssertFailedCalculationOutput(waterLevelUpperBoundaryRevetment, targetNorm, columnsWaveConditionsOutputs[0]); } mockRepository.VerifyAll(); } - private static void AssertFailedCalculationOutput(WaveConditionsOutput actual) + private static void AssertFailedCalculationOutput(double waterLevel, double targetNorm, WaveConditionsOutput actual) { + double targetReliability = StatisticsConverter.ProbabilityToReliability(targetNorm); + double targetProbability = StatisticsConverter.ReliabilityToProbability(targetReliability); + Assert.IsNotNull(actual); - Assert.AreEqual(RoundedDouble.NaN, actual.WaterLevel); - Assert.AreEqual(RoundedDouble.NaN, actual.WaveHeight); - Assert.AreEqual(RoundedDouble.NaN, actual.WavePeakPeriod); - Assert.AreEqual(RoundedDouble.NaN, actual.WaveAngle); - Assert.AreEqual(RoundedDouble.NaN, actual.WaveDirection); - Assert.AreEqual(double.NaN, actual.TargetProbability); - Assert.AreEqual(RoundedDouble.NaN, actual.TargetReliability); - Assert.AreEqual(double.NaN, actual.CalculatedProbability); - Assert.AreEqual(RoundedDouble.NaN, actual.CalculatedReliability); + Assert.AreEqual(waterLevel, actual.WaterLevel, actual.WaterLevel.GetAccuracy()); + Assert.IsNaN(actual.WaveHeight); + Assert.IsNaN(actual.WavePeakPeriod); + Assert.IsNaN(actual.WaveAngle); + Assert.IsNaN(actual.WaveDirection); + Assert.AreEqual(targetProbability, actual.TargetProbability); + Assert.AreEqual(targetReliability, actual.TargetReliability, actual.TargetReliability.GetAccuracy()); + Assert.IsNaN(actual.CalculatedProbability); + Assert.IsNaN(actual.CalculatedReliability); Assert.AreEqual(CalculationConvergence.CalculatedNotConverged, actual.CalculationConvergence); }