Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r8e0924d08a2377125c21114d088b6091bf1eb5fc -r0d43b27e8aa5f3bfa5224448946e0332d047b1e3 --- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 8e0924d08a2377125c21114d088b6091bf1eb5fc) +++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/TreeNodeInfos/WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../WaveImpactAsphaltCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 0d43b27e8aa5f3bfa5224448946e0332d047b1e3) @@ -19,6 +19,7 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; using System.Drawing; using System.IO; using System.Linq; @@ -606,307 +607,338 @@ } } - // TODO WTI-856 - //[Test] - //public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled() - //{ - // // Setup - // using (var treeViewControl = new TreeViewControl()) - // { - // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - // failureMechanism.AddSection(new FailureMechanismSection("", new[] - // { - // new Point2D(0, 0) - // })); - // var group = new CalculationGroup(); - // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); - // var assessmentSection = mocks.Stub(); - // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, - // failureMechanism, - // assessmentSection); - // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, - // failureMechanism, - // assessmentSection); + [Test] + public void ContextMenuStrip_AssessmentSectionWithoutHydraulicBoundaryDatabase_ValidateAndCalculateAllDisabled() + { + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("", new[] + { + new Point2D(0, 0) + })); + var group = new CalculationGroup(); + group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); + var assessmentSection = mocks.Stub(); + var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, + failureMechanism, + assessmentSection); + var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, + failureMechanism, + assessmentSection); - // var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - // var gui = mocks.Stub(); - // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - // mocks.ReplayAll(); + mocks.ReplayAll(); - // plugin.Gui = gui; + plugin.Gui = gui; - // // Call - // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - // { - // // Assert - // ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations]; - // ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations]; - // Assert.IsFalse(validateItem.Enabled); - // Assert.IsFalse(calculateItem.Enabled); - // Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, calculateItem.ToolTipText); - // Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, validateItem.ToolTipText); - // } - // } - //} + // Call + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) + { + // Assert + ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations]; + ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations]; + Assert.IsFalse(validateItem.Enabled); + Assert.IsFalse(calculateItem.Enabled); + Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, calculateItem.ToolTipText); + Assert.AreEqual(RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported, validateItem.ToolTipText); + } + } + } - // TODO WTI-856 - //[Test] - //public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled() - //{ - // // Setup - // using (var treeViewControl = new TreeViewControl()) - // { - // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - // failureMechanism.AddSection(new FailureMechanismSection("", new[] - // { - // new Point2D(0, 0) - // })); - // var group = new CalculationGroup(); - // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); - // var assessmentSection = mocks.Stub(); - // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - // { - // FilePath = "" - // }; - // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, - // failureMechanism, - // assessmentSection); - // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, - // failureMechanism, - // assessmentSection); + [Test] + public void ContextMenuStrip_AssessmentSectionWithInvalidHydraulicBoundaryDatabasePath_ValidateAndCalculateAllDisabled() + { + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("", new[] + { + new Point2D(0, 0) + })); + var group = new CalculationGroup(); + group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = "" + }; + var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, + failureMechanism, + assessmentSection); + var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, + failureMechanism, + assessmentSection); - // var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - // var gui = mocks.Stub(); - // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - // mocks.ReplayAll(); + mocks.ReplayAll(); - // plugin.Gui = gui; + plugin.Gui = gui; - // // Call - // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - // { - // // Assert - // ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations]; - // ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations]; - // Assert.IsFalse(validateItem.Enabled); - // Assert.IsFalse(calculateItem.Enabled); - // var message = "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn."; - // Assert.AreEqual(message, calculateItem.ToolTipText); - // Assert.AreEqual(message, validateItem.ToolTipText); - // } - // } - //} + // Call + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) + { + // Assert + ToolStripItem validateItem = contextMenu.Items[contextMenuValidateAllIndexNestedGroupNoCalculations]; + ToolStripItem calculateItem = contextMenu.Items[contextMenuCalculateAllIndexNestedGroupNoCalculations]; + Assert.IsFalse(validateItem.Enabled); + Assert.IsFalse(calculateItem.Enabled); + var message = "Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. Fout bij het lezen van bestand '': Bestandspad mag niet leeg of ongedefinieerd zijn."; + Assert.AreEqual(message, calculateItem.ToolTipText); + Assert.AreEqual(message, validateItem.ToolTipText); + } + } + } - // TODO WTI-856 - //[Test] - //public void ContextMenuStrip_TwoCalculationsClickOnValidateAllInGroup_ValidationMessagesLogged() - //{ - // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); + [Test] + public void ContextMenuStrip_TwoCalculationsClickOnValidateAllInGroup_ValidationMessagesLogged() + { + string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); - // var assessmentSection = mocks.Stub(); - // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - // { - // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") - // }; - // assessmentSection.Stub(a => a.FailureMechanismContribution).Return( - // new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); + var assessmentSection = mocks.Stub(); + assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") + }; + assessmentSection.Stub(a => a.FailureMechanismContribution).Return( + new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); - // var group = new CalculationGroup(); - // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); - // group.Children.Add(new WaveImpactAsphaltCoverWaveConditionsCalculation()); + var calculationA = new WaveImpactAsphaltCoverWaveConditionsCalculation() + { + Name = "A", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 1, 1) + { + DesignWaterLevel = (RoundedDouble) 12.0 + }, + LowerBoundaryRevetment = (RoundedDouble) 1.0, + UpperBoundaryRevetment = (RoundedDouble) 10.0, + StepSize = WaveConditionsInputStepSize.One, + LowerBoundaryWaterLevels = (RoundedDouble) 1.0, + UpperBoundaryWaterLevels = (RoundedDouble) 10.0 + } + }; - // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - // failureMechanism.AddSection(new FailureMechanismSection("", new[] - // { - // new Point2D(0, 0) - // })); - // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); - // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, - // failureMechanism, - // assessmentSection); - // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, - // failureMechanism, - // assessmentSection); + var calculationB = new WaveImpactAsphaltCoverWaveConditionsCalculation() + { + Name = "B", + InputParameters = + { + HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "", 1, 1) + { + DesignWaterLevel = (RoundedDouble) 12.0 + }, + LowerBoundaryRevetment = (RoundedDouble) 1.0, + UpperBoundaryRevetment = (RoundedDouble) 10.0, + StepSize = WaveConditionsInputStepSize.One, + LowerBoundaryWaterLevels = (RoundedDouble) 1.0, + UpperBoundaryWaterLevels = (RoundedDouble) 10.0 + } + }; - // var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + var group = new CalculationGroup(); + group.Children.Add(calculationA); + group.Children.Add(calculationB); - // // Setup - // using (var treeViewControl = new TreeViewControl()) - // { - // var gui = mocks.Stub(); - // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); + var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); + failureMechanism.AddSection(new FailureMechanismSection("", new[] + { + new Point2D(0, 0) + })); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); + var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, + failureMechanism, + assessmentSection); + var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, + failureMechanism, + assessmentSection); - // mocks.ReplayAll(); + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - // plugin.Gui = gui; + // Setup + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - // { - // // Call - // Action test = () => contextMenu.Items[4].PerformClick(); + mocks.ReplayAll(); - // // Assert - // TestHelper.AssertLogMessages(test, m => - // { - // var messages = m.ToArray(); - // Assert.AreEqual(4, messages.Length); - // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' gestart om: ", messages[0]); - // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' beëindigd om: ", messages[1]); - // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' gestart om: ", messages[2]); - // StringAssert.StartsWith("Validatie van 'Nieuwe berekening' beëindigd om: ", messages[3]); - // }); - // } - // } - //} + plugin.Gui = gui; - // TODO WTI-808 - //[Test] - //public void ContextMenuStrip_TwoCalculationsClickOnCalculateAllInGroup_MessagesLogged() - //{ - // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) + { + // Call + Action test = () => contextMenu.Items[4].PerformClick(); - // var assessmentSection = mocks.Stub(); - // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - // { - // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") - // }; - // assessmentSection.Stub(a => a.FailureMechanismContribution).Return( - // new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); - // assessmentSection.Stub(a => a.Id).Return("someId"); + // Assert + TestHelper.AssertLogMessages(test, m => + { + var messages = m.ToArray(); + Assert.AreEqual(4, messages.Length); + StringAssert.StartsWith("Validatie van 'A' gestart om: ", messages[0]); + StringAssert.StartsWith("Validatie van 'A' beëindigd om: ", messages[1]); + StringAssert.StartsWith("Validatie van 'B' gestart om: ", messages[2]); + StringAssert.StartsWith("Validatie van 'B' beëindigd om: ", messages[3]); + }); + } + } + } - // var observerA = mocks.StrictMock(); - // observerA.Expect(o => o.UpdateObserver()); - // var observerB = mocks.StrictMock(); - // observerB.Expect(o => o.UpdateObserver()); - - // var group = new CalculationGroup(); - // var calculationA = GetValidCalculation(); - // var calculationB = GetValidCalculation(); - // calculationA.Attach(observerA); - // calculationB.Attach(observerB); - // group.Children.Add(calculationA); - // group.Children.Add(calculationB); - - // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - // failureMechanism.AddSection(new FailureMechanismSection("", new[] - // { - // new Point2D(0, 0) - // })); - // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); - // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, - // failureMechanism, - // assessmentSection); - // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, - // failureMechanism, - // assessmentSection); - - // var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - // DialogBoxHandler = (name, wnd) => - // { - // // Expect an activity dialog which is automatically closed - // }; - - // // Setup - // using (var treeViewControl = new TreeViewControl()) - // { - // var mainWindow = mocks.Stub(); - - // var gui = mocks.Stub(); - // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - // gui.Stub(g => g.MainWindow).Return(mainWindow); - - // mocks.ReplayAll(); - - // plugin.Gui = gui; - - // using (new HydraRingCalculationServiceConfig()) - // using (new WaveConditionsCalculationServiceConfig()) - // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - // { - // // Call - // Action test = () => contextMenu.Items[5].PerformClick(); - - // // Assert - // TestHelper.AssertLogMessages(test, m => - // { - // var messages = m.ToArray(); - // Assert.AreEqual(30, messages.Length); - // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[0]); - // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[13]); - // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[14]); - // StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[27]); - // Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[28]); - // Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[29]); - // }); - // } - // } - //} - // TODO WTI-808 - //[Test] - //public void ContextMenuStrip_NoCalculations_ClearAllOutputItemDisabled() - //{ - // string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); +// [Test] +// public void ContextMenuStrip_TwoCalculationsClickOnCalculateAllInGroup_MessagesLogged() +// { +// string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); +// +// var assessmentSection = mocks.Stub(); +// assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase +// { +// FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") +// }; +// assessmentSection.Stub(a => a.FailureMechanismContribution).Return( +// new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); +// assessmentSection.Stub(a => a.Id).Return("someId"); +// +// var observerA = mocks.StrictMock(); +// observerA.Expect(o => o.UpdateObserver()); +// var observerB = mocks.StrictMock(); +// observerB.Expect(o => o.UpdateObserver()); +// +// var group = new CalculationGroup(); +// var calculationA = GetValidCalculation(); +// var calculationB = GetValidCalculation(); +// calculationA.Attach(observerA); +// calculationB.Attach(observerB); +// group.Children.Add(calculationA); +// group.Children.Add(calculationB); +// +// var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); +// failureMechanism.AddSection(new FailureMechanismSection("", new[] +// { +// new Point2D(0, 0) +// })); +// failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); +// var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, +// failureMechanism, +// assessmentSection); +// var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, +// failureMechanism, +// assessmentSection); +// +// var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); +// +// DialogBoxHandler = (name, wnd) => +// { +// // Expect an activity dialog which is automatically closed +// }; +// +// // Setup +// using (var treeViewControl = new TreeViewControl()) +// { +// var mainWindow = mocks.Stub(); +// +// var gui = mocks.Stub(); +// gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); +// gui.Stub(g => g.MainWindow).Return(mainWindow); +// +// mocks.ReplayAll(); +// +// plugin.Gui = gui; +// +// using (new HydraRingCalculationServiceConfig()) +// using (new WaveConditionsCalculationServiceConfig()) +// using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) +// { +// // Call +// Action test = () => contextMenu.Items[5].PerformClick(); +// +// // Assert +// TestHelper.AssertLogMessages(test, m => +// { +// var messages = m.ToArray(); +// Assert.AreEqual(30, messages.Length); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[0]); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[13]); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' gestart om: ", messages[14]); +// StringAssert.StartsWith("Berekening van 'Nieuwe berekening' beëindigd om: ", messages[27]); +// Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[28]); +// Assert.AreEqual("Uitvoeren van 'Nieuwe berekening' is gelukt.", messages[29]); +// }); +// } +// } +// } +// +// // TODO WTI-808 +// [Test] +// public void ContextMenuStrip_NoCalculations_ClearAllOutputItemDisabled() +// { +// string hrdPath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Service, "HydraRingCalculation"); +// +// var assessmentSection = mocks.Stub(); +// assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase +// { +// FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") +// }; +// assessmentSection.Stub(a => a.FailureMechanismContribution).Return( +// new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); +// assessmentSection.Stub(a => a.Id).Return("someId"); +// +// var group = new CalculationGroup(); +// +// var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); +// failureMechanism.AddSection(new FailureMechanismSection("", new[] +// { +// new Point2D(0, 0) +// })); +// failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); +// var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, +// failureMechanism, +// assessmentSection); +// var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, +// failureMechanism, +// assessmentSection); +// +// var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); +// +// // Setup +// using (var treeViewControl = new TreeViewControl()) +// { +// var mainWindow = mocks.Stub(); +// +// var gui = mocks.Stub(); +// gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); +// gui.Stub(g => g.MainWindow).Return(mainWindow); +// +// mocks.ReplayAll(); +// +// plugin.Gui = gui; +// +// using (new HydraRingCalculationServiceConfig()) +// using (new WaveConditionsCalculationServiceConfig()) +// using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) +// { +// // Call +// var clearAllOutputItem = contextMenu.Items[5]; +// +// // Assert +// Assert.IsFalse(clearAllOutputItem.Enabled); +// } +// } +// } - // var assessmentSection = mocks.Stub(); - // assessmentSection.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase - // { - // FilePath = Path.Combine(hrdPath, "HRD ijsselmeer.sqlite") - // }; - // assessmentSection.Stub(a => a.FailureMechanismContribution).Return( - // new FailureMechanismContribution(Enumerable.Empty(), 30, 2)); - // assessmentSection.Stub(a => a.Id).Return("someId"); - - // var group = new CalculationGroup(); - - // var failureMechanism = new WaveImpactAsphaltCoverFailureMechanism(); - // failureMechanism.AddSection(new FailureMechanismSection("", new[] - // { - // new Point2D(0, 0) - // })); - // failureMechanism.WaveConditionsCalculationGroup.Children.Add(group); - // var nodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(group, - // failureMechanism, - // assessmentSection); - // var parentNodeData = new WaveImpactAsphaltCoverWaveConditionsCalculationGroupContext(failureMechanism.WaveConditionsCalculationGroup, - // failureMechanism, - // assessmentSection); - - // var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); - - // // Setup - // using (var treeViewControl = new TreeViewControl()) - // { - // var mainWindow = mocks.Stub(); - - // var gui = mocks.Stub(); - // gui.Stub(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder); - // gui.Stub(g => g.MainWindow).Return(mainWindow); - - // mocks.ReplayAll(); - - // plugin.Gui = gui; - - // using (new HydraRingCalculationServiceConfig()) - // using (new WaveConditionsCalculationServiceConfig()) - // using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) - // { - // // Call - // var clearAllOutputItem = contextMenu.Items[5]; - - // // Assert - // Assert.IsFalse(clearAllOutputItem.Enabled); - // } - // } - //} - [Test] public void ContextMenuStrip_TwoCalculationsWithoutOutput_ClearAllOutputItemDisabled() {