Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryLocationCalculationTest.cs =================================================================== diff -u -rda7bb9a6d96d7118d6dcdc2ee17a11d5b43f44c7 -r0e2d1a46c627af6d19cdf21dff840716bac84045 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryLocationCalculationTest.cs (.../HydraulicBoundaryLocationCalculationTest.cs) (revision da7bb9a6d96d7118d6dcdc2ee17a11d5b43f44c7) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Hydraulics/HydraulicBoundaryLocationCalculationTest.cs (.../HydraulicBoundaryLocationCalculationTest.cs) (revision 0e2d1a46c627af6d19cdf21dff840716bac84045) @@ -23,6 +23,7 @@ using System.Collections.Generic; using Core.Common.Base; using NUnit.Framework; +using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Data.TestUtil.IllustrationPoints; @@ -53,6 +54,7 @@ var calculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation); // Assert + Assert.IsInstanceOf(calculation); Assert.IsInstanceOf(calculation); Assert.AreSame(hydraulicBoundaryLocation, calculation.HydraulicBoundaryLocation); Assert.IsNotNull(calculation.InputParameters); @@ -78,48 +80,65 @@ } [Test] - [TestCaseSource(nameof(GetHydraulicBoundaryLocationCalculations))] - public void IsCalculated_Always_ReturnIsCalculated(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, - bool expectedIsCalculated) + [TestCaseSource(nameof(GetCalculations))] + public void ShouldCalculate_Always_ReturnsExpectedValue(HydraulicBoundaryLocationCalculation calculation, + bool expectedShouldCalculate) { // Call - bool isCalculated = hydraulicBoundaryLocationCalculation.IsCalculated; + bool shouldCalculate = calculation.ShouldCalculate; // Assert - Assert.AreEqual(expectedIsCalculated, isCalculated); + Assert.AreEqual(expectedShouldCalculate, shouldCalculate); } - private static IEnumerable GetHydraulicBoundaryLocationCalculations() + private static IEnumerable GetCalculations() { + var outputWithoutGeneralResult = new TestHydraulicBoundaryLocationCalculationOutput(1.0, CalculationConvergence.CalculatedConverged); + var outputWithGeneralResult = new TestHydraulicBoundaryLocationCalculationOutput(1.0, new TestGeneralResultSubMechanismIllustrationPoint()); + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) - { - InputParameters = { - ShouldIllustrationPointsBeCalculated = true - }, - Output = new TestHydraulicBoundaryLocationCalculationOutput(1.0, CalculationConvergence.CalculatedConverged) - }, false); + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = outputWithGeneralResult + }, false) + .SetName("OutputSufficientScenario1"); - yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()), false); + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = outputWithoutGeneralResult + }, false) + .SetName("OutputSufficientScenario2"); + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()), true) + .SetName("NoOutputScenario1"); + yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) - { - Output = new TestHydraulicBoundaryLocationCalculationOutput(1.0, CalculationConvergence.CalculatedConverged) - }, true); + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + } + }, true) + .SetName("NoOutputScenario2"); yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) - { - InputParameters = { - ShouldIllustrationPointsBeCalculated = true - }, - Output = new TestHydraulicBoundaryLocationCalculationOutput(1.0, new TestGeneralResultSubMechanismIllustrationPoint()) - }, true); + Output = outputWithGeneralResult + }, true) + .SetName("OutputWithRedundantGeneralResult"); yield return new TestCaseData(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) - { - Output = new TestHydraulicBoundaryLocationCalculationOutput(1.0, new TestGeneralResultSubMechanismIllustrationPoint()) - }, false); + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = outputWithoutGeneralResult + }, true) + .SetName("OutputWithMissingGeneralResult"); } } } \ No newline at end of file