Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/GrassCoverErosionInwardsDikeProfileSelectionDialog.cs
===================================================================
diff -u -red80cd8fb7d91c419ca42f706625e77ae014339e -rd1622350f2155131233440de093850e3e7a4459f
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/GrassCoverErosionInwardsDikeProfileSelectionDialog.cs (.../GrassCoverErosionInwardsDikeProfileSelectionDialog.cs) (revision ed80cd8fb7d91c419ca42f706625e77ae014339e)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/GrassCoverErosionInwardsDikeProfileSelectionDialog.cs (.../GrassCoverErosionInwardsDikeProfileSelectionDialog.cs) (revision d1622350f2155131233440de093850e3e7a4459f)
@@ -31,7 +31,7 @@
namespace Ringtoets.GrassCoverErosionInwards.Forms
{
///
- /// A dialog which allows the user to make a selection form a given set of . Upon
+ /// A dialog which allows the user to make a selection form a given set of . Upon
/// closing of the dialog, the selected can be obtained.
///
public class GrassCoverErosionInwardsDikeProfileSelectionDialog : SelectionDialogBase
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs
===================================================================
diff -u -red80cd8fb7d91c419ca42f706625e77ae014339e -rd1622350f2155131233440de093850e3e7a4459f
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs (.../StructureSelectionDialog.cs) (revision ed80cd8fb7d91c419ca42f706625e77ae014339e)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs (.../StructureSelectionDialog.cs) (revision d1622350f2155131233440de093850e3e7a4459f)
@@ -30,6 +30,10 @@
namespace Ringtoets.HeightStructures.Forms
{
+ ///
+ /// A dialog which allows the user to make a selection form a given set of . Upon
+ /// closing of the dialog, the selected can be obtained.
+ ///
public class StructureSelectionDialog : SelectionDialogBase
{
///
Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r7164a642dc83ca7a1fd78513cbff9da53c052602 -rd1622350f2155131233440de093850e3e7a4459f
--- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602)
+++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d1622350f2155131233440de093850e3e7a4459f)
@@ -1,4 +1,25 @@
-//------------------------------------------------------------------------------
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs
===================================================================
diff -u -re59a92bdf530c0f3522a25253350f6f6f593ddbd -rd1622350f2155131233440de093850e3e7a4459f
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs (.../StructureSelectionDialogTest.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs (.../StructureSelectionDialogTest.cs) (revision d1622350f2155131233440de093850e3e7a4459f)
@@ -22,7 +22,6 @@
using System;
using System.Linq;
using System.Windows.Forms;
-using Core.Common.Base.Geometry;
using Core.Common.Controls.DataGrid;
using NUnit.Extensions.Forms;
using NUnit.Framework;
@@ -67,17 +66,14 @@
[Test]
public void Constructor_WithParentAndSurfaceLines_DefaultProperties()
{
- // Setup
+ // Setup & Call
using (var viewParent = new Form())
+ using (var dialog = new StructureSelectionDialog(viewParent, Enumerable.Empty()))
{
- // Call
- using (var dialog = new StructureSelectionDialog(viewParent, Enumerable.Empty()))
- {
- // Assert
- Assert.IsInstanceOf>(dialog);
- Assert.IsEmpty(dialog.SelectedItems);
- Assert.AreEqual("Selecteer kunstwerken", dialog.Text);
- }
+ // Assert
+ Assert.IsInstanceOf>(dialog);
+ Assert.IsEmpty(dialog.SelectedItems);
+ Assert.AreEqual("Selecteer kunstwerken", dialog.Text);
}
}
@@ -133,6 +129,5 @@
Assert.AreEqual(testname, (string) dataGridViewControl.Rows[0].Cells[nameColumnIndex].Value);
}
}
-
}
}
\ No newline at end of file
Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs
===================================================================
diff -u -r6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8 -rd1622350f2155131233440de093850e3e7a4459f
--- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision 6b6f344a9cf3e6c44b63320dfa3f5c828c4221d8)
+++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/TreeNodeInfos/HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs (.../HeightStructuresCalculationGroupContextTreeNodeInfoTest.cs) (revision d1622350f2155131233440de093850e3e7a4459f)
@@ -24,6 +24,7 @@
using System.Windows.Forms;
using Core.Common.Base;
using Core.Common.Base.Geometry;
+using Core.Common.Controls.DataGrid;
using Core.Common.Controls.TreeView;
using Core.Common.Gui;
using Core.Common.Gui.Commands;
@@ -37,15 +38,16 @@
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.FailureMechanism;
+using Ringtoets.Common.Forms.Helpers;
using Ringtoets.HeightStructures.Data;
using Ringtoets.HeightStructures.Data.TestUtil;
using Ringtoets.HeightStructures.Forms.PresentationObjects;
using Ringtoets.HeightStructures.Plugin;
-using Ringtoets.HeightStructures.Plugin.Properties;
using Ringtoets.HydraRing.Data;
using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources;
using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources;
+using HeighStructuresPluginResources = Ringtoets.HeightStructures.Plugin.Properties.Resources;
namespace Ringtoets.HeightStructures.Forms.Test.TreeNodeInfos
{
@@ -237,37 +239,37 @@
Assert.AreEqual(12, menu.Items.Count);
TestHelper.AssertContextMenuStripContainsItem(menu, contextGenerateCalculationsIndexRootGroup,
- RingtoetsCommonFormsResources.CalculationsGroup_Generate_calculations,
- Resources.HeightStructuresPlugin_No_structures_to_generate_for,
+ "Genereer &berekeningen...",
+ "Er zijn geen kunstwerken beschikbaar om de berekeningen te genereren.",
RingtoetsCommonFormsResources.GenerateScenariosIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexRootGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup_Tooltip,
+ "&Map toevoegen",
+ "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.",
RingtoetsCommonFormsResources.AddFolderIcon);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexRootGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation,
- RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation_Tooltip,
+ "Berekening &toevoegen",
+ "Voeg een nieuwe berekening toe aan deze berekeningsmap.",
RingtoetsCommonFormsResources.FailureMechanismIcon);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRemoveAllChildrenRootGroupIndex,
- RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_Remove_all,
- RingtoetsCommonFormsResources.CalculationGroup_RemoveAllChildrenFromGroup_No_Calculation_or_Group_to_remove,
+ "Map &leegmaken...",
+ "Er zijn geen berekeningen of mappen om te verwijderen.",
RingtoetsCommonFormsResources.RemoveAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Validate_all,
- RingtoetsCommonFormsResources.ValidateAll_No_calculations_to_validate,
+ "Alles &valideren",
+ "Er zijn geen berekeningen om te valideren.",
RingtoetsCommonFormsResources.ValidateAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Calculate_all,
- RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_No_calculations_to_run,
+ "Alles be&rekenen",
+ "Er zijn geen berekeningen om uit te voeren.",
RingtoetsCommonFormsResources.CalculateAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndexRootGroup,
- RingtoetsCommonFormsResources.Clear_all_output,
- RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear,
+ "&Wis alle uitvoer...",
+ "Er zijn geen berekeningen met uitvoer om te wissen.",
RingtoetsCommonFormsResources.ClearIcon,
false);
}
@@ -302,8 +304,8 @@
Assert.AreEqual(12, menu.Items.Count);
TestHelper.AssertContextMenuStripContainsItem(menu, contextGenerateCalculationsIndexRootGroup,
- RingtoetsCommonFormsResources.CalculationsGroup_Generate_calculations,
- Resources.HeightStructuresPlugin_Generate_calculations_for_selected_strutures,
+ "Genereer &berekeningen...",
+ "Genereer berekeningen op basis van geselecteerde kunstwerken.",
RingtoetsCommonFormsResources.GenerateScenariosIcon);
}
}
@@ -383,27 +385,27 @@
Assert.AreEqual(9, menu.Items.Count);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexNestedGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup_Tooltip,
+ "&Map toevoegen",
+ "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.",
RingtoetsCommonFormsResources.AddFolderIcon);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexNestedGroup,
- RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation,
- RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation_Tooltip,
+ "Berekening &toevoegen",
+ "Voeg een nieuwe berekening toe aan deze berekeningsmap.",
RingtoetsCommonFormsResources.FailureMechanismIcon);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexNestedGroup,
- RingtoetsCommonFormsResources.Validate_all,
- RingtoetsCommonFormsResources.ValidateAll_No_calculations_to_validate,
+ "Alles &valideren",
+ "Er zijn geen berekeningen om te valideren.",
RingtoetsCommonFormsResources.ValidateAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexNestedGroup,
- RingtoetsCommonFormsResources.Calculate_all,
- RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_No_calculations_to_run,
+ "Alles be&rekenen",
+ "Er zijn geen berekeningen om uit te voeren.",
RingtoetsCommonFormsResources.CalculateAllIcon,
false);
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuClearAllIndexNestedGroup,
- RingtoetsCommonFormsResources.Clear_all_output,
- RingtoetsCommonFormsResources.CalculationGroup_ClearOutput_No_calculation_with_output_to_clear,
+ "&Wis alle uitvoer...",
+ "Er zijn geen berekeningen met uitvoer om te wissen.",
RingtoetsCommonFormsResources.ClearIcon,
false);
}
@@ -443,8 +445,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Calculate_all,
- RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported,
+ "Alles be&rekenen",
+ "Er is geen vakindeling geïmporteerd.",
RingtoetsCommonFormsResources.CalculateAllIcon,
false);
}
@@ -490,8 +492,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuCalculateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Calculate_all,
- RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported,
+ "Alles be&rekenen",
+ "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.",
RingtoetsCommonFormsResources.CalculateAllIcon,
false);
}
@@ -539,8 +541,8 @@
// Assert
ToolStripItem contextMenuItem = contextMenu.Items[contextMenuCalculateAllIndexRootGroup];
- Assert.AreEqual(RingtoetsCommonFormsResources.Calculate_all, contextMenuItem.Text);
- StringAssert.Contains(string.Format(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText);
+ Assert.AreEqual("Alles be&rekenen", contextMenuItem.Text);
+ StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), contextMenuItem.ToolTipText);
TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.CalculateAllIcon, contextMenuItem.Image);
Assert.IsFalse(contextMenuItem.Enabled);
}
@@ -595,8 +597,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Calculate_all,
- RingtoetsCommonFormsResources.CalculationGroup_CalculateAll_ToolTip,
+ "Alles be&rekenen",
+ "Voer alle berekeningen binnen deze berekeningsmap uit.",
RingtoetsCommonFormsResources.CalculateAllIcon);
}
}
@@ -635,8 +637,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Validate_all,
- RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_failure_mechanism_sections_imported,
+ "Alles &valideren",
+ "Er is geen vakindeling geïmporteerd.",
RingtoetsCommonFormsResources.ValidateAllIcon,
false);
}
@@ -682,8 +684,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(contextMenu, contextMenuValidateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Validate_all,
- RingtoetsCommonFormsResources.Plugin_AllDataAvailable_No_hydraulic_boundary_database_imported,
+ "Alles &valideren",
+ "Er is geen hydraulische randvoorwaardendatabase geïmporteerd.",
RingtoetsCommonFormsResources.ValidateAllIcon,
false);
}
@@ -731,8 +733,8 @@
// Assert
ToolStripItem contextMenuItem = contextMenu.Items[contextMenuValidateAllIndexRootGroup];
- Assert.AreEqual(RingtoetsCommonFormsResources.Validate_all, contextMenuItem.Text);
- StringAssert.Contains(string.Format(RingtoetsCommonServiceResources.Hydraulic_boundary_database_connection_failed_0_, ""), contextMenuItem.ToolTipText);
+ Assert.AreEqual("Alles &valideren", contextMenuItem.Text);
+ StringAssert.Contains(string.Format("Herstellen van de verbinding met de hydraulische randvoorwaardendatabase is mislukt. {0}", ""), contextMenuItem.ToolTipText);
TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.ValidateAllIcon, contextMenuItem.Image);
Assert.IsFalse(contextMenuItem.Enabled);
}
@@ -787,8 +789,8 @@
{
// Assert
TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup,
- RingtoetsCommonFormsResources.Validate_all,
- RingtoetsCommonFormsResources.CalculationGroup_Validate_all_ToolTip,
+ "Alles &valideren",
+ "Valideer alle berekeningen binnen deze berekeningsmap.",
RingtoetsCommonFormsResources.ValidateAllIcon);
}
}
@@ -1098,6 +1100,188 @@
}
[Test]
+ public void GivenCalculationsViewGenerateScenariosButtonClicked_WhenDikeProfileSelectedAndDialogClosed_ThenCalculationsAddedWithProfileAssigned()
+ {
+ // Given
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var assessmentSectionMock = mocks.StrictMock();
+
+ HeightStructure structure1 = new TestHeightStructure("Structure 1");
+ HeightStructure structure2 = new TestHeightStructure("Structure 2");
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ HeightStructures =
+ {
+ structure1,
+ structure2
+ }
+ };
+
+ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup,
+ failureMechanism,
+ assessmentSectionMock);
+
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var mainWindow = mocks.Stub();
+
+ guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ guiStub.Expect(g => g.MainWindow).Return(mainWindow);
+ guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub());
+
+ mocks.ReplayAll();
+
+ plugin.Gui = guiStub;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var selectionDialog = (StructureSelectionDialog) new FormTester(name).TheObject;
+ var grid = (DataGridViewControl) new ControlTester("DataGridViewControl", selectionDialog).TheObject;
+
+ grid.Rows[0].Cells[0].Value = true;
+
+ new ButtonTester("DoForSelectedButton", selectionDialog).Click();
+ };
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // When
+ contextMenu.Items[contextGenerateCalculationsIndexRootGroup].PerformClick();
+
+ // Then
+ var HeightStructuresCalculations = failureMechanism.Calculations.OfType().ToArray();
+ Assert.AreEqual(1, HeightStructuresCalculations.Length);
+ }
+ }
+ }
+
+ [Test]
+ public void GivenCalculationsViewGenerateScenariosButtonClicked_WhenCancelButtonClickedAndDialogClosed_ThenCalculationsNotUpdated()
+ {
+ // Given
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var assessmentSectionMock = mocks.StrictMock();
+
+ HeightStructure structure1 = new TestHeightStructure("Structure 1");
+ HeightStructure structure2 = new TestHeightStructure("Structure 2");
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ HeightStructures =
+ {
+ structure1,
+ structure2
+ }
+ };
+
+ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup,
+ failureMechanism,
+ assessmentSectionMock);
+
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var mainWindow = mocks.Stub();
+
+ guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ guiStub.Expect(g => g.MainWindow).Return(mainWindow);
+ guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub());
+
+ mocks.ReplayAll();
+
+ plugin.Gui = guiStub;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var selectionDialog = (StructureSelectionDialog) new FormTester(name).TheObject;
+ var grid = (DataGridViewControl) new ControlTester("DataGridViewControl", selectionDialog).TheObject;
+
+ grid.Rows[0].Cells[0].Value = true;
+
+ new ButtonTester("CustomCancelButton", selectionDialog).Click();
+ };
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ // When
+ contextMenu.Items[contextGenerateCalculationsIndexRootGroup].PerformClick();
+
+ // Then
+ Assert.AreEqual(0, failureMechanism.Calculations.OfType().Count());
+ }
+ }
+ }
+
+ [Test]
+ public void GivenScenariosWithExistingCalculationWithSameName_WhenOkButtonClickedAndDialogClosed_ThenCalculationWithUniqueNameAdded()
+ {
+ // Given
+ using (var treeViewControl = new TreeViewControl())
+ {
+ var assessmentSectionMock = mocks.StrictMock();
+
+ var existingCalculationName = "Height structure";
+ HeightStructure heightStructure = new TestHeightStructure(existingCalculationName);
+
+ var failureMechanism = new HeightStructuresFailureMechanism
+ {
+ HeightStructures =
+ {
+ heightStructure
+ },
+ CalculationsGroup =
+ {
+ Children =
+ {
+ new HeightStructuresCalculation
+ {
+ Name = existingCalculationName
+ }
+ }
+ }
+ };
+
+ var nodeData = new HeightStructuresCalculationGroupContext(failureMechanism.CalculationsGroup,
+ failureMechanism,
+ assessmentSectionMock);
+
+ var menuBuilder = new CustomItemsOnlyContextMenuBuilder();
+ var mainWindow = mocks.Stub();
+
+ guiStub.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilder);
+ guiStub.Expect(g => g.MainWindow).Return(mainWindow);
+ guiStub.Stub(cmp => cmp.ViewCommands).Return(mocks.Stub());
+
+ mocks.ReplayAll();
+
+ plugin.Gui = guiStub;
+
+ DialogBoxHandler = (name, wnd) =>
+ {
+ var selectionDialog = (StructureSelectionDialog) new FormTester(name).TheObject;
+ var grid = (DataGridViewControl) new ControlTester("DataGridViewControl", selectionDialog).TheObject;
+
+ grid.Rows[0].Cells[0].Value = true;
+
+ new ButtonTester("DoForSelectedButton", selectionDialog).Click();
+ };
+
+ using (ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl))
+ {
+ string expectedNewName = NamingHelper.GetUniqueName(failureMechanism.CalculationsGroup.Children, existingCalculationName, c => c.Name);
+
+ // When
+ contextMenu.Items[contextGenerateCalculationsIndexRootGroup].PerformClick();
+
+ // Then
+ var heightStructuresCalculations = failureMechanism.Calculations.OfType().ToArray();
+ Assert.AreEqual(2, heightStructuresCalculations.Length);
+ Assert.AreEqual(expectedNewName, heightStructuresCalculations[1].Name);
+ }
+ }
+ }
+
+ [Test]
public void OnNodeRemoved_NestedCalculationGroup_RemoveGroupAndNotifyObservers()
{
// Setup