Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -rea7fd6455177ea93f8419e6a29fc00d1d3167359 -rb7c9234daf5a52422362a7cb3fa1f46a86df63bb --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision ea7fd6455177ea93f8419e6a29fc00d1d3167359) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Plugin.Test/TreeNodeInfos/MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../MacroStabilityInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision b7c9234daf5a52422362a7cb3fa1f46a86df63bb) @@ -556,63 +556,6 @@ } [Test] - public void ContextMenuStrip_FailureMechanismContributionZero_ContextMenuItemCalculateAllAndValidateAllDisabledAndTooltipSet() - { - // Setup - using (var treeViewControl = new TreeViewControl()) - { - var failureMechanism = new MacroStabilityInwardsFailureMechanism(); - var assessmentSection = new AssessmentSectionStub(); - var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); - - assessmentSection.SetHydraulicBoundaryLocationCalculations(new[] - { - hydraulicBoundaryLocation - }, true); - - var group = new CalculationGroup - { - Children = - { - MacroStabilityInwardsCalculationScenarioTestFactory.CreateMacroStabilityInwardsCalculationScenarioWithValidInput(hydraulicBoundaryLocation) - } - }; - - var nodeData = new MacroStabilityInwardsCalculationGroupContext(group, - null, - Enumerable.Empty(), - Enumerable.Empty(), - failureMechanism, - assessmentSection); - - var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - var gui = mocks.Stub(); - gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - mocks.ReplayAll(); - - plugin.Gui = gui; - - // Call - using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, failureMechanism, treeViewControl)) - { - // Assert - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndexRootGroup, - "Alles be&rekenen", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.CalculateAllIcon, - false); - - TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndexRootGroup, - "Alles &valideren", - "De bijdrage van dit toetsspoor is nul.", - RingtoetsCommonFormsResources.ValidateAllIcon, - false); - } - } - } - - [Test] public void ContextMenuStrip_AllRequiredInputSet_ContextMenuItemCalculateAllAndValidateAllEnabled() { // Setup @@ -876,13 +819,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 +834,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 +859,7 @@ plugin.Gui = gui; + using (new MacroStabilityInwardsCalculatorFactoryConfig()) using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) { DialogBoxHandler = (name, wnd) => @@ -924,11 +868,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 +1086,7 @@ new Point3D(5.0, -5.0, 0.0) }); - var surfaceLines = new[] + MacroStabilityInwardsSurfaceLine[] surfaceLines = { surfaceLine1, surfaceLine2 @@ -1233,7 +1195,7 @@ new Point3D(5.0, -5.0, 0.0) }); - var surfaceLines = new[] + MacroStabilityInwardsSurfaceLine[] surfaceLines = { surfaceLine1, surfaceLine2