Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs =================================================================== diff -u -rdf02e9274a94d8763da204833a4d93f984e242c6 -rfe3c7aa84947f57a508f494e6b671f9c19dce6df --- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs (.../WaveHeightCalculationParserTest.cs) (revision df02e9274a94d8763da204833a4d93f984e242c6) +++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Parsers/WaveHeightCalculationParserTest.cs (.../WaveHeightCalculationParserTest.cs) (revision fe3c7aa84947f57a508f494e6b671f9c19dce6df) @@ -86,12 +86,15 @@ } [Test] - [TestCase("6-3_0-output.txt", 0.91641)] - [TestCase("304432-fdir-output.txt", 2.78346)] - [TestCase("304432-form-output.txt", 2.78347)] - [TestCase("700003-fdir-output.txt", 1.04899)] - [TestCase("700003-form-output.txt", 1.04899)] - public void Parse_ExampleHydraRingOutputFileContainingSectionIds_ReturnsExpectedTargetProbabilityCalculationResult(string testFile, double expected) + [TestCase("6-3_0-output.txt", 0.91641, true)] + [TestCase("6-3_0-output-not-dominant.txt", 0.91641, false)] + [TestCase("304432-fdir-output.txt", 2.78346, true)] + [TestCase("304432-form-output.txt", 2.78347, true)] + [TestCase("304432-form-output-not-dominant.txt", 2.78347, false)] + [TestCase("700003-fdir-output.txt", 1.04899, true)] + [TestCase("700003-form-output.txt", 1.04899, true)] + [TestCase("700003-form-output-not-dominant.txt", 1.04899, false)] + public void Parse_ExampleHydraRingOutputFileContainingSectionIds_OutputSetWithExpectedCalculationResult(string testFile, double expected, bool isOvertoppingDominant) { // Setup var parser = new WaveHeightCalculationParser(); @@ -107,9 +110,34 @@ // Assert Assert.AreEqual(expected, parser.Output.WaveHeight); - Assert.IsTrue(parser.Output.IsOvertoppingDominant); + Assert.AreEqual(isOvertoppingDominant, parser.Output.IsOvertoppingDominant); } + [Test] + [TestCase("6-3_0-output-no-overtopping.txt")] + [TestCase("6-3_0-output-no-overflow.txt")] + [TestCase("6-3_0-output-invalid-hs.txt")] + [TestCase("6-3_0-output-invalid-closing.txt")] + [TestCase("6-3_0-output-invalid-wind.txt")] + [TestCase("6-3_0-output-invalid-beta.txt")] + [TestCase("6-3_0-output-no-relevant-overflow.txt")] + public void Parse_InvalidHydraRingOutputFile_OutputNull(string testFile) + { + // Setup + var parser = new WaveHeightCalculationParser(); + var sectionId = 1; + + using (var copyHelper = new TestDataCopyHelper(testDataPath, workingDirectory)) + { + copyHelper.CopyToTemporaryOutput(testFile, GetOutputFileName(sectionId)); + + // Call + parser.Parse(workingDirectory, sectionId); + } + + // Assert + Assert.IsNull(parser.Output); + } private string GetOutputFileName(int sectionId) { return string.Format("{0}{1}", sectionId, HydraRingFileName.OutputFileSuffix);