Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs =================================================================== diff -u -r79279d5d69482de69ef6b4be98ad53e666ab06e2 -rba310454172ed29499474b2f8b013fa0f0c523b8 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 79279d5d69482de69ef6b4be98ad53e666ab06e2) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision ba310454172ed29499474b2f8b013fa0f0c523b8) @@ -273,5 +273,81 @@ Assert.AreEqual("Weet u zeker dat u de uitvoer van deze berekening wilt wissen?", messageBoxText); mocks.VerifyAll(); } + +// [Test] +// public void GivenCalculation_WhenCalculatingFromContextMenu_ThenCalculationNotifiesObservers() +// { +// // Given +// var gui = mocks.DynamicMock(); +// var mainWindow = mocks.DynamicMock(); +// var observer = mocks.StrictMock(); +// var treeViewControlMock = mocks.StrictMock(); +// var calculateContextMenuItemIndex = 0; +// +// var section = new FailureMechanismSection("A", new[] +// { +// new Point2D(1, 2), +// new Point2D(3, 4) +// }); +// +// var failureMechanism = mocks.StrictMock(); +// failureMechanism.AddSection(section); +// var hydraulicBoundaryLocation1 = new HydraulicBoundaryLocation(100001, "", 1.1, 2.2); +// var hydraulicBoundaryLocation2 = new HydraulicBoundaryLocation(100002, "", 3.3, 4.4) +// { +// DesignWaterLevel = 4.2 +// }; +// +// var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase +// { +// Locations = +// { +// hydraulicBoundaryLocation1, +// hydraulicBoundaryLocation2 +// }, +// FilePath = "D:/nonExistingDirectory/nonExistingFile", +// Version = "random" +// }; +// +// var assessmentSectionMock = mocks.StrictMock(); +// assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase); +// var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput()); +// +// var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock); +// +// gui.Expect(g => g.Get(calculationContext, treeViewControlMock)).Return(new CustomItemsOnlyContextMenuBuilder()); +// gui.Expect(g => g.MainWindow).Return(mainWindow); +// +// observer.Expect(o => o.UpdateObserver()); +// +// mocks.ReplayAll(); +// +// plugin.Gui = gui; +// +// calculation.Attach(observer); +// +// var contextMenuAdapter = info.ContextMenuStrip(calculationContext, null, treeViewControlMock); +// +// DialogBoxHandler = (name, wnd) => +// { +// // Don't care about dialogs in this test. +// }; +// +// // When +// Action action = () => { contextMenuAdapter.Items[calculateContextMenuItemIndex].PerformClick(); }; +// +// // Then +// TestHelper.AssertLogMessages(action, messages => +// { +// var msgs = messages.GetEnumerator(); +// Assert.IsTrue(msgs.MoveNext()); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", msgs.Current); +// Assert.IsTrue(msgs.MoveNext()); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beƫindigd om: ", msgs.Current); +// }); +// Assert.IsNotNull(calculation.Output); +// +// mocks.VerifyAll(); +// } } } \ No newline at end of file