Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs =================================================================== diff -u -rd00d30719d5bffa635f40b975e490af4e4c298e9 -re3c05a617948e62ce17efeca48e4229ae73a228b --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision d00d30719d5bffa635f40b975e490af4e4c298e9) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -199,7 +199,7 @@ var calculation = new GrassCoverErosionOutwardsWaveConditionsCalculation(); failureMechanism.WaveConditionsCalculationGroup.Children.Add(calculation); - calculation.InputParameters.HydraulicBoundaryLocation = demoAssessmentSection.HydraulicBoundaryDatabase.Locations.First(hl => hl.Id == 1300001); + calculation.InputParameters.HydraulicBoundaryLocation = failureMechanism.HydraulicBoundaryLocations.First(hl => hl.Id == 1300001); calculation.InputParameters.NotifyObservers(); } Index: Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs =================================================================== diff -u -r95364cd8155bbd5f25bf2ee83b5731fca744373a -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision 95364cd8155bbd5f25bf2ee83b5731fca744373a) +++ Ringtoets/GrassCoverErosionOutwards/src/Ringtoets.GrassCoverErosionOutwards.Plugin/GrassCoverErosionOutwardsPlugin.cs (.../GrassCoverErosionOutwardsPlugin.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -52,6 +52,7 @@ using Ringtoets.GrassCoverErosionOutwards.Plugin.Properties; using Ringtoets.GrassCoverErosionOutwards.Service; using Ringtoets.GrassCoverErosionOutwards.Service.MessageProviders; +using Ringtoets.Revetment.IO.Importers; using RingtoetsGrassCoverErosionOutwardsFormsResources = Ringtoets.GrassCoverErosionOutwards.Forms.Properties.Resources; using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; @@ -97,6 +98,37 @@ yield return new PropertyInfo(); } + 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.FailureMechanism.HydraulicBoundaryLocations, + context.FailureMechanism.ForeshoreProfiles) + }; + } + + 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 @@ -660,7 +692,8 @@ StrictContextMenuItem generateCalculationsItem = CreateGenerateWaveConditionsCalculationsItem(nodeData); - builder.AddExportItem() + builder.AddImportItem() + .AddExportItem() .AddSeparator(); if (!isNestedGroup) Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs =================================================================== diff -u -r4b68fcd10da185da7eef315c45d80a071c6e1bf5 -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision 4b68fcd10da185da7eef315c45d80a071c6e1bf5) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/GrassCoverErosionOutwardsPluginTest.cs (.../GrassCoverErosionOutwardsPluginTest.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -177,6 +177,21 @@ } [Test] + public void GetImportInfos_ReturnsSupportedImportInfos() + { + // Setup + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + // Call + ImportInfo[] importInfos = plugin.GetImportInfos().ToArray(); + + // Assert + Assert.AreEqual(1, importInfos.Length); + Assert.IsTrue(importInfos.Any(i => i.DataType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext))); + } + } + + [Test] public void Activate_GuiNull_ThrowInvalidOperationException() { // Setup Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ImportInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest.cs (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -0,0 +1,210 @@ +// 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.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.Revetment.IO.Importers; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.ImportInfos +{ + [TestFixture] + public class GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextImportInfoTest + { + private ImportInfo importInfo; + private GrassCoverErosionOutwardsPlugin plugin; + + [SetUp] + public void SetUp() + { + plugin = new GrassCoverErosionOutwardsPlugin(); + importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(GrassCoverErosionOutwardsWaveConditionsCalculationGroupContext)); + } + + [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_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 + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + var mocks = new MockRepository(); + IAssessmentSection assessmentSection = AssessmentSectionHelper.CreateAssessmentSectionStubWithoutBoundaryDatabase(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_AllDataAvailable_ReturnTrue() + { + // Setup + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.HydraulicBoundaryLocations.Add(new TestHydraulicBoundaryLocation()); + + 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.IsTrue(isEnabled); + mocks.VerifyAll(); + } + + [Test] + public void CreateFileImporter_Always_ReturnFileImporter() + { + // 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 + IFileImporter importer = importInfo.CreateFileImporter(context, ""); + + // Assert + Assert.IsInstanceOf>(importer); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj =================================================================== diff -u -r2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision 2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -70,6 +70,7 @@ + Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r45440093089496f59ed420e772136756c229e30b -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision 45440093089496f59ed420e772136756c229e30b) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/TreeNodeInfos/GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -52,23 +52,26 @@ [TestFixture] public class GrassCoverErosionOutwardsWaveConditionsCalculationGroupContextTreeNodeInfoTest : 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 const string expectedTextExpandAll = "Alles ui&tklappen"; private const string expectedTextExpandAllToolTip = "Klap dit element en alle onderliggende elementen uit."; private const string expectedTextRename = "&Hernoemen"; @@ -82,7 +85,7 @@ private MockRepository mocks; private GrassCoverErosionOutwardsPlugin plugin; - private TreeNodeInfo info; + private TreeNodeInfo info; [SetUp] public void SetUp() @@ -232,9 +235,10 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); - var updateHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); + var updateHandlerMock = mocks.StrictMock(); var viewCommandsHandler = mocks.StrictMock(); var treeViewControl = mocks.StrictMock(); @@ -260,9 +264,13 @@ 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, + 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); @@ -275,7 +283,7 @@ "Voeg een nieuwe berekening toe aan deze berekeningsmap.", RingtoetsCommonFormsResources.FailureMechanismIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, 5, + TestHelper.AssertContextMenuStripContainsItem(menu, 6, expectedTextRename, expectedTextRenameToolTip, CoreCommonGuiResources.RenameIcon); @@ -294,33 +302,33 @@ "Er zijn geen berekeningen met uitvoer om te wissen.", RingtoetsCommonFormsResources.ClearIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 10, + TestHelper.AssertContextMenuStripContainsItem(menu, 11, expectedTextDelete, expectedTextDeleteToolTip, CoreCommonGuiResources.DeleteIcon); - TestHelper.AssertContextMenuStripContainsItem(menu, 12, + TestHelper.AssertContextMenuStripContainsItem(menu, 13, expectedTextCollapseAll, expectedTextCollapseAllToolTip, CoreCommonGuiResources.CollapseAllIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 13, + TestHelper.AssertContextMenuStripContainsItem(menu, 14, expectedTextExpandAll, expectedTextExpandAllToolTip, CoreCommonGuiResources.ExpandAllIcon, false); - TestHelper.AssertContextMenuStripContainsItem(menu, 15, + TestHelper.AssertContextMenuStripContainsItem(menu, 16, expectedTextProperties, expectedTextPropertiesToolTip, 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)); } } @@ -339,9 +347,10 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); - var updateHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); + var updateHandlerMock = mocks.StrictMock(); var viewCommandsHandler = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) { @@ -364,7 +373,16 @@ 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, "Genereer &berekeningen...", "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de randvoorwaardenberekeningen te genereren.", @@ -414,12 +432,12 @@ false); CollectionAssert.AllItemsAreInstancesOfType(new[] { - menu.Items[1], - menu.Items[3], - menu.Items[9], - menu.Items[6], - 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)); } } @@ -446,9 +464,10 @@ var applicationFeatureCommandHandler = mocks.Stub(); var importHandlerMock = mocks.StrictMock(); + importHandlerMock.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); var exportHandlerMock = mocks.StrictMock(); - var updateHandlerMock = mocks.StrictMock(); exportHandlerMock.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); + var updateHandlerMock = mocks.StrictMock(); var viewCommandsHandler = mocks.StrictMock(); using (var treeViewControl = new TreeViewControl()) { @@ -471,7 +490,16 @@ 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, "Genereer &berekeningen...", "Genereer randvoorwaardenberekeningen.", @@ -521,12 +549,12 @@ 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)); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r19d2c2e6cd9b096eb1a561d48c8e38b80ed8cac2 -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision 19d2c2e6cd9b096eb1a561d48c8e38b80ed8cac2) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/TreeNodeInfos/PipingCalculationGroupContextTreeNodeInfoTest.cs (.../PipingCalculationGroupContextTreeNodeInfoTest.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -212,8 +212,10 @@ assessmentSection); var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); + var importHandler = mocks.StrictMock(); + importHandler.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); + var exportHandler = mocks.StrictMock(); + exportHandler.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); var updateHandler = mocks.Stub(); var viewCommandsHandler = mocks.Stub(); var treeViewControl = mocks.StrictMock(); @@ -245,14 +247,12 @@ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportCalculationGroupIndexNestedGroup, "&Importeren...", "Importeer de gegevens vanuit een bestand.", - CoreCommonGuiResources.ImportIcon, - false); + CoreCommonGuiResources.ImportIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExportCalculationGroupIndexNestedGroup, "&Exporteren...", "Exporteer de gegevens naar een bestand.", - CoreCommonGuiResources.ExportIcon, - false); + CoreCommonGuiResources.ExportIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexNestedGroup, "&Map toevoegen", @@ -337,8 +337,10 @@ assessmentSection); var applicationFeatureCommandHandler = mocks.Stub(); - var importHandler = mocks.Stub(); - var exportHandler = mocks.Stub(); + var importHandler = mocks.StrictMock(); + importHandler.Expect(ihm => ihm.CanImportOn(nodeData)).Return(true); + var exportHandler = mocks.StrictMock(); + exportHandler.Expect(ehm => ehm.CanExportFrom(nodeData)).Return(true); var updateHandler = mocks.Stub(); var viewCommandsHandler = mocks.StrictMock(); @@ -370,14 +372,12 @@ TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuImportCalculationGroupIndexRootGroup, "&Importeren...", "Importeer de gegevens vanuit een bestand.", - CoreCommonGuiResources.ImportIcon, - false); + CoreCommonGuiResources.ImportIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuExportCalculationGroupIndexRootGroup, "&Exporteren...", "Exporteer de gegevens naar een bestand.", - CoreCommonGuiResources.ExportIcon, - false); + CoreCommonGuiResources.ExportIcon); TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuAddCalculationGroupIndexRootGroup, "&Map toevoegen", Index: Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs =================================================================== diff -u -r28b8182ae19e0d84eb705a013149c05ef99a94dc -re3c05a617948e62ce17efeca48e4229ae73a228b --- Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision 28b8182ae19e0d84eb705a013149c05ef99a94dc) +++ Ringtoets/Revetment/src/Ringtoets.Revetment.IO/Importers/WaveConditionsCalculationConfigurationImporter.cs (.../WaveConditionsCalculationConfigurationImporter.cs) (revision e3c05a617948e62ce17efeca48e4229ae73a228b) @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using Core.Common.Base.Data; using Ringtoets.Common.Data.Calculation; @@ -172,8 +173,10 @@ { if (readCalculation.StepSize != null) { + var stepSize = (double) readCalculation.StepSize; + calculation.InputParameters.StepSize = (WaveConditionsInputStepSize) - new WaveConditionsInputStepSizeTypeConverter().ConvertFrom(readCalculation.StepSize.ToString()); + new WaveConditionsInputStepSizeTypeConverter().ConvertFrom(stepSize.ToString("0.0")); } }