Index: Core/Common/src/Core.Common.Base/Service/Activity.cs
===================================================================
diff -u -rf555a1dfa9735c55723ef3da1a07e5ed811ed3ab -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Core/Common/src/Core.Common.Base/Service/Activity.cs (.../Activity.cs) (revision f555a1dfa9735c55723ef3da1a07e5ed811ed3ab)
+++ Core/Common/src/Core.Common.Base/Service/Activity.cs (.../Activity.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -122,6 +122,32 @@
}
///
+ /// Logs the current state of the .
+ ///
+ public void LogState()
+ {
+ if (State == ActivityState.Executed)
+ {
+ log.InfoFormat(Resources.Activity_Finish_ActivityDescription_0_has_succeeded, Description);
+ }
+
+ if (State == ActivityState.Canceled)
+ {
+ log.WarnFormat(Resources.Activity_Finish_ActivityDescription_0_has_been_canceled, Description);
+ }
+
+ if (State == ActivityState.Failed)
+ {
+ log.ErrorFormat(Resources.Activity_Finish_ActivityDescription_0_has_failed, Description);
+ }
+
+ if (State == ActivityState.Skipped)
+ {
+ log.InfoFormat(Resources.Activity_Finish_ActivityDescription_0_has_been_skipped, Description);
+ }
+ }
+
+ ///
/// This template method provides the actual run logic (it is called within ).
///
///
@@ -173,31 +199,5 @@
State = stateAfter;
}
-
- ///
- /// This method will log the current state of the .
- ///
- public void LogState()
- {
- if (State == ActivityState.Executed)
- {
- log.InfoFormat(Resources.Activity_Finish_ActivityDescription_0_has_succeeded, Description);
- }
-
- if (State == ActivityState.Canceled)
- {
- log.WarnFormat(Resources.Activity_Finish_ActivityDescription_0_has_been_canceled, Description);
- }
-
- if (State == ActivityState.Failed)
- {
- log.ErrorFormat(Resources.Activity_Finish_ActivityDescription_0_has_failed, Description);
- }
-
- if (State == ActivityState.Skipped)
- {
- log.InfoFormat(Resources.Activity_Finish_ActivityDescription_0_has_been_skipped, Description);
- }
- }
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Gui.Test/OpenProjectActivityTest.cs
===================================================================
diff -u -r941a7876bd3f1621458889c9fb101229033ed8ff -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Core/Common/test/Core.Common.Gui.Test/OpenProjectActivityTest.cs (.../OpenProjectActivityTest.cs) (revision 941a7876bd3f1621458889c9fb101229033ed8ff)
+++ Core/Common/test/Core.Common.Gui.Test/OpenProjectActivityTest.cs (.../OpenProjectActivityTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -658,7 +658,7 @@
}
[Test]
- public void GivenActivity_WhenActivityExecutedSuccessfully_ThenProjectOwnerAndNewProjectUpdatedWithLogMessage()
+ public void GivenExecutedOpenProjectActivity_WhenFinishingOpenProjectActivity_ThenProjectOwnerAndNewProjectUpdatedWithLogMessage()
{
// Given
const string someFilePath = @"c:\\folder\someFilePath.rtd";
@@ -710,7 +710,7 @@
}
[Test]
- public void GivenOpenProjectActivity_WhenActivityFailedDueToNoProject_ThenProjectOwnerHasNewEmptyProjectWithLogMessage()
+ public void GivenOpenProjectActivityAndFailedDueToNoProject_WhenFinishingOpenProjectActivity_ThenProjectOwnerHasNewEmptyProjectWithLogMessage()
{
// Given
const string someFilePath = @"c:\\folder\someFilePath.rtd";
@@ -762,19 +762,16 @@
}
[Test]
- [TestCase(true)]
- [TestCase(false)]
- public void GivenActivity_WhenActivityFailedDueToException_ThenProjectOwnerHasNewEmptyProjectWithLogMessage(bool trueForStorageExceptionFalseForArgumentException)
+ [TestCaseSource(nameof(ExceptionCases))]
+ public void GivenOpenProjectActivityFailedDueToException_WhenFinishingOpenProjectActivity_ThenProjectOwnerHasNewEmptyProjectWithLogMessage(Exception exceptionToThrow)
{
// Given
const string someFilePath = @"c:\\folder\someFilePath.rtd";
- Exception exception = trueForStorageExceptionFalseForArgumentException ? (Exception) new StorageException() : new ArgumentException();
-
var mocks = new MockRepository();
var projectStorage = mocks.Stub();
projectStorage.Stub(ps => ps.LoadProject(someFilePath))
- .Throw(exception);
+ .Throw(exceptionToThrow);
var project = mocks.Stub();
@@ -1228,5 +1225,11 @@
Assert.AreEqual(ActivityState.Canceled, activity.State);
mocks.VerifyAll();
}
+
+ private static IEnumerable ExceptionCases()
+ {
+ yield return new TestCaseData(new StorageException());
+ yield return new TestCaseData(new ArgumentException());
+ }
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Gui.Test/SaveProjectActivityTest.cs
===================================================================
diff -u -r941a7876bd3f1621458889c9fb101229033ed8ff -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Core/Common/test/Core.Common.Gui.Test/SaveProjectActivityTest.cs (.../SaveProjectActivityTest.cs) (revision 941a7876bd3f1621458889c9fb101229033ed8ff)
+++ Core/Common/test/Core.Common.Gui.Test/SaveProjectActivityTest.cs (.../SaveProjectActivityTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -149,6 +149,7 @@
storeProject.Expect(sp => sp.StageProject(project));
storeProject.Expect(sp => sp.SaveProjectAs(filePath));
}
+
mocks.ReplayAll();
var activity = new SaveProjectActivity(project, filePath, saveExistingProject, storeProject, projectOwner);
@@ -275,6 +276,7 @@
storeProject.Expect(sp => sp.StageProject(project));
storeProject.Expect(sp => sp.SaveProjectAs(filePath));
}
+
mocks.ReplayAll();
var progressMessages = new List();
@@ -293,7 +295,7 @@
// Assert
int totalSteps = saveExistingProject ? 2 : 3;
- var expectedProgressMessages = new[]
+ string[] expectedProgressMessages =
{
$"Stap 1 van {totalSteps} | Voorbereidingen opslaan",
$"Stap 2 van {totalSteps} | Project opslaan"
@@ -334,7 +336,7 @@
// Assert
int totalSteps = saveExistingProject ? 1 : 2;
- var expectedProgressMessages = new[]
+ string[] expectedProgressMessages =
{
$"Stap 1 van {totalSteps} | Project opslaan"
};
@@ -343,7 +345,7 @@
}
[Test]
- public void GivenActivity_WhenSuccessfullySavedNewProject_ThenUpdateProjectAndProjectOwnerWithMessage()
+ public void GivenSaveProjectActivityAndSuccessfullySavedNewProject_WhenFinishingSaveProjectActivity_ThenUpdateProjectAndProjectOwnerWithMessage()
{
// Given
const string fileName = "A";
@@ -366,7 +368,8 @@
Assert.AreEqual(ActivityState.Executed, activity.State);
// When
- Action call = () => {
+ Action call = () =>
+ {
activity.LogState();
activity.Finish();
};
@@ -381,7 +384,7 @@
}
[Test]
- public void GivenActivity_WhenSuccessfullySavedExistingProject_ThenDoNotUpdateProjectAndProjectOwnerWithMessage()
+ public void GivenSaveProjectActivityAndSuccessfullySavedExistingProject_WhenFinishingSaveProjectActivity_ThenDoNotUpdateProjectAndProjectOwnerWithMessage()
{
// Given
const string fileName = "A";
@@ -453,7 +456,7 @@
// Assert
int totalSteps = hasStagedProject ? 2 : 3;
- var expectedProgressMessages = new[]
+ string[] expectedProgressMessages =
{
$"Stap {totalSteps} van {totalSteps} | Initialiseren van opgeslagen project"
};
@@ -480,6 +483,7 @@
storeProject.Expect(sp => sp.SaveProjectAs(filePath))
.Repeat.Never();
}
+
mocks.ReplayAll();
var activity = new SaveProjectActivity(project, filePath, saveExistingProject, storeProject, projectOwner);
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -876,13 +876,13 @@
hydraulicBoundaryLocation
}, true);
- MacroStabilityInwardsCalculationScenario validCalculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
- validCalculation.Name = "A";
- MacroStabilityInwardsCalculationScenario invalidCalculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithInvalidInput();
- invalidCalculation.Name = "B";
+ MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationA.Name = "A";
+ MacroStabilityInwardsCalculationScenario calculationB = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationB.Name = "B";
var childGroup = new CalculationGroup();
- childGroup.Children.Add(validCalculation);
+ childGroup.Children.Add(calculationA);
var emptyChildGroup = new CalculationGroup();
@@ -891,7 +891,7 @@
group.Children.Add(childGroup);
group.Children.Add(emptyChildGroup);
- group.Children.Add(invalidCalculation);
+ group.Children.Add(calculationB);
var failureMechanism = new TestMacroStabilityInwardsFailureMechanism();
var nodeData = new MacroStabilityInwardsCalculationGroupContext(group,
@@ -916,6 +916,7 @@
plugin.Gui = gui;
+ using (new MacroStabilityInwardsCalculatorFactoryConfig())
using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl))
{
DialogBoxHandler = (name, wnd) =>
@@ -924,11 +925,29 @@
};
// Call
- contextMenu.Items[contextMenuCalculateAllIndexNestedGroup].PerformClick();
+ Action call = () => contextMenu.Items[contextMenuCalculateAllIndexNestedGroup].PerformClick();
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(12, msgs.Length);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gestart.", msgs[0]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[4]);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gelukt.", msgs[5]);
+
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gestart.", msgs[6]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[7]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[8]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[9]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[10]);
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gelukt.", msgs[11]);
+ });
}
}
-
- // Assert
}
[Test]
@@ -1124,7 +1143,7 @@
new Point3D(5.0, -5.0, 0.0)
});
- var surfaceLines = new[]
+ MacroStabilityInwardsSurfaceLine[] surfaceLines =
{
surfaceLine1,
surfaceLine2
@@ -1233,7 +1252,7 @@
new Point3D(5.0, -5.0, 0.0)
});
- var surfaceLines = new[]
+ MacroStabilityInwardsSurfaceLine[] surfaceLines =
{
surfaceLine1,
surfaceLine2
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -rdf515d3faf8f4db7a4b3358ad9d69092e5e9a8e3 -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision df515d3faf8f4db7a4b3358ad9d69092e5e9a8e3)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -731,13 +731,13 @@
hydraulicBoundaryLocation
}, true);
- MacroStabilityInwardsCalculationScenario validCalculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
- validCalculation.Name = "A";
- MacroStabilityInwardsCalculationScenario invalidCalculation = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithInvalidInput();
- invalidCalculation.Name = "B";
+ MacroStabilityInwardsCalculationScenario calculationA = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationA.Name = "A";
+ MacroStabilityInwardsCalculationScenario calculationB = MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationB.Name = "B";
- failureMechanism.CalculationsGroup.Children.Add(validCalculation);
- failureMechanism.CalculationsGroup.Children.Add(invalidCalculation);
+ failureMechanism.CalculationsGroup.Children.Add(calculationA);
+ failureMechanism.CalculationsGroup.Children.Add(calculationB);
var failureMechanismContext = new MacroStabilityInwardsFailureMechanismContext(failureMechanism, assessmentSection);
@@ -756,15 +756,33 @@
// Expect an activity dialog which is automatically closed
};
+ using (new MacroStabilityInwardsCalculatorFactoryConfig())
using (ContextMenuStrip contextMenu = info.ContextMenuStrip(failureMechanismContext, null, treeViewControl))
{
// Call
- contextMenu.Items[contextMenuCalculateAllIndex].PerformClick();
+ Action call = () => contextMenu.Items[contextMenuCalculateAllIndex].PerformClick();
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(12, msgs.Length);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gestart.", msgs[0]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[4]);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gelukt.", msgs[5]);
+
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gestart.", msgs[6]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[7]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[8]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[9]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[10]);
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gelukt.", msgs[11]);
+ });
}
}
-
- // Assert
- // Assert expectancies are called in TearDown()
}
[Test]
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r6f33b44599df032ecae3342b0aacd606a9e87c1f -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 6f33b44599df032ecae3342b0aacd606a9e87c1f)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -1064,13 +1064,13 @@
hydraulicBoundaryLocation
}, true);
- PipingCalculationScenario validCalculation = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
- validCalculation.Name = "A";
- PipingCalculationScenario invalidCalculation = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithInvalidInput();
- invalidCalculation.Name = "B";
+ PipingCalculationScenario calculationA = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationA.Name = "A";
+ PipingCalculationScenario calculationB = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationB.Name = "B";
var childGroup = new CalculationGroup();
- childGroup.Children.Add(validCalculation);
+ childGroup.Children.Add(calculationA);
var emptyChildGroup = new CalculationGroup();
@@ -1079,7 +1079,7 @@
group.Children.Add(childGroup);
group.Children.Add(emptyChildGroup);
- group.Children.Add(invalidCalculation);
+ group.Children.Add(calculationB);
var nodeData = new PipingCalculationGroupContext(group,
parentGroup,
@@ -1111,11 +1111,29 @@
};
// Call
- contextMenu.Items[contextMenuCalculateAllIndexNestedGroup].PerformClick();
+ Action call = () => contextMenu.Items[contextMenuCalculateAllIndexNestedGroup].PerformClick();
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(12, msgs.Length);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gestart.", msgs[0]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[4]);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gelukt.", msgs[5]);
+
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gestart.", msgs[6]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[7]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[8]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[9]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[10]);
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gelukt.", msgs[11]);
+ });
}
}
-
- // Assert
}
[Test]
@@ -1310,7 +1328,7 @@
new Point3D(5.0, -5.0, 0.0)
});
- var surfaceLines = new[]
+ PipingSurfaceLine[] surfaceLines =
{
surfaceLine1,
surfaceLine2
@@ -1424,7 +1442,7 @@
new Point3D(5.0, -5.0, 0.0)
});
- var surfaceLines = new[]
+ PipingSurfaceLine[] surfaceLines =
{
surfaceLine1,
surfaceLine2
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs
===================================================================
diff -u -rdf515d3faf8f4db7a4b3358ad9d69092e5e9a8e3 -r5b20289ad0f8db0519a812c65a7fcf1d3d58465d
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision df515d3faf8f4db7a4b3358ad9d69092e5e9a8e3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismContextTreeNodeInfoTest.cs (.../PipingFailureMechanismContextTreeNodeInfoTest.cs) (revision 5b20289ad0f8db0519a812c65a7fcf1d3d58465d)
@@ -732,13 +732,13 @@
hydraulicBoundaryLocation
}, true);
- PipingCalculationScenario validCalculation = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
- validCalculation.Name = "A";
- PipingCalculationScenario invalidCalculation = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithInvalidInput();
- invalidCalculation.Name = "B";
+ PipingCalculationScenario calculationA = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationA.Name = "A";
+ PipingCalculationScenario calculationB = PipingCalculationScenarioTestFactory.CreatePipingCalculationScenarioWithValidInput(hydraulicBoundaryLocation);
+ calculationB.Name = "B";
- failureMechanism.CalculationsGroup.Children.Add(validCalculation);
- failureMechanism.CalculationsGroup.Children.Add(invalidCalculation);
+ failureMechanism.CalculationsGroup.Children.Add(calculationA);
+ failureMechanism.CalculationsGroup.Children.Add(calculationB);
var failureMechanismContext = new PipingFailureMechanismContext(failureMechanism, assessmentSection);
@@ -760,12 +760,29 @@
using (ContextMenuStrip contextMenu = info.ContextMenuStrip(failureMechanismContext, null, treeViewControl))
{
// Call
- contextMenu.Items[contextMenuCalculateAllIndex].PerformClick();
+ Action call = () => contextMenu.Items[contextMenuCalculateAllIndex].PerformClick();
+
+ // Assert
+ TestHelper.AssertLogMessages(call, messages =>
+ {
+ string[] msgs = messages.ToArray();
+ Assert.AreEqual(12, msgs.Length);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gestart.", msgs[0]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[1]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[2]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[3]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[4]);
+ Assert.AreEqual("Uitvoeren van berekening 'A' is gelukt.", msgs[5]);
+
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gestart.", msgs[6]);
+ CalculationServiceTestHelper.AssertValidationStartMessage(msgs[7]);
+ CalculationServiceTestHelper.AssertValidationEndMessage(msgs[8]);
+ CalculationServiceTestHelper.AssertCalculationStartMessage(msgs[9]);
+ CalculationServiceTestHelper.AssertCalculationEndMessage(msgs[10]);
+ Assert.AreEqual("Uitvoeren van berekening 'B' is gelukt.", msgs[11]);
+ });
}
}
-
- // Assert
- // Assert expectancies are called in TearDown()
}
[Test]