Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -re3c05a617948e62ce17efeca48e4229ae73a228b -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -115,20 +115,6 @@ }; } - private static FileFilterGenerator CalculationConfigurationFileFilter - { - get - { - return new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension, - RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description); - } - } - - private static bool CalculationConfigurationImporterEnabled(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext context) - { - return context.FailureMechanism.HydraulicBoundaryLocations.Any(); - } - public override IEnumerable GetViewInfos() { yield return new ViewInfo @@ -355,6 +341,20 @@ hydraulicBoundaryLocationCalculationGuiService = new HydraulicBoundaryLocationCalculationGuiService(Gui.MainWindow); } + private static FileFilterGenerator CalculationConfigurationFileFilter + { + get + { + return new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension, + RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description); + } + } + + private static bool CalculationConfigurationImporterEnabled(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext context) + { + return context.FailureMechanism.HydraulicBoundaryLocations.Any(); + } + #region ViewInfos #region GrassCoverErosionOutwardsFailureMechanismView ViewInfo Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs =================================================================== diff -u -re3c05a617948e62ce17efeca48e4229ae73a228b -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -97,50 +97,6 @@ } [Test] - public void IsEnabled_NoSurfaceLines_ReturnFalse() - { - // Setup - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var context = new GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext(new CalculationGroup(), - failureMechanism, - assessmentSection); - - // Call - bool isEnabled = importInfo.IsEnabled(context); - - // Assert - Assert.IsFalse(isEnabled); - mocks.VerifyAll(); - } - - [Test] - public void IsEnabled_NoSoilModels_ReturnFalse() - { - // Setup - var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); - - var mocks = new MockRepository(); - IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); - mocks.ReplayAll(); - - var context = new GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext(new CalculationGroup(), - failureMechanism, - assessmentSection); - - // Call - bool isEnabled = importInfo.IsEnabled(context); - - // Assert - Assert.IsFalse(isEnabled); - mocks.VerifyAll(); - } - - [Test] public void IsEnabled_NoHydraulicBoundaryDatabase_ReturnFalse() { // Setup Index: Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs =================================================================== diff -u -r92df0a0ac0a4e0ccd5d7505d748f55167c2aac81 -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision 92df0a0ac0a4e0ccd5d7505d748f55167c2aac81) +++ Ringtoets/StabilityStoneCover/src/Ringtoets.StabilityStoneCover.Plugin/StabilityStoneCoverPlugin.cs (.../StabilityStoneCoverPlugin.cs) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -38,6 +38,7 @@ using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.Common.Service; +using Ringtoets.Revetment.IO.Importers; using Ringtoets.StabilityStoneCover.Data; using Ringtoets.StabilityStoneCover.Forms; using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; @@ -151,6 +152,23 @@ }; } + public override IEnumerable GetImportInfos() + { + yield return new ImportInfo + { + Name = RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description, + Category = RingtoetsCommonFormsResources.Ringtoets_Category, + Image = RingtoetsCommonFormsResources.GeneralFolderIcon, + FileFilterGenerator = CalculationConfigurationFileFilter, + IsEnabled = CalculationConfigurationImporterEnabled, + CreateFileImporter = (context, filePath) => new WaveConditionsCalculationConfigurationImporter( + filePath, + context.WrappedData, + context.AssessmentSection.HydraulicBoundaryDatabase.Locations, + context.FailureMechanism.ForeshoreProfiles) + }; + } + public override IEnumerable GetExportInfos() { yield return new ExportInfo @@ -199,6 +217,21 @@ }; } + private static FileFilterGenerator CalculationConfigurationFileFilter + { + get + { + return new FileFilterGenerator(RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Extension, + RingtoetsCommonFormsResources.DataTypeDisplayName_xml_file_filter_Description); + } + } + + private static bool CalculationConfigurationImporterEnabled(StabilityStoneCoverWaveConditionsCalculationGroupContext context) + { + return context.AssessmentSection.HydraulicBoundaryDatabase != null + && context.AssessmentSection.HydraulicBoundaryDatabase.Locations.Any(); + } + #region ViewInfos #region StabilityStoneCoverFailureMechanismView ViewInfo @@ -365,7 +398,8 @@ var builder = new RingtoetsContextMenuBuilder(Gui.Get(nodeData, treeViewControl)); var isNestedGroup = parentData is StabilityStoneCoverWaveConditionsCalculationGroupContext; - builder.AddExportItem() + builder.AddImportItem() + .AddExportItem() .AddSeparator(); if (!isNestedGroup) Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ImportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextImportInfoTest.cs =================================================================== diff -u --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ImportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextImportInfoTest.cs (revision 0) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/ImportInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextImportInfoTest.cs (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -0,0 +1,165 @@ +// 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. + +using System.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Calculation; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Revetment.IO.Importers; +using Ringtoets.StabilityStoneCover.Data; +using Ringtoets.StabilityStoneCover.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.StabilityStoneCover.Plugin.Test.ImportInfos +{ + [TestFixture] + public class StabilityStoneCoverWaveConditionsCalculationGroupContextImportInfoTest + { + private ImportInfo importInfo; + private StabilityStoneCoverPlugin plugin; + + [SetUp] + public void SetUp() + { + plugin = new StabilityStoneCoverPlugin(); + importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(StabilityStoneCoverWaveConditionsCalculationGroupContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Name_Always_ReturnExpectedName() + { + // Call + string name = importInfo.Name; + + // Assert + Assert.AreEqual("Ringtoets berekeningenconfiguratie", name); + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = importInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedIcon() + { + // Call + Image image = importInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralFolderIcon, image); + } + + [Test] + public void FileFilterGenerator_Always_ReturnExpectedFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Ringtoets berekeningenconfiguratie (*.xml)|*.xml", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_NoHydraulicBoundaryDatabase_ReturnFalse() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStubWithoutBoundaryDatabase(failureMechanism, mocks); + mocks.ReplayAll(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + failureMechanism, + assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_AllDataAvailable_ReturnTrue() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + failureMechanism, + assessmentSection); + + // Call + bool isEnabled = importInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void CreateFileImporter_Always_ReturnFileImporter() + { + // Setup + var failureMechanism = new StabilityStoneCoverFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStub(failureMechanism, mocks); + mocks.ReplayAll(); + + var context = new StabilityStoneCoverWaveConditionsCalculationGroupContext(new CalculationGroup(), + failureMechanism, + assessmentSection); + + // Call + IFileImporter importer = importInfo.CreateFileImporter(context, ""); + + // Assert + Assert.IsInstanceOf>(importer); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj =================================================================== diff -u -r882ef058f189a4e44514d192fd396590b0d9af35 -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision 882ef058f189a4e44514d192fd396590b0d9af35) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/Ringtoets.StabilityStoneCover.Plugin.Test.csproj (.../Ringtoets.StabilityStoneCover.Plugin.Test.csproj) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -67,6 +67,7 @@ + Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs =================================================================== diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/StabilityStoneCoverPluginTest.cs (.../StabilityStoneCoverPluginTest.cs) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -124,5 +124,20 @@ Assert.AreEqual(2, exportInfos.Count(ei => ei.DataType == typeof(StabilityStoneCoverWaveConditionsCalculationContext))); } } + + [Test] + public void GetImportInfos_ReturnsSupportedImportInfos() + { + // Setup + using (var plugin = new StabilityStoneCoverPlugin()) + { + // Call + ImportInfo[] importInfos = plugin.GetImportInfos().ToArray(); + + // Assert + Assert.AreEqual(1, importInfos.Length); + Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(StabilityStoneCoverWaveConditionsCalculationGroupContext))); + } + } } } \ No newline at end of file Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r45440093089496f59ed420e772136756c229e30b -ra2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7 --- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 45440093089496f59ed420e772136756c229e30b) +++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Plugin.Test/TreeNodeInfos/StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision a2c2136a5fa7cee2cc0fa9a61fd40bf0428c83c7) @@ -54,23 +54,26 @@ [TestFixture] public class StabilityStoneCoverWaveConditionsCalculationGroupContextTreeNodeInfoTest : NUnitFormTest { - private const int contextMenuAddGenerateCalculationsIndex = 2; - private const int contextMenuAddCalculationGroupIndexRootGroup = 4; - private const int contextMenuAddCalculationIndexRootGroup = 5; - private const int contextMenuValidateAllIndexRootGroup = 7; - private const int contextMenuCalculateAllIndexRootGroup = 8; - private const int contextMenuClearOutputIndexRootGroup = 10; - private const int contextMenuRemoveAllChildrenIndexRootGroup = 11; - private const int contextMenuCollapseAllIndexRootGroup = 13; - private const int contextMenuExpandAllIndexRootGroup = 14; - private const int contextMenuPropertiesIndexRootGroup = 16; + private const int contextMenuImportConfigurationIndex = 0; + private const int contextMenuExportConfigurationIndex = 1; - private const int contextMenuAddCalculationGroupIndexNestedGroup = 2; - private const int contextMenuAddCalculationIndexNestedGroup = 3; - private const int contextMenuValidateAllIndexNestedGroup = 6; - private const int contextMenuCalculateAllIndexNestedGroup = 7; - private const int contextMenuClearOutputIndexNestedGroup = 9; + private const int contextMenuAddGenerateCalculationsIndex = 3; + private const int contextMenuAddCalculationGroupIndexRootGroup = 5; + private const int contextMenuAddCalculationIndexRootGroup = 6; + private const int contextMenuValidateAllIndexRootGroup = 8; + private const int contextMenuCalculateAllIndexRootGroup = 9; + private const int contextMenuClearOutputIndexRootGroup = 11; + private const int contextMenuRemoveAllChildrenIndexRootGroup = 12; + private const int contextMenuCollapseAllIndexRootGroup = 14; + private const int contextMenuExpandAllIndexRootGroup = 15; + private const int contextMenuPropertiesIndexRootGroup = 17; + private const int contextMenuAddCalculationGroupIndexNestedGroup = 3; + private const int contextMenuAddCalculationIndexNestedGroup = 4; + private const int contextMenuValidateAllIndexNestedGroup = 7; + private const int contextMenuCalculateAllIndexNestedGroup = 8; + private const int contextMenuClearOutputIndexNestedGroup = 10; + private MockRepository mocks; private StabilityStoneCoverPlugin plugin; private TreeNodeInfo info; @@ -225,6 +228,7 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); var updateHandlerMock = mocks.StrictMock(); @@ -254,33 +258,37 @@ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, parentNodeData, treeViewControl)) { // Assert - Assert.AreEqual(16, menu.Items.Count); + Assert.AreEqual(17, menu.Items.Count); - TestHelper.AssertContextMenuStripContainsItem(menu, 0, - CoreCommonGuiResources.Export, - CoreCommonGuiResources.Export_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportConfigurationIndex, + "&Importeren...", + "Importeer de gegevens vanuit een bestand.", + CoreCommonGuiResources.ImportIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExportConfigurationIndex, + "&Exporteren...", + "Exporteer de gegevens naar een bestand.", CoreCommonGuiResources.ExportIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexNestedGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup, + "&Map toevoegen", "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.AddFolderIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexNestedGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation, + "Berekening &toevoegen", "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, 5, - CoreCommonGuiResources.Rename, - CoreCommonGuiResources.Rename_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, 6, + "&Hernoemen", + "Wijzig de naam van dit element.", CoreCommonGuiResources.RenameIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexNestedGroup, - RingtoetsCommonFormsResources.Validate_all, + "Alles &valideren", "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexNestedGroup, - RingtoetsCommonFormsResources.Calculate_all, + "Alles be&rekenen", "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); @@ -290,35 +298,35 @@ RingtoetsCommonFormsResources.ClearIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 10, - CoreCommonGuiResources.Delete, - CoreCommonGuiResources.Delete_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, 11, + "Verwij&deren...", + "Verwijder dit element uit de boom.", CoreCommonGuiResources.DeleteIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, 12, - CoreCommonGuiResources.Collapse_all, - CoreCommonGuiResources.Collapse_all_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, 13, + "Alles i&nklappen", + "Klap dit element en alle onderliggende elementen in.", CoreCommonGuiResources.CollapseAllIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 13, - CoreCommonGuiResources.Expand_all, - CoreCommonGuiResources.Expand_all_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, 14, + "Alles ui&tklappen", + "Klap dit element en alle onderliggende elementen uit.", CoreCommonGuiResources.ExpandAllIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 15, - CoreCommonGuiResources.Properties, - CoreCommonGuiResources.Properties_ToolTip, + TestHelper.AssertContextMenuStripContainsItem(menu, 16, + "Ei&genschappen", + "Toon de eigenschappen in het Eigenschappenpaneel.", CoreCommonGuiResources.PropertiesHS, false); CollectionAssert.AllItemsAreInstancesOfType(new[] { - menu.Items[1], - menu.Items[4], - menu.Items[8], - menu.Items[11], - menu.Items[14] + menu.Items[2], + menu.Items[5], + menu.Items[9], + menu.Items[12], + menu.Items[15] }, typeof(ToolStripSeparator)); } } @@ -337,6 +345,7 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); var updateHandlerMock = mocks.StrictMock(); @@ -362,17 +371,27 @@ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert - Assert.AreEqual(17, menu.Items.Count); + Assert.AreEqual(18, menu.Items.Count); + + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportConfigurationIndex, + "&Importeren...", + "Importeer de gegevens vanuit een bestand.", + CoreCommonGuiResources.ImportIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExportConfigurationIndex, + "&Exporteren...", + "Exporteer de gegevens naar een bestand.", + CoreCommonGuiResources.ExportIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddGenerateCalculationsIndex, - RingtoetsCommonFormsResources.CalculationGroup_Generate_calculations, + "Genereer &berekeningen...", "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de randvoorwaardenberekeningen te genereren.", RingtoetsCommonFormsResources.GenerateScenariosIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup, + "&Map toevoegen", "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.AddFolderIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation, + "Berekening &toevoegen", "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRemoveAllChildrenIndexRootGroup, @@ -381,12 +400,12 @@ CoreCommonGuiResources.DeleteChildrenIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, + "Alles &valideren", "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, + "Alles be&rekenen", "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); @@ -396,28 +415,28 @@ RingtoetsCommonFormsResources.ClearIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExpandAllIndexRootGroup, - CoreCommonGuiResources.Expand_all, - CoreCommonGuiResources.Expand_all_ToolTip, + "Alles ui&tklappen", + "Klap dit element en alle onderliggende elementen uit.", CoreCommonGuiResources.ExpandAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCollapseAllIndexRootGroup, - CoreCommonGuiResources.Collapse_all, - CoreCommonGuiResources.Collapse_all_ToolTip, + "Alles i&nklappen", + "Klap dit element en alle onderliggende elementen in.", CoreCommonGuiResources.CollapseAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuPropertiesIndexRootGroup, - CoreCommonGuiResources.Properties, - CoreCommonGuiResources.Properties_ToolTip, + "Ei&genschappen", + "Toon de eigenschappen in het Eigenschappenpaneel.", CoreCommonGuiResources.PropertiesHS, false); CollectionAssert.AllItemsAreInstancesOfType(new[] { - menu.Items[1], - menu.Items[3], - menu.Items[6], - menu.Items[9], - menu.Items[12], - menu.Items[15] + menu.Items[2], + menu.Items[4], + menu.Items[7], + menu.Items[10], + menu.Items[13], + menu.Items[16] }, typeof(ToolStripSeparator)); } } @@ -443,6 +462,7 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); var updateHandlerMock = mocks.StrictMock(); @@ -468,17 +488,27 @@ using (ContextMenuStrip menu = info.ContextMenuStrip(nodeData, null, treeViewControl)) { // Assert - Assert.AreEqual(17, menu.Items.Count); + Assert.AreEqual(18, menu.Items.Count); + + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportConfigurationIndex, + "&Importeren...", + "Importeer de gegevens vanuit een bestand.", + CoreCommonGuiResources.ImportIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExportConfigurationIndex, + "&Exporteren...", + "Exporteer de gegevens naar een bestand.", + CoreCommonGuiResources.ExportIcon); + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddGenerateCalculationsIndex, - RingtoetsCommonFormsResources.CalculationGroup_Generate_calculations, + "Genereer &berekeningen...", "Genereer randvoorwaardenberekeningen.", RingtoetsCommonFormsResources.GenerateScenariosIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_CalculationGroup, + "&Map toevoegen", "Voeg een nieuwe berekeningsmap toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.AddFolderIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationIndexRootGroup, - RingtoetsCommonFormsResources.CalculationGroup_Add_Calculation, + "Berekening &toevoegen", "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRemoveAllChildrenIndexRootGroup, @@ -487,12 +517,12 @@ CoreCommonGuiResources.DeleteChildrenIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuValidateAllIndexRootGroup, - RingtoetsCommonFormsResources.Validate_all, + "Alles &valideren", "Er zijn geen berekeningen om te valideren.", RingtoetsCommonFormsResources.ValidateAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCalculateAllIndexRootGroup, - RingtoetsCommonFormsResources.Calculate_all, + "Alles be&rekenen", "Er zijn geen berekeningen om uit te voeren.", RingtoetsCommonFormsResources.CalculateAllIcon, false); @@ -502,28 +532,28 @@ RingtoetsCommonFormsResources.ClearIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExpandAllIndexRootGroup, - CoreCommonGuiResources.Expand_all, - CoreCommonGuiResources.Expand_all_ToolTip, + "Alles ui&tklappen", + "Klap dit element en alle onderliggende elementen uit.", CoreCommonGuiResources.ExpandAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuCollapseAllIndexRootGroup, - CoreCommonGuiResources.Collapse_all, - CoreCommonGuiResources.Collapse_all_ToolTip, + "Alles i&nklappen", + "Klap dit element en alle onderliggende elementen in.", CoreCommonGuiResources.CollapseAllIcon, false); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuPropertiesIndexRootGroup, - CoreCommonGuiResources.Properties, - CoreCommonGuiResources.Properties_ToolTip, + "Ei&genschappen", + "Toon de eigenschappen in het Eigenschappenpaneel.", CoreCommonGuiResources.PropertiesHS, false); CollectionAssert.AllItemsAreInstancesOfType(new[] { - menu.Items[1], - menu.Items[3], - menu.Items[6], - menu.Items[9], - menu.Items[12], - menu.Items[15] + menu.Items[2], + menu.Items[4], + menu.Items[7], + menu.Items[10], + menu.Items[13], + menu.Items[16] }, typeof(ToolStripSeparator)); } }