Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocationCalculation.cs
===================================================================
diff -u -rf515fbd73e83548678552ed9e637957e1db0a3d0 -rbae137524febd2b8418ea3ceb47a6330d3c53c1e
--- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocationCalculation.cs (.../DuneLocationCalculation.cs) (revision f515fbd73e83548678552ed9e637957e1db0a3d0)
+++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Data/DuneLocationCalculation.cs (.../DuneLocationCalculation.cs) (revision bae137524febd2b8418ea3ceb47a6330d3c53c1e)
@@ -21,13 +21,14 @@
using System;
using Core.Common.Base;
+using Ringtoets.Common.Data.Calculation;
namespace Ringtoets.DuneErosion.Data
{
///
/// Adapter class for a dune location calculation.
///
- public class DuneLocationCalculation : Observable
+ public class DuneLocationCalculation : Observable, ICalculatable
{
///
/// Creates a new instance of .
@@ -54,5 +55,13 @@
/// Gets the dune location the calculation belongs to.
///
public DuneLocation DuneLocation { get; }
+
+ public bool ShouldCalculate
+ {
+ get
+ {
+ return Output == null;
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationCalculationTest.cs
===================================================================
diff -u -re5e17b215166c0d4451d922e477cc4d0a4c15205 -rbae137524febd2b8418ea3ceb47a6330d3c53c1e
--- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationCalculationTest.cs (.../DuneLocationCalculationTest.cs) (revision e5e17b215166c0d4451d922e477cc4d0a4c15205)
+++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Data.Test/DuneLocationCalculationTest.cs (.../DuneLocationCalculationTest.cs) (revision bae137524febd2b8418ea3ceb47a6330d3c53c1e)
@@ -22,6 +22,7 @@
using System;
using Core.Common.Base;
using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.DuneErosion.Data.TestUtil;
namespace Ringtoets.DuneErosion.Data.Test
@@ -50,9 +51,42 @@
var calculation = new DuneLocationCalculation(duneLocation);
// Assert
+ Assert.IsInstanceOf(calculation);
Assert.IsInstanceOf(calculation);
Assert.AreSame(duneLocation, calculation.DuneLocation);
Assert.IsNull(calculation.Output);
}
+
+ [Test]
+ public void ShouldCalculate_OutputNull_ReturnsTrue()
+ {
+ // Setup
+ var calculation = new DuneLocationCalculation(new TestDuneLocation())
+ {
+ Output = null
+ };
+
+ // Call
+ bool shouldCalculate = calculation.ShouldCalculate;
+
+ // Assert
+ Assert.IsTrue(shouldCalculate);
+ }
+
+ [Test]
+ public void ShouldCalculate_OutputSet_ReturnsFalse()
+ {
+ // Setup
+ var calculation = new DuneLocationCalculation(new TestDuneLocation())
+ {
+ Output = new TestDuneLocationCalculationOutput()
+ };
+
+ // Call
+ bool shouldCalculate = calculation.ShouldCalculate;
+
+ // Assert
+ Assert.IsFalse(shouldCalculate);
+ }
}
}
\ No newline at end of file