Fisheye: Tag 5b29217fb2099ab005ad86d9f53dbd8369210372 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/Helpers/SynchronizeCalculationWithForeshoreProfileHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -r72c1ce6bda4b00156c3f07cf69cb0377825dcb5e -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 72c1ce6bda4b00156c3f07cf69cb0377825dcb5e)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -56,7 +56,6 @@
-
Index: Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj
===================================================================
diff -u -r12cec002453a1828efc68633fbd25219632c6c47 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 12cec002453a1828efc68633fbd25219632c6c47)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/Ringtoets.Common.Service.csproj (.../Ringtoets.Common.Service.csproj) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -49,6 +49,7 @@
+
Index: Ringtoets/Common/src/Ringtoets.Common.Service/SynchronizeCalculationWithForeshoreProfileHelper.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Service/SynchronizeCalculationWithForeshoreProfileHelper.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/SynchronizeCalculationWithForeshoreProfileHelper.cs (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -0,0 +1,66 @@
+// 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 System.Collections.Generic;
+using Core.Common.Base;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.DikeProfiles;
+
+namespace Ringtoets.Common.Service
+{
+ ///
+ /// Helper for updating parameters of calculation input with values taken from
+ /// a .
+ ///
+ public static class SynchronizeCalculationWithForeshoreProfileHelper
+ {
+ ///
+ /// Updates the foreshore profile derived calculation input with values from the
+ /// assigned .
+ ///
+ /// The type of input to update.
+ /// The calculation for which to update the properties of.
+ /// Objects which are affected by input changes are notified.
+ public static void UpdateForeshoreProfileDerivedCalculationInput(ICalculation calculation)
+ where TInput : ICalculationInput, IHasForeshoreProfile
+ {
+ TInput input = calculation.InputParameters;
+ if (input.IsForeshoreProfileInputSynchronized)
+ {
+ return;
+ }
+
+ input.SynchronizeForeshoreProfileInput();
+
+ var affectedObjects = new List
+ {
+ input
+ };
+
+ affectedObjects.AddRange(RingtoetsCommonDataSynchronizationService.ClearCalculationOutput(calculation));
+
+ foreach (IObservable affectedObject in affectedObjects)
+ {
+ affectedObject.NotifyObservers();
+ }
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs
===================================================================
diff -u -r9ff0a37a156186137dbaf5a4d43bc0fab10de1f0 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs (.../StructuresInputBaseTest.cs) (revision 9ff0a37a156186137dbaf5a4d43bc0fab10de1f0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Structures/StructuresInputBaseTest.cs (.../StructuresInputBaseTest.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -637,13 +637,13 @@
[Test]
[TestCaseSource(typeof(ForeshoreProfilePermutationHelper),
- nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameOrientationAndX0),
+ nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameOrientationAndX0),
new object[]
{
"IsForeshoreProfileInputSynchronized",
"ReturnFalse"
})]
- public void IsForeshoreProfileInputSynchronized_ForeshoreProfileAndInputInSync_ReturnTrue(ForeshoreProfile modifiedProfile)
+ public void IsForeshoreProfileInputSynchronized_ForeshoreProfilesOutOfSync_ReturnFalse(ForeshoreProfile modifiedProfile)
{
// Setup
var input = new SimpleStructuresInput
@@ -679,7 +679,7 @@
input.SynchronizeForeshoreProfileInput();
// Assert
- AssertSimpleStructuresInput(null, input);
+ AssertForeshoreProfilePropertiesOfInput(null, input);
}
[Test]
@@ -695,20 +695,20 @@
input.ForeshoreProfile.CopyProperties(differentProfile);
// Precondition
- AssertSimpleStructuresInput(new TestForeshoreProfile(), input);
+ AssertForeshoreProfilePropertiesOfInput(new TestForeshoreProfile(), input);
// Call
input.SynchronizeForeshoreProfileInput();
// Assert
- AssertSimpleStructuresInput(differentProfile, input);
+ AssertForeshoreProfilePropertiesOfInput(differentProfile, input);
}
#endregion
#region Helpers
- private static void AssertSimpleStructuresInput(ForeshoreProfile expectedForeshoreProfile, SimpleStructuresInput input)
+ private static void AssertForeshoreProfilePropertiesOfInput(ForeshoreProfile expectedForeshoreProfile, SimpleStructuresInput input)
{
var defaultInput = new SimpleStructuresInput();
if (expectedForeshoreProfile == null)
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ForeshoreProfilePermutationHelperTest.cs
===================================================================
diff -u -rf411570487c2c859af89b0cefd544386a6a60c15 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ForeshoreProfilePermutationHelperTest.cs (.../ForeshoreProfilePermutationHelperTest.cs) (revision f411570487c2c859af89b0cefd544386a6a60c15)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/ForeshoreProfilePermutationHelperTest.cs (.../ForeshoreProfilePermutationHelperTest.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -37,12 +37,12 @@
const string testResultDescription = "D";
// Call
- List testCaseDatas = ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameAndX0(
+ TestCaseData[] testCaseDatas = ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameAndX0(
targetName,
- testResultDescription).ToList();
+ testResultDescription).ToArray();
// Assert
- Assert.AreEqual(5, testCaseDatas.Count);
+ Assert.AreEqual(5, testCaseDatas.Length);
AssertTestNames(testCaseDatas, targetName, testResultDescription);
AssertProperties(testCaseDatas, true);
}
@@ -55,12 +55,12 @@
const string testResultDescription = "D";
// Call
- List testCaseDatas = ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameOrientationAndX0(
+ TestCaseData[] testCaseDatas = ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameOrientationAndX0(
targetName,
- testResultDescription).ToList();
+ testResultDescription).ToArray();
// Assert
- Assert.AreEqual(4, testCaseDatas.Count);
+ Assert.AreEqual(4, testCaseDatas.Length);
AssertTestNames(testCaseDatas, targetName, testResultDescription);
AssertProperties(testCaseDatas, false);
}
@@ -110,7 +110,6 @@
differentProfiles.Add(profiles.Single(p => p.BreakWater != null
&& p.BreakWater.Type.Equals(BreakWaterType.Caisson)
&& p.BreakWater.Height.Equals(defaultBreakWater.Height)));
-
differentProfiles.Add(profiles.Single(p => p.BreakWater != null
&& p.BreakWater.Type.Equals(BreakWaterType.Wall)
&& p.BreakWater.Height.Equals(defaultBreakWater.Height)));
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ForeshoreProfilePermutationHelper.cs
===================================================================
diff -u -rf411570487c2c859af89b0cefd544386a6a60c15 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ForeshoreProfilePermutationHelper.cs (.../ForeshoreProfilePermutationHelper.cs) (revision f411570487c2c859af89b0cefd544386a6a60c15)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/ForeshoreProfilePermutationHelper.cs (.../ForeshoreProfilePermutationHelper.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -41,15 +41,17 @@
/// A description of the result of the test while using the test case source.
/// The collection of test case data.
///
+ ///
/// [TestCaseSource(typeof(ForeshoreProfilePermutationHelper),
- /// nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameOrientationAndX0),
- /// new object[]
- /// {
- /// "TargetMethodName",
- /// "TestResult"
- /// })]
+ /// nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameAndX0),
+ /// new object[]
+ /// {
+ /// "TargetMethodName",
+ /// "TestResult"
+ /// })]
+ ///
///
- public static IEnumerable DifferentForeshoreProfileWithSameIdNameAndX0(string targetName, string testResultDescription)
+ public static IEnumerable DifferentForeshoreProfilesWithSameIdNameAndX0(string targetName, string testResultDescription)
{
var random = new Random(532);
@@ -71,7 +73,7 @@
.SetName($"{targetName}_differentOrientationProfileConstructionProperties_{testResultDescription}")
};
- testCaseData.AddRange(DifferentForeshoreProfileWithSameIdNameOrientationAndX0(targetName, testResultDescription));
+ testCaseData.AddRange(DifferentForeshoreProfilesWithSameIdNameOrientationAndX0(targetName, testResultDescription));
return testCaseData;
}
@@ -84,15 +86,17 @@
/// A description of the result of the test while using the test case source.
/// The collection of test case data.
///
+ ///
/// [TestCaseSource(typeof(ForeshoreProfilePermutationHelper),
- /// nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameOrientationAndX0),
- /// new object[]
- /// {
- /// "TargetMethodName",
- /// "TestResult"
- /// })]
+ /// nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameOrientationAndX0),
+ /// new object[]
+ /// {
+ /// "TargetMethodName",
+ /// "TestResult"
+ /// })]
+ ///
///
- public static IEnumerable DifferentForeshoreProfileWithSameIdNameOrientationAndX0(string targetName, string testResultDescription)
+ public static IEnumerable DifferentForeshoreProfilesWithSameIdNameOrientationAndX0(string targetName, string testResultDescription)
{
var referenceProfile = new TestForeshoreProfile();
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/SynchronizeCalculationWithForeshoreProfileHelperTest.cs
===================================================================
diff -u -r9a63dd4cf6589ffe683d8e1eb3694afced6efc78 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/SynchronizeCalculationWithForeshoreProfileHelperTest.cs (.../SynchronizeCalculationWithForeshoreProfileHelperTest.cs) (revision 9a63dd4cf6589ffe683d8e1eb3694afced6efc78)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Helpers/SynchronizeCalculationWithForeshoreProfileHelperTest.cs (.../SynchronizeCalculationWithForeshoreProfileHelperTest.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -23,7 +23,7 @@
using Rhino.Mocks;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.DikeProfiles;
-using Ringtoets.Common.Forms.Helpers;
+using Ringtoets.Common.Service;
namespace Ringtoets.Common.Forms.Test.Helpers
{
@@ -35,15 +35,15 @@
{
// Setup
var mocks = new MockRepository();
- var calculationInputMock = mocks.StrictMock();
- calculationInputMock.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(true);
+ var calculationInput = mocks.StrictMock();
+ calculationInput.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(true);
- var calculationMock = mocks.StrictMock>();
- calculationMock.Stub(c => c.InputParameters).Return(calculationInputMock);
+ var calculation = mocks.StrictMock>();
+ calculation.Stub(c => c.InputParameters).Return(calculationInput);
mocks.ReplayAll();
// Call
- SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculationMock);
+ SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculation);
// Assert
mocks.VerifyAll();
@@ -56,23 +56,23 @@
{
// Setup
var mocks = new MockRepository();
- var calculationInputMock = mocks.StrictMock();
- calculationInputMock.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(false);
- calculationInputMock.Expect(ci => ci.SynchronizeForeshoreProfileInput());
- calculationInputMock.Expect(ci => ci.NotifyObservers());
+ var calculationInput = mocks.StrictMock();
+ calculationInput.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(false);
+ calculationInput.Expect(ci => ci.SynchronizeForeshoreProfileInput());
+ calculationInput.Expect(ci => ci.NotifyObservers());
- var calculationMock = mocks.StrictMock>();
- calculationMock.Stub(c => c.InputParameters).Return(calculationInputMock);
- calculationMock.Expect(c => c.HasOutput).Return(hasOutput);
+ var calculation = mocks.StrictMock>();
+ calculation.Stub(c => c.InputParameters).Return(calculationInput);
+ calculation.Expect(c => c.HasOutput).Return(hasOutput);
if (hasOutput)
{
- calculationMock.Expect(c => c.ClearOutput());
- calculationMock.Expect(c => c.NotifyObservers());
+ calculation.Expect(c => c.ClearOutput());
+ calculation.Expect(c => c.NotifyObservers());
}
mocks.ReplayAll();
// Call
- SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculationMock);
+ SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculation);
// Assert
mocks.VerifyAll();
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs
===================================================================
diff -u -rd93d1c16b0543964ba4202f9faa7a74a6cd4a467 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision d93d1c16b0543964ba4202f9faa7a74a6cd4a467)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/TreeNodeInfos/RingtoetsContextMenuItemFactoryTest.cs (.../RingtoetsContextMenuItemFactoryTest.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -101,7 +101,7 @@
var calculationGroupContext = new TestCalculationGroupContext(calculationGroup, failureMechanismMock);
// Call
- StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateAddCalculationItem(calculationGroupContext, context => { });
+ StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateAddCalculationItem(calculationGroupContext, context => {});
// Assert
Assert.AreEqual("Berekening &toevoegen", toolStripItem.Text);
@@ -599,84 +599,65 @@
#region CreateUpdateForeshoreProfileOfCalculationItem
[Test]
- public void CreateUpdateForeshoreProfileOfCalculationItem_WithoutForeshoreProfile_CreatesDisabledItem()
+ [Combinatorial]
+ public void CreateUpdateForeshoreProfileOfCalculationItem_ForeshoreProfileStates_CreatesExpectedItem(
+ [Values(true, false)] bool hasForeshoreProfile,
+ [Values(true, false)] bool isSynchronized)
{
// Setup
var mocks = new MockRepository();
var calculation = mocks.StrictMock>();
- calculation.Expect(c => c.InputParameters.ForeshoreProfile).Return(null);
- var inquiryHelper = mocks.StrictMock();
- mocks.ReplayAll();
+ var input = mocks.StrictMock();
- // Call
- StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationItem(
- calculation,
- inquiryHelper, c => { });
+ if (hasForeshoreProfile)
+ {
+ input.Expect(ci => ci.ForeshoreProfile).Return(new TestForeshoreProfile());
+ input.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(isSynchronized);
+ }
+ else
+ {
+ input.Expect(ci => ci.ForeshoreProfile).Return(null);
+ }
- // Assert
- Assert.AreEqual("&Bijwerken voorlandprofiel...", toolStripItem.Text);
- Assert.AreEqual("Er moet een voorlandprofiel geselecteerd zijn.", toolStripItem.ToolTipText);
- TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.UpdateItemIcon, toolStripItem.Image);
- Assert.IsFalse(toolStripItem.Enabled);
- mocks.VerifyAll();
- }
-
- [Test]
- public void CreateUpdateForeshoreProfileOfCalculationItem_WithForeshoreProfile_CreatesEnabledItem()
- {
- // Setup
- var mocks = new MockRepository();
- var calculation = mocks.StrictMock>();
- var input = mocks.StrictMock();
- input.Expect(i => i.ForeshoreProfile).Return(new TestForeshoreProfile());
- input.Expect(i => i.IsForeshoreProfileInputSynchronized).Return(false);
calculation.Expect(c => c.InputParameters).Return(input).Repeat.Any();
var inquiryHelper = mocks.StrictMock();
mocks.ReplayAll();
// Call
StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationItem(
calculation,
- inquiryHelper, c => { });
+ inquiryHelper, c => {});
// Assert
Assert.AreEqual("&Bijwerken voorlandprofiel...", toolStripItem.Text);
- Assert.AreEqual("Berekening bijwerken met het voorlandprofiel.", toolStripItem.ToolTipText);
TestHelper.AssertImagesAreEqual(RingtoetsFormsResources.UpdateItemIcon, toolStripItem.Image);
- Assert.IsTrue(toolStripItem.Enabled);
- mocks.VerifyAll();
- }
- [Test]
- public void CreateUpdateForeshoreProfileOfCalculationItem_WithoutCalculationOutputPerformClick_PerformsAction()
- {
- // Setup
- var mocks = new MockRepository();
- var calculation = mocks.StrictMock>();
- var input = mocks.StrictMock();
- input.Expect(i => i.ForeshoreProfile).Return(new TestForeshoreProfile());
- input.Expect(i => i.IsForeshoreProfileInputSynchronized).Return(false);
- calculation.Expect(c => c.InputParameters).Return(input).Repeat.Any();
- calculation.Expect(c => c.HasOutput).Return(false);
- var inquiryHelper = mocks.StrictMock();
- mocks.ReplayAll();
+ if (hasForeshoreProfile)
+ {
+ if (isSynchronized)
+ {
+ Assert.AreEqual("Er zijn geen wijzigingen om bij te werken.", toolStripItem.ToolTipText);
+ Assert.IsFalse(toolStripItem.Enabled);
+ }
+ else
+ {
+ Assert.AreEqual("Berekening bijwerken met het voorlandprofiel.", toolStripItem.ToolTipText);
+ Assert.IsTrue(toolStripItem.Enabled);
+ }
+ }
+ else
+ {
+ Assert.AreEqual("Er moet een voorlandprofiel geselecteerd zijn.", toolStripItem.ToolTipText);
+ Assert.IsFalse(toolStripItem.Enabled);
+ }
- ICalculation actionCalculation = null;
- StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationItem(
- calculation,
- inquiryHelper,
- c => { actionCalculation = c; });
-
- // Call
- toolStripItem.PerformClick();
-
- // Assert
- Assert.AreSame(calculation, actionCalculation);
mocks.VerifyAll();
}
[Test]
- public void CreateUpdateForeshoreProfileOfCalculationItem_WithCalculationOutputPerformClickNoContinuation_DoesNotPerformAction()
+ public void CreateUpdateForeshoreProfileOfCalculationItem_WithVariousOutputPerformClick_ExpectedAction(
+ [Values(true, false)] bool hasOutput,
+ [Values(true, false)] bool continuation)
{
// Setup
string inquireContinuationMessage = "Als u kiest voor bijwerken, dan wordt het resultaat van deze berekening " +
@@ -688,54 +669,40 @@
input.Expect(i => i.ForeshoreProfile).Return(new TestForeshoreProfile());
input.Expect(i => i.IsForeshoreProfileInputSynchronized).Return(false);
calculation.Expect(c => c.InputParameters).Return(input).Repeat.Any();
- calculation.Expect(c => c.HasOutput).Return(true);
+ calculation.Expect(c => c.HasOutput).Return(hasOutput);
var inquiryHelper = mocks.StrictMock();
- inquiryHelper.Expect(i => i.InquireContinuation(inquireContinuationMessage)).Return(false);
+ if (hasOutput)
+ {
+ inquiryHelper.Expect(i => i.InquireContinuation(inquireContinuationMessage)).Return(continuation);
+ }
mocks.ReplayAll();
+ ICalculation actionCalculation = null;
var actionPerformed = false;
StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationItem(
calculation,
inquiryHelper,
- c => { actionPerformed = true; });
+ c =>
+ {
+ actionCalculation = c;
+ actionPerformed = true;
+ });
// Call
toolStripItem.PerformClick();
// Assert
- Assert.IsFalse(actionPerformed);
- mocks.VerifyAll();
- }
+ if (hasOutput && !continuation)
+ {
+ Assert.IsFalse(actionPerformed);
+ Assert.IsNull(actionCalculation);
+ }
+ else
+ {
+ Assert.IsTrue(actionPerformed);
+ Assert.AreSame(calculation, actionCalculation);
+ }
- [Test]
- public void CreateUpdateForeshoreProfileOfCalculationItem_WithCalculationOutputPerformClickWithContinuation_PerformsAction()
- {
- // Setup
- string inquireContinuationMessage = "Als u kiest voor bijwerken, dan wordt het resultaat van deze berekening " +
- $"verwijderd.{Environment.NewLine}{Environment.NewLine}Weet u zeker dat u wilt doorgaan?";
-
- var mocks = new MockRepository();
- var calculation = mocks.StrictMock>();
- var input = mocks.StrictMock();
- input.Expect(i => i.ForeshoreProfile).Return(new TestForeshoreProfile());
- input.Expect(i => i.IsForeshoreProfileInputSynchronized).Return(false);
- calculation.Expect(c => c.InputParameters).Return(input).Repeat.Any();
- calculation.Expect(c => c.HasOutput).Return(true);
- var helperMock = mocks.StrictMock();
- helperMock.Expect(i => i.InquireContinuation(inquireContinuationMessage)).Return(true);
- mocks.ReplayAll();
-
- var actionPerformed = false;
- StrictContextMenuItem toolStripItem = RingtoetsContextMenuItemFactory.CreateUpdateForeshoreProfileOfCalculationItem(
- calculation,
- helperMock,
- c => { actionPerformed = true; });
-
- // Call
- toolStripItem.PerformClick();
-
- // Assert
- Assert.IsTrue(actionPerformed);
mocks.VerifyAll();
}
@@ -774,7 +741,7 @@
{
calculation
},
- inquiryHelper, c => { });
+ inquiryHelper, c => {});
// Assert
Assert.AreEqual("&Bijwerken voorlandprofielen...", toolStripItem.Text);
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs
===================================================================
diff -u -rf411570487c2c859af89b0cefd544386a6a60c15 -r5b29217fb2099ab005ad86d9f53dbd8369210372
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs (.../WaveConditionsInputTest.cs) (revision f411570487c2c859af89b0cefd544386a6a60c15)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Data.Test/WaveConditionsInputTest.cs (.../WaveConditionsInputTest.cs) (revision 5b29217fb2099ab005ad86d9f53dbd8369210372)
@@ -312,7 +312,7 @@
[Test]
[TestCaseSource(typeof(ForeshoreProfilePermutationHelper),
- nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfileWithSameIdNameAndX0),
+ nameof(ForeshoreProfilePermutationHelper.DifferentForeshoreProfilesWithSameIdNameAndX0),
new object[]
{
"IsForeshoreProfileInputSynchronized",