Index: Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresCalculation.cs =================================================================== diff -u -r65813dfccc471aa70736029d498d71ac0403c02d -rfdbe190cbae73817b0137f3c1433882bde956948 --- Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresCalculation.cs (.../StructuresCalculation.cs) (revision 65813dfccc471aa70736029d498d71ac0403c02d) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Structures/StructuresCalculation.cs (.../StructuresCalculation.cs) (revision fdbe190cbae73817b0137f3c1433882bde956948) @@ -58,7 +58,7 @@ { get { - return !HasOutput; + return !HasOutput || InputParameters.ShouldIllustrationPointsBeCalculated != Output.HasGeneralResult; } } Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresCalculationTest.cs =================================================================== diff -u -r07f3d67fe9512b3c8303ff09398b0a234900d546 -rfdbe190cbae73817b0137f3c1433882bde956948 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresCalculationTest.cs (.../StructuresCalculationTest.cs) (revision 07f3d67fe9512b3c8303ff09398b0a234900d546) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresCalculationTest.cs (.../StructuresCalculationTest.cs) (revision fdbe190cbae73817b0137f3c1433882bde956948) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System.Collections.Generic; using Core.Common.Base; using Core.Common.Data.TestUtil; using NUnit.Framework; @@ -98,6 +99,18 @@ } [Test] + [TestCaseSource(nameof(GetStructuresCalculations))] + public void ShouldCalculate_Always_ReturnsExpectedValue(TestStructuresCalculation calculation, + bool expectedShouldCalculate) + { + // Call + bool shouldCalculate = calculation.ShouldCalculate; + + // Assert + Assert.AreEqual(expectedShouldCalculate, shouldCalculate); + } + + [Test] public void ToString_Always_ReturnName() { // Setup @@ -174,9 +187,9 @@ return calculation; } - private class TestStructuresCalculation : StructuresCalculation {} + public class TestStructuresCalculation : StructuresCalculation {} - private class TestStructuresInput : StructuresInputBase + public class TestStructuresInput : StructuresInputBase { public override bool IsStructureInputSynchronized { @@ -188,5 +201,52 @@ public override void SynchronizeStructureInput() {} } + + private static IEnumerable GetStructuresCalculations() + { + yield return new TestCaseData(new TestStructuresCalculation + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()) + }, false) + .SetName("OutputSufficientScenario1"); + + yield return new TestCaseData(new TestStructuresCalculation + { + Output = new TestStructuresOutput() + }, false) + .SetName("OutputSufficientScenario2"); + + yield return new TestCaseData(new TestStructuresCalculation(), true) + .SetName("NoOutputScenario1"); + + yield return new TestCaseData(new TestStructuresCalculation + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + } + }, true) + .SetName("NoOutputScenario2"); + + yield return new TestCaseData(new TestStructuresCalculation + { + Output = new TestStructuresOutput(new TestGeneralResultFaultTreeIllustrationPoint()) + }, true) + .SetName("OutputWithRedundantGeneralResult"); + + yield return new TestCaseData(new TestStructuresCalculation + { + InputParameters = + { + ShouldIllustrationPointsBeCalculated = true + }, + Output = new TestStructuresOutput() + }, true) + .SetName("OutputWithMissingGeneralResult"); + } } } \ No newline at end of file