Index: Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/CalculationGroup.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/CalculationGroup.cs (.../CalculationGroup.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/CalculationGroup.cs (.../CalculationGroup.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -59,7 +59,7 @@
///
/// Gets the children that define this group.
///
- public IList Children { get; private set; }
+ public IList Children { get; }
public string Name
{
@@ -76,5 +76,10 @@
name = value;
}
}
+
+ public object Clone()
+ {
+ throw new NotImplementedException();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationBase.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationBase.cs (.../ICalculationBase.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Calculation/ICalculationBase.cs (.../ICalculationBase.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -19,14 +19,15 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System;
using Core.Common.Base;
namespace Ringtoets.Common.Data.Calculation
{
///
/// A calculation related item.
///
- public interface ICalculationBase : IObservable
+ public interface ICalculationBase : IObservable, ICloneable
{
///
/// Gets or sets the name of this calculation item.
Index: Ringtoets/Common/src/Ringtoets.Common.Data/Structures/IStructuresCalculation.cs
===================================================================
diff -u -rc59d5c2acab71a0a5f1a179e1a1d394d935ef14b -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/src/Ringtoets.Common.Data/Structures/IStructuresCalculation.cs (.../IStructuresCalculation.cs) (revision c59d5c2acab71a0a5f1a179e1a1d394d935ef14b)
+++ Ringtoets/Common/src/Ringtoets.Common.Data/Structures/IStructuresCalculation.cs (.../IStructuresCalculation.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -19,15 +19,14 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using Ringtoets.Common.Data.Calculation;
namespace Ringtoets.Common.Data.Structures
{
///
/// Interface for structures calculations.
///
- public interface IStructuresCalculation : ICalculation, ICloneable
+ public interface IStructuresCalculation : ICalculation
{
///
/// Gets the output of the structures calculation.
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuBuilder.cs
===================================================================
diff -u -r22c5092409b8d4cf1be4d3ebfdd41169c0e64c14 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuBuilder.cs (.../RingtoetsContextMenuBuilder.cs) (revision 22c5092409b8d4cf1be4d3ebfdd41169c0e64c14)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuBuilder.cs (.../RingtoetsContextMenuBuilder.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -138,7 +138,7 @@
TCalculation calculation,
TCalculationContext calculationContext)
where TCalculationContext : ICalculationContext
- where TCalculation : ICalculation, ICloneable
+ where TCalculation : ICalculation
{
contextMenuBuilder.AddCustomItem(RingtoetsContextMenuItemFactory.CreateDuplicateCalculationItem(calculation, calculationContext));
return this;
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuItemFactory.cs
===================================================================
diff -u -r22c5092409b8d4cf1be4d3ebfdd41169c0e64c14 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuItemFactory.cs (.../RingtoetsContextMenuItemFactory.cs) (revision 22c5092409b8d4cf1be4d3ebfdd41169c0e64c14)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/TreeNodeInfos/RingtoetsContextMenuItemFactory.cs (.../RingtoetsContextMenuItemFactory.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -185,7 +185,7 @@
TCalculation calculation,
TCalculationContext calculationContext)
where TCalculationContext : ICalculationContext
- where TCalculation : ICalculation, ICloneable
+ where TCalculation : ICalculation
{
return new StrictContextMenuItem(
Resources.Duplicate,
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs (.../TestCalculationTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs (.../TestCalculationTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -19,23 +19,92 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using Core.Common.Base;
using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
namespace Ringtoets.Common.Data.TestUtil.Test
{
[TestFixture]
public class TestCalculationTest
{
[Test]
- public void Constructor_WithName_NameSet()
+ public void DefaultConstructor_DefaultValues()
{
// Call
- var calculation = new TestCalculation("Name");
+ var calculation = new TestCalculation();
// Assert
- Assert.AreEqual("Name", calculation.Name);
- Assert.IsFalse(calculation.HasOutput);
+ Assert.IsInstanceOf(calculation);
+ Assert.IsInstanceOf(calculation);
+ Assert.AreEqual("Nieuwe berekening", calculation.Name);
+ Assert.IsNull(calculation.Output);
Assert.IsNull(calculation.Comments);
}
+
+ [Test]
+ public void ParameteredConstructor_ExpectedValues()
+ {
+ // Setup
+ const string name = "Name";
+
+ // Call
+ var calculation = new TestCalculation(name);
+
+ // Assert
+ Assert.IsInstanceOf(calculation);
+ Assert.IsInstanceOf(calculation);
+ Assert.AreEqual(name, calculation.Name);
+ Assert.IsNull(calculation.Output);
+ Assert.IsNull(calculation.Comments);
+ }
+
+ [Test]
+ public void HasOutput_OutputSet_ReturnsTrue()
+ {
+ // Setup
+ var calculation = new TestCalculation
+ {
+ Output = new object()
+ };
+
+ // Call
+ bool calculationHasOutput = calculation.HasOutput;
+
+ // Assert
+ Assert.IsTrue(calculationHasOutput);
+ }
+
+ [Test]
+ public void HasOutput_OutputNull_ReturnsFalse()
+ {
+ // Setup
+ var calculation = new TestCalculation
+ {
+ Output = null
+ };
+
+ // Call
+ bool calculationHasOutput = calculation.HasOutput;
+
+ // Assert
+ Assert.IsFalse(calculationHasOutput);
+ }
+
+ [Test]
+ public void ClearOutput_OutputSet_OutputSetToNull()
+ {
+ // Setup
+ var calculation = new TestCalculation
+ {
+ Output = new object()
+ };
+
+ // Call
+ calculation.ClearOutput();
+
+ // Assert
+ Assert.IsNull(calculation.Output);
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs
===================================================================
diff -u -r2702ecf9aaf678cf869dc330f8ff560b3de4672a -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs (.../TestCalculation.cs) (revision 2702ecf9aaf678cf869dc330f8ff560b3de4672a)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs (.../TestCalculation.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -33,14 +33,36 @@
/// Creates a new .
///
/// The name of the calculation.
- public TestCalculation(string name)
+ public TestCalculation(string name = "Nieuwe berekening")
{
Name = name;
}
+ ///
+ /// Gets or sets an object that represents some output of this calculation.
+ ///
+ public object Output { get; set; }
+
public string Name { get; set; }
- public bool HasOutput { get; set; }
+
public Comment Comments { get; }
- public void ClearOutput() {}
+
+ public bool HasOutput
+ {
+ get
+ {
+ return Output != null;
+ }
+ }
+
+ public void ClearOutput()
+ {
+ Output = null;
+ }
+
+ public object Clone()
+ {
+ return MemberwiseClone();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculationWithForeshoreProfile.cs
===================================================================
diff -u -r3ff98dbb4db7f1269de33c3e972a633ec74169a5 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculationWithForeshoreProfile.cs (.../TestCalculationWithForeshoreProfile.cs) (revision 3ff98dbb4db7f1269de33c3e972a633ec74169a5)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculationWithForeshoreProfile.cs (.../TestCalculationWithForeshoreProfile.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -141,5 +141,10 @@
throw new NotImplementedException();
}
}
+
+ public object Clone()
+ {
+ throw new NotImplementedException();
+ }
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/CalculationChangeHandlerTest.cs
===================================================================
diff -u -r2702ecf9aaf678cf869dc330f8ff560b3de4672a -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/CalculationChangeHandlerTest.cs (.../CalculationChangeHandlerTest.cs) (revision 2702ecf9aaf678cf869dc330f8ff560b3de4672a)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/CalculationChangeHandlerTest.cs (.../CalculationChangeHandlerTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -27,6 +27,7 @@
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.ChangeHandlers;
+using Ringtoets.Common.Forms.TestUtil;
using Ringtoets.Common.IO;
namespace Ringtoets.Common.Forms.Test.ChangeHandlers
@@ -135,11 +136,8 @@
var calculations = new[]
{
- new TestCalculation("Test 1")
- {
- HasOutput = true
- },
- new TestCalculation("Test 2")
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput()
};
var handler = new CalculationChangeHandler(calculations,
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -26,12 +26,12 @@
using Core.Common.Base;
using NUnit.Extensions.Forms;
using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.ChangeHandlers;
using Ringtoets.Common.Forms.PropertyClasses;
using Ringtoets.Common.Forms.TestUtil;
-using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.Common.Forms.Test.ChangeHandlers
{
@@ -58,7 +58,7 @@
TestDelegate test = () => changeHandler.SetPropertyValueAfterConfirmation(
null,
3,
- (f, v) => { });
+ (f, v) => {});
// Assert
string paramName = Assert.Throws(test).ParamName;
@@ -75,7 +75,7 @@
TestDelegate test = () => changeHandler.SetPropertyValueAfterConfirmation(
new TestFailureMechanism(),
null,
- (f, v) => { });
+ (f, v) => {});
// Assert
string paramName = Assert.Throws(test).ParamName;
@@ -160,8 +160,8 @@
tester.ClickCancel();
};
- TestCalculation calculationWithOutput = CalculationTestHelper.CreateCalculationWithOutput();
- TestCalculation calculationWithoutOutput = CalculationTestHelper.CreateCalculationWithoutOutput();
+ ICalculation calculationWithOutput = CalculationTestDataFactory.CreateCalculationWithOutput();
+ ICalculation calculationWithoutOutput = CalculationTestDataFactory.CreateCalculationWithoutOutput();
var testFailureMechanism = new TestFailureMechanism(
new[]
@@ -198,7 +198,7 @@
var testFailureMechanism = new TestFailureMechanism(
new[]
{
- CalculationTestHelper.CreateCalculationWithOutput()
+ CalculationTestDataFactory.CreateCalculationWithOutput()
});
var changeHandler = new FailureMechanismPropertyChangeHandler();
@@ -236,14 +236,14 @@
public class ChangePropertyTestCase
{
- public ChangePropertyTestCase(ICollection calculations)
+ public ChangePropertyTestCase(ICollection calculations)
{
Calculations = calculations;
ExpectedAffectedCalculations = calculations.Where(c => c.HasOutput).ToArray();
}
- public ICollection Calculations { get; }
- public ICollection ExpectedAffectedCalculations { get; }
+ public ICollection Calculations { get; }
+ public ICollection ExpectedAffectedCalculations { get; }
}
private static IEnumerable ChangePropertyTestCases()
@@ -255,47 +255,47 @@
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithOutput()
+ CalculationTestDataFactory.CreateCalculationWithOutput()
})
).SetName("SetPropertyValueAfterConfirmation Single calculation with output");
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithoutOutput()
+ CalculationTestDataFactory.CreateCalculationWithoutOutput()
})
).SetName("SetPropertyValueAfterConfirmation Single calculation without output");
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithoutOutput(),
- CalculationTestHelper.CreateCalculationWithoutOutput()
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput()
})
).SetName("SetPropertyValueAfterConfirmation Two calculations without output");
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithOutput(),
- CalculationTestHelper.CreateCalculationWithoutOutput()
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput()
})
).SetName("SetPropertyValueAfterConfirmation Calculation without and calculation with output");
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithOutput(),
- CalculationTestHelper.CreateCalculationWithOutput()
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithOutput()
})
).SetName("SetPropertyValueAfterConfirmation Two calculations with output");
yield return new TestCaseData(
new ChangePropertyTestCase(new[]
{
- CalculationTestHelper.CreateCalculationWithOutput(),
- CalculationTestHelper.CreateCalculationWithOutput(),
- CalculationTestHelper.CreateCalculationWithoutOutput()
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput()
})
).SetName("SetPropertyValueAfterConfirmation Two calculations with and one calculation without output");
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/ObservablePropertyChangeHandlerTest.cs
===================================================================
diff -u -rb3b6c13cf736c134476b3db34281332d01ca86b1 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/ObservablePropertyChangeHandlerTest.cs (.../ObservablePropertyChangeHandlerTest.cs) (revision b3b6c13cf736c134476b3db34281332d01ca86b1)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/ObservablePropertyChangeHandlerTest.cs (.../ObservablePropertyChangeHandlerTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -25,6 +25,8 @@
using Core.Common.Base;
using NUnit.Extensions.Forms;
using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.ChangeHandlers;
using Ringtoets.Common.Forms.PropertyClasses;
using Ringtoets.Common.Forms.TestUtil;
@@ -141,7 +143,7 @@
tester.ClickCancel();
};
- TestCalculation calculation = CalculationTestHelper.CreateCalculationWithOutput();
+ ICalculation calculation = CalculationTestDataFactory.CreateCalculationWithOutput();
var propertySet = 0;
@@ -169,7 +171,7 @@
tester.ClickOk();
};
- TestCalculation calculation = CalculationTestHelper.CreateCalculationWithOutput();
+ ICalculation calculation = CalculationTestDataFactory.CreateCalculationWithOutput();
var changeHandler = new ObservablePropertyChangeHandler(calculation, new TestCalculationInput());
var expectedException = new Exception();
@@ -186,7 +188,7 @@
public void SetPropertyValueAfterConfirmation_ConfirmationNotRequiredExceptionInSetValue_ExceptionBubbled()
{
// Setup
- TestCalculation calculation = CalculationTestHelper.CreateCalculationWithoutOutput();
+ ICalculation calculation = CalculationTestDataFactory.CreateCalculationWithoutOutput();
var changeHandler = new ObservablePropertyChangeHandler(calculation, new TestCalculationInput());
var expectedException = new Exception();
@@ -201,22 +203,22 @@
public class ChangePropertyTestCase
{
- public ChangePropertyTestCase(TestCalculation calculation)
+ public ChangePropertyTestCase(ICalculation calculation)
{
Calculation = calculation;
}
- public TestCalculation Calculation { get; }
+ public ICalculation Calculation { get; }
}
private static IEnumerable ChangePropertyTestCases()
{
yield return new TestCaseData(
- new ChangePropertyTestCase(CalculationTestHelper.CreateCalculationWithOutput())
+ new ChangePropertyTestCase(CalculationTestDataFactory.CreateCalculationWithOutput())
).SetName("SetPropertyValueAfterConfirmation calculation with output");
yield return new TestCaseData(
- new ChangePropertyTestCase(CalculationTestHelper.CreateCalculationWithoutOutput())
+ new ChangePropertyTestCase(CalculationTestDataFactory.CreateCalculationWithoutOutput())
).SetName("SetPropertyValueAfterConfirmation calculation without output");
}
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs
===================================================================
diff -u -r38414ee18cb869ba91e6b70abc4019a39ea2e08c -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision 38414ee18cb869ba91e6b70abc4019a39ea2e08c)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/FailureMechanismSectionResultRowHelperTest.cs (.../FailureMechanismSectionResultRowHelperTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -22,13 +22,12 @@
using System;
using System.Collections;
using System.Windows.Forms;
-using Core.Common.Base;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Forms.TestUtil;
namespace Ringtoets.Common.Forms.Test.Helpers
{
@@ -78,44 +77,6 @@
private class TestDataGridViewCell : DataGridViewCell {}
- private class CalculationWithOutput : ICalculation
- {
- public string Name { get; set; }
- public Comment Comments { get; private set; }
-
- public bool HasOutput
- {
- get
- {
- return true;
- }
- }
-
- public void Attach(IObserver observer) {}
- public void Detach(IObserver observer) {}
- public void NotifyObservers() {}
- public void ClearOutput() {}
- }
-
- private class CalculationWithoutOutput : ICalculation
- {
- public string Name { get; set; }
- public Comment Comments { get; private set; }
-
- public bool HasOutput
- {
- get
- {
- return false;
- }
- }
-
- public void Attach(IObserver observer) {}
- public void Detach(IObserver observer) {}
- public void NotifyObservers() {}
- public void ClearOutput() {}
- }
-
#region Testcases
private static IEnumerable AssessmentLayerOneStateIsSufficient()
@@ -131,17 +92,21 @@
.SetName("SufficientWithValidLayerTwoAAndNoCalculation");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, double.NaN,
- new CalculationWithOutput(), string.Empty)
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ string.Empty)
.SetName("SufficientWithInvalidLayerTwoAAndCalculationWithOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, 0.0,
- new CalculationWithOutput(), string.Empty)
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ string.Empty)
.SetName("SufficientWithValidLayerTwoAAndCalculationWithOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, double.NaN,
- new CalculationWithoutOutput(), string.Empty)
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
+ string.Empty)
.SetName("SufficientWithInvalidLayerTwoAAndCalculationWithoutOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.Sufficient, 0.0,
- new CalculationWithoutOutput(), string.Empty)
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
+ string.Empty)
.SetName("SufficientWithValidLayerTwoAAndCalculationWithoutOutput");
}
@@ -175,19 +140,20 @@
};
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, double.NaN,
- new CalculationWithoutOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
"De maatgevende berekening voor dit vak moet nog worden uitgevoerd.")
.SetName("NotAssessedWithInvalidLayerTwoAAndCalculationWithoutOutput");
- yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0, new CalculationWithoutOutput(),
+ yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0,
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
"De maatgevende berekening voor dit vak moet nog worden uitgevoerd.")
.SetName("NotAssessedWithValidLayerTwoAAndCalculationWithoutOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, double.NaN,
- new CalculationWithoutOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
"De maatgevende berekening voor dit vak moet nog worden uitgevoerd.")
.SetName("NeedsDetailedAssessmentWithInvalidLayerTwoAAndCalculationWithoutOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, 0.0,
- new CalculationWithoutOutput(),
+ CalculationTestDataFactory.CreateCalculationWithoutOutput(),
"De maatgevende berekening voor dit vak moet nog worden uitgevoerd.")
.SetName("NeedsDetailedAssessmentValidLayerTwoAAndCalculationWithoutOutput");
}
@@ -200,19 +166,21 @@
};
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, double.NaN,
- new CalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
"De maatgevende berekening voor dit vak moet een geldige uitkomst hebben.")
.SetName("NotAssessedWithInvalidLayerTwoAAndCalculationWithOutput");
- yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0, new CalculationWithOutput(),
+ yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NotAssessed, 0.0,
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
string.Empty)
.SetName("NotAssessedWithValidLayerTwoAAndCalculationWithOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, double.NaN,
- new CalculationWithOutput(),
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
"De maatgevende berekening voor dit vak moet een geldige uitkomst hebben.")
.SetName("NeedsDetailedAssessmentWithInvalidLayerTwoAAndCalculationWithOutput");
yield return new TestCaseData(dataGridViewCell, AssessmentLayerOneState.NoVerdict, 0.0,
- new CalculationWithOutput(), string.Empty)
+ CalculationTestDataFactory.CreateCalculationWithOutput(),
+ string.Empty)
.SetName("NeedsDetailedAssessmentWithValidLayerTwoAAndCalculationWithOutput");
}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs
===================================================================
diff -u -rb9dd4faf4090750278254ff3fcfa162754a9e454 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs (.../RingtoetsContextMenuBuilderTest.cs) (revision b9dd4faf4090750278254ff3fcfa162754a9e454)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuBuilderTest.cs (.../RingtoetsContextMenuBuilderTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -19,7 +19,6 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
-using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
@@ -32,7 +31,6 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
@@ -810,8 +808,8 @@
var exportCommandHandler = mocks.StrictMock();
var updateCommandHandler = mocks.StrictMock();
var viewCommands = mocks.StrictMock();
- var calculation = mocks.Stub();
- var calculationContext = mocks.Stub>();
+ var calculation = mocks.Stub();
+ var calculationContext = mocks.Stub>();
mocks.ReplayAll();
@@ -1867,32 +1865,8 @@
public IFailureMechanism FailureMechanism { get; }
}
- private class TestCalculation : Observable, ICalculation
- {
- public TestCalculation()
- {
- Name = "Nieuwe berekening";
- }
-
- public string Name { get; set; }
-
- public Comment Comments { get; private set; }
-
- public bool HasOutput
- {
- get
- {
- return false;
- }
- }
-
- public void ClearOutput() {}
- }
-
public interface ICalculationInputWithForeshoreProfile : ICalculationInput, IHasForeshoreProfile {}
- public interface ICloneableCalculation : ICalculation, ICloneable { }
-
#endregion
}
}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs
===================================================================
diff -u -rb9dd4faf4090750278254ff3fcfa162754a9e454 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision b9dd4faf4090750278254ff3fcfa162754a9e454)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -30,7 +30,6 @@
using NUnit.Extensions.Forms;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
@@ -605,7 +604,7 @@
{
get
{
- var calculation = new TestCloneableCalculation
+ var calculation = new TestCalculation
{
Name = "Nieuwe berekening"
};
@@ -656,8 +655,8 @@
{
// Setup
var mocks = new MockRepository();
- var calculation = mocks.Stub();
- var calculationContext = mocks.Stub>();
+ var calculation = mocks.Stub();
+ var calculationContext = mocks.Stub>();
mocks.ReplayAll();
// Call
@@ -674,13 +673,13 @@
[Test]
[TestCaseSource(nameof(CalculationGroupConfigurations))]
- public void CreateDuplicateCalculationItem_PerformClickOnCreatedItem_DuplicatesCalculationWithExpectedNameAndPosition(TestCloneableCalculation calculation,
+ public void CreateDuplicateCalculationItem_PerformClickOnCreatedItem_DuplicatesCalculationWithExpectedNameAndPosition(TestCalculation calculation,
CalculationGroup calculationGroup,
string expectedCalculationName)
{
// Setup
var mocks = new MockRepository();
- var calculationContext = mocks.Stub>();
+ var calculationContext = mocks.Stub>();
calculationContext.Stub(c => c.Parent).Return(calculationGroup);
@@ -702,36 +701,6 @@
mocks.VerifyAll();
}
- public interface ICloneableCalculation : ICalculation, ICloneable {}
-
- public class TestCloneableCalculation : Observable, ICloneableCalculation
- {
- public string Name { get; set; }
-
- public bool HasOutput
- {
- get
- {
- return false;
- }
- }
-
- public Comment Comments
- {
- get
- {
- return null;
- }
- }
-
- public void ClearOutput() {}
-
- public object Clone()
- {
- return MemberwiseClone();
- }
- }
-
#endregion
#region CreateUpdateForeshoreProfileOfCalculationItem
@@ -1749,28 +1718,6 @@
public IFailureMechanism FailureMechanism { get; }
}
- private class TestCalculation : Observable, ICalculation
- {
- public TestCalculation()
- {
- Name = "Nieuwe berekening";
- }
-
- public string Name { get; set; }
-
- public Comment Comments { get; private set; }
-
- public bool HasOutput
- {
- get
- {
- return false;
- }
- }
-
- public void ClearOutput() {}
- }
-
public interface ICalculationInputWithForeshoreProfile : ICalculationInput, IHasForeshoreProfile {}
#endregion
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsTreeNodeInfoFactoryTest.cs
===================================================================
diff -u -re74c57e402614c4fb76622b00011d111a92b6696 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsTreeNodeInfoFactoryTest.cs (.../RingtoetsTreeNodeInfoFactoryTest.cs) (revision e74c57e402614c4fb76622b00011d111a92b6696)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsTreeNodeInfoFactoryTest.cs (.../RingtoetsTreeNodeInfoFactoryTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -28,10 +28,10 @@
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TreeNodeInfos;
using RingtoetsFormsResources = Ringtoets.Common.Forms.Properties.Resources;
@@ -1086,28 +1086,6 @@
public IFailureMechanism FailureMechanism { get; }
}
- private class TestCalculation : Observable, ICalculation
- {
- public TestCalculation()
- {
- Name = "Nieuwe berekening";
- }
-
- public string Name { get; set; }
-
- public Comment Comments { get; private set; }
-
- public bool HasOutput
- {
- get
- {
- return false;
- }
- }
-
- public void ClearOutput() {}
- }
-
private class TestFailureMechanismContext : FailureMechanismContext
{
public TestFailureMechanismContext(IFailureMechanism wrappedFailureMechanism, IAssessmentSection parent) : base(wrappedFailureMechanism, parent) {}
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs
===================================================================
diff -u -rfe90a6d174a01975381e6cda55ed1f7f4e831a51 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision fe90a6d174a01975381e6cda55ed1f7f4e831a51)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Views/GeneralResultFaultTreeIllustrationPointViewTest.cs (.../GeneralResultFaultTreeIllustrationPointViewTest.cs) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -29,6 +29,7 @@
using Rhino.Mocks;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.IllustrationPoints;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.Data.TestUtil.IllustrationPoints;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.Forms.TestUtil;
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/CalculationTestDataFactoryTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/CalculationTestDataFactoryTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/CalculationTestDataFactoryTest.cs (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -0,0 +1,50 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+
+namespace Ringtoets.Common.Forms.TestUtil.Test
+{
+ [TestFixture]
+ public class CalculationTestDataFactoryTest
+ {
+ [Test]
+ public void CreateCalculationWithoutOutput_Always_ReturnCalculationWithoutOutput()
+ {
+ // Call
+ ICalculation calculation = CalculationTestDataFactory.CreateCalculationWithoutOutput();
+
+ // Assert
+ Assert.IsFalse(calculation.HasOutput);
+ }
+
+ [Test]
+ public void CreateCalculationWithOutput_Always_ReturnCalculationWithOutput()
+ {
+ // Call
+ ICalculation calculation = CalculationTestDataFactory.CreateCalculationWithOutput();
+
+ // Assert
+ Assert.IsTrue(calculation.HasOutput);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 17b11c850b35c3ea99150ba25098b5b769b58f4f refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/CalculationTestHelperTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj
===================================================================
diff -u -r7b7bd75dc1c1327386c9be96b5d480565bb8ecd6 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj (.../Ringtoets.Common.Forms.TestUtil.Test.csproj) (revision 7b7bd75dc1c1327386c9be96b5d480565bb8ecd6)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/Ringtoets.Common.Forms.TestUtil.Test.csproj (.../Ringtoets.Common.Forms.TestUtil.Test.csproj) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -51,15 +51,14 @@
Properties\GlobalAssembly.cs
-
+
-
Fisheye: Tag 17b11c850b35c3ea99150ba25098b5b769b58f4f refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil.Test/TestCalculationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/CalculationTestDataFactory.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/CalculationTestDataFactory.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/CalculationTestDataFactory.cs (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -0,0 +1,53 @@
+// Copyright (C) Stichting Deltares 2017. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
+
+namespace Ringtoets.Common.Forms.TestUtil
+{
+ ///
+ /// Factory for creating test calculation objects.
+ ///
+ public static class CalculationTestDataFactory
+ {
+ ///
+ /// Creates a test calculation without output.
+ ///
+ /// The created calculation.
+ public static ICalculation CreateCalculationWithoutOutput()
+ {
+ return new TestCalculation();
+ }
+
+ ///
+ /// Creates a test calculation with output.
+ ///
+ /// The created calculation.
+ public static ICalculation CreateCalculationWithOutput()
+ {
+ return new TestCalculation
+ {
+ Output = new object()
+ };
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 17b11c850b35c3ea99150ba25098b5b769b58f4f refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/CalculationTestHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj
===================================================================
diff -u -r7b7bd75dc1c1327386c9be96b5d480565bb8ecd6 -r17b11c850b35c3ea99150ba25098b5b769b58f4f
--- Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj (.../Ringtoets.Common.Forms.TestUtil.csproj) (revision 7b7bd75dc1c1327386c9be96b5d480565bb8ecd6)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.TestUtil/Ringtoets.Common.Forms.TestUtil.csproj (.../Ringtoets.Common.Forms.TestUtil.csproj) (revision 17b11c850b35c3ea99150ba25098b5b769b58f4f)
@@ -51,14 +51,13 @@
Properties\GlobalAssembly.cs
-
+
-
@@ -96,6 +95,10 @@
{4D840673-3812-4338-A352-84854E32B8A0}
Ringtoets.Common.Forms
+
+ {4843D6E5-066F-4795-94F5-1D53932DD03C}
+ Ringtoets.Common.Data.TestUtil
+