Index: Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs
===================================================================
diff -u -reda4b6196511abd0d2272c58db14e31c1efab0b4 -r276186ff02a5abf7787d65f12f88ded519979c7d
--- Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision eda4b6196511abd0d2272c58db14e31c1efab0b4)
+++ Riskeer/Piping/src/Riskeer.Piping.Plugin/PipingPlugin.cs (.../PipingPlugin.cs) (revision 276186ff02a5abf7787d65f12f88ded519979c7d)
@@ -833,8 +833,6 @@
return builder.AddOpenItem()
.AddSeparator()
- .AddToggleRelevancyOfFailureMechanismItem(context, RemoveAllViewsForItem)
- .AddSeparator()
.AddValidateAllCalculationsInFailureMechanismItem(
context,
ValidateAllInFailureMechanism)
@@ -854,11 +852,6 @@
.Build();
}
- private void RemoveAllViewsForItem(PipingFailureMechanismCalculationStateContext context)
- {
- Gui.ViewCommands.RemoveAllViewsForItem(context);
- }
-
///
/// Validates all calculations in .
///
Index: Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismCalculationStateContextTreeNodeInfoTest.cs
===================================================================
diff -u -reda4b6196511abd0d2272c58db14e31c1efab0b4 -r276186ff02a5abf7787d65f12f88ded519979c7d
--- Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismCalculationStateContextTreeNodeInfoTest.cs (.../PipingFailureMechanismCalculationStateContextTreeNodeInfoTest.cs) (revision eda4b6196511abd0d2272c58db14e31c1efab0b4)
+++ Riskeer/Piping/test/Riskeer.Piping.Plugin.Test/TreeNodeInfos/PipingFailureMechanismCalculationStateContextTreeNodeInfoTest.cs (.../PipingFailureMechanismCalculationStateContextTreeNodeInfoTest.cs) (revision 276186ff02a5abf7787d65f12f88ded519979c7d)
@@ -63,14 +63,11 @@
[TestFixture]
public class PipingFailureMechanismCalculationStateContextTreeNodeInfoTest : NUnitFormTest
{
- private const int contextMenuRelevancyIndexWhenRelevant = 2;
- private const int contextMenuRelevancyIndexWhenNotRelevant = 0;
+ private const int contextMenuValidateAllIndex = 2;
+ private const int contextMenuCalculateAllIndex = 3;
+ private const int contextMenuClearIndex = 5;
+ private const int contextMenuClearIllustrationPointsIndex = 6;
- private const int contextMenuValidateAllIndex = 4;
- private const int contextMenuCalculateAllIndex = 5;
- private const int contextMenuClearIndex = 7;
- private const int contextMenuClearIllustrationPointsIndex = 8;
-
private static readonly string testDataPath = TestHelper.GetTestDataPath(TestDataPath.Riskeer.Integration.Service, "HydraRingCalculation");
private static readonly string validHydraulicBoundaryDatabaseFilePath = Path.Combine(testDataPath, "HRD dutch coast south.sqlite");
@@ -321,7 +318,7 @@
using (ContextMenuStrip menu = info.ContextMenuStrip(context, null, treeViewControl))
{
// Assert
- Assert.AreEqual(14, menu.Items.Count);
+ Assert.AreEqual(12, menu.Items.Count);
TestHelper.AssertContextMenuStripContainsItem(menu,
0,
@@ -332,47 +329,42 @@
TestHelper.AssertContextMenuStripContainsItem(menu,
2,
- "I&s relevant",
- "Geeft aan of dit toetsspoor relevant is of niet.",
- RiskeerCommonFormsResources.Checkbox_ticked);
-
- TestHelper.AssertContextMenuStripContainsItem(menu,
- 4,
"Alles &valideren",
"Valideer alle berekeningen binnen dit toetsspoor.",
RiskeerCommonFormsResources.ValidateAllIcon);
TestHelper.AssertContextMenuStripContainsItem(menu,
- 5,
+ 3,
"Alles be&rekenen",
"Voer alle berekeningen binnen dit toetsspoor uit.",
RiskeerCommonFormsResources.CalculateAllIcon);
TestHelper.AssertContextMenuStripContainsItem(menu,
- 7,
+ 5,
"&Wis alle uitvoer...",
"Wis de uitvoer van alle berekeningen binnen dit toetsspoor.",
RiskeerCommonFormsResources.ClearIcon);
- TestHelper.AssertContextMenuStripContainsItem(menu, 8,
+ TestHelper.AssertContextMenuStripContainsItem(menu,
+ 6,
"Wis alle illustratiepunten...",
"Er zijn geen berekeningen met illustratiepunten om te wissen.",
RiskeerCommonFormsResources.ClearIllustrationPointsIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu,
- 10,
+ 8,
"Alles i&nklappen",
"Klap dit element en alle onderliggende elementen in.",
CoreGuiResources.CollapseAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu,
- 11,
+ 9,
"Alles ui&tklappen",
"Klap dit element en alle onderliggende elementen uit.",
CoreGuiResources.ExpandAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu,
- 13,
+ 11,
"Ei&genschappen",
"Toon de eigenschappen in het Eigenschappenpaneel.",
CoreGuiResources.PropertiesHS,
@@ -381,9 +373,9 @@
CollectionAssert.AllItemsAreInstancesOfType(new[]
{
menu.Items[1],
- menu.Items[3],
- menu.Items[9],
- menu.Items[12]
+ menu.Items[4],
+ menu.Items[7],
+ menu.Items[10]
}, typeof(ToolStripSeparator));
}
}
@@ -604,9 +596,7 @@
menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
- menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
- menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder);
@@ -877,86 +867,6 @@
}
}
- [Test]
- public void ContextMenuStrip_FailureMechanismIsRelevantAndClickOnIsRelevantItem_MakeFailureMechanismNotRelevant()
- {
- // Setup
- using (var treeViewControl = new TreeViewControl())
- {
- var failureMechanismObserver = mocks.Stub();
- failureMechanismObserver.Expect(o => o.UpdateObserver());
-
- var failureMechanism = new PipingFailureMechanism();
- failureMechanism.Attach(failureMechanismObserver);
-
- var assessmentSection = mocks.Stub();
- var context = new PipingFailureMechanismCalculationStateContext(failureMechanism, assessmentSection);
-
- var viewCommands = mocks.StrictMock();
- viewCommands.Expect(vs => vs.RemoveAllViewsForItem(context));
-
- var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
-
- var gui = mocks.Stub();
- gui.Stub(g => g.ViewCommands).Return(viewCommands);
- gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
- gui.Stub(cmp => cmp.MainWindow).Return(mocks.Stub());
- mocks.ReplayAll();
-
- plugin.Gui = gui;
-
- using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- {
- // Call
- contextMenu.Items[contextMenuRelevancyIndexWhenRelevant].PerformClick();
-
- // Assert
- Assert.IsFalse(failureMechanism.IsRelevant);
- }
- }
- }
-
- [Test]
- public void ContextMenuStrip_FailureMechanismIsNotRelevantAndClickOnIsRelevantItem_MakeFailureMechanismRelevant()
- {
- // Setup
- using (var treeViewControl = new TreeViewControl())
- {
- var failureMechanismObserver = mocks.Stub();
- failureMechanismObserver.Expect(o => o.UpdateObserver());
-
- var failureMechanism = new PipingFailureMechanism
- {
- IsRelevant = false
- };
- failureMechanism.Attach(failureMechanismObserver);
-
- var assessmentSection = mocks.Stub();
- var context = new PipingFailureMechanismCalculationStateContext(failureMechanism, assessmentSection);
-
- var viewCommands = mocks.StrictMock();
- viewCommands.Expect(vs => vs.RemoveAllViewsForItem(context));
-
- var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
-
- var gui = mocks.Stub();
- gui.Stub(g => g.ViewCommands).Return(viewCommands);
- gui.Stub(g => g.Get(context, treeViewControl)).Return(menuBuilder);
- mocks.ReplayAll();
-
- plugin.Gui = gui;
-
- using (ContextMenuStrip contextMenu = info.ContextMenuStrip(context, null, treeViewControl))
- {
- // Call
- contextMenu.Items[contextMenuRelevancyIndexWhenNotRelevant].PerformClick();
-
- // Assert
- Assert.IsTrue(failureMechanism.IsRelevant);
- }
- }
- }
-
public override void Setup()
{
mocks = new MockRepository();