Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs =================================================================== diff -u -r2ebbb31d6c849c49e02f04ac49374594703dc5ec -r67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 2ebbb31d6c849c49e02f04ac49374594703dc5ec) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/DuneErosionPlugin.cs (.../DuneErosionPlugin.cs) (revision 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77) @@ -21,7 +21,6 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Windows.Forms; using Core.Common.Base; @@ -63,6 +62,7 @@ CreateInstance = context => new DuneErosionFailureMechanismProperties(context.WrappedData, new DuneErosionFailureMechanismPropertyChangeHandler()) }; + yield return new PropertyInfo { CreateInstance = context => new DuneLocationCalculationsProperties(context.WrappedData) @@ -103,7 +103,7 @@ { Text = context => context.CategoryBoundaryName, Image = context => RingtoetsCommonFormsResources.GenericInputOutputIcon, - ContextMenuStrip = DuneLocationsContextMenuStrip + ContextMenuStrip = DuneLocationCalculationsContextMenuStrip }; } @@ -304,7 +304,7 @@ #endregion - #region DuneLocationsContext TreeNodeInfo + #region DuneLocationCalculationsContext TreeNodeInfo private static string ValidateAllDataAvailableAndGetErrorMessage(IAssessmentSection assessmentSection, double failureMechanismContribution) @@ -317,11 +317,11 @@ return HydraulicBoundaryDatabaseConnectionValidator.Validate(assessmentSection.HydraulicBoundaryDatabase); } - private ContextMenuStrip DuneLocationsContextMenuStrip(DuneLocationCalculationsContext context, object parent, TreeViewControl treeViewControl) + private ContextMenuStrip DuneLocationCalculationsContextMenuStrip(DuneLocationCalculationsContext context, object parent, TreeViewControl treeViewControl) { var calculateAllItem = new StrictContextMenuItem( RingtoetsCommonFormsResources.Calculate_all, - Resources.DuneErosionPlugin_DuneLocationsContextMenuStrip_Calculate_all_ToolTip, + Resources.DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_all_ToolTip, RingtoetsCommonFormsResources.CalculateAllIcon, (sender, args) => { Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -r07a49c4b3a674477dde39e753bfab49ead03ae99 -r67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 07a49c4b3a674477dde39e753bfab49ead03ae99) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77) @@ -84,9 +84,9 @@ /// /// Looks up a localized string similar to Alle hydraulische randvoorwaarden berekenen.. /// - internal static string DuneErosionPlugin_DuneLocationsContextMenuStrip_Calculate_all_ToolTip { + internal static string DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_all_ToolTip { get { - return ResourceManager.GetString("DuneErosionPlugin_DuneLocationsContextMenuStrip_Calculate_all_ToolTip", resourceCulture); + return ResourceManager.GetString("DuneErosionPlugin_DuneLocationCalculationsContextMenuStrip_Calculate_all_ToolTip", resourceCulture); } } Index: Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx =================================================================== diff -u -r07a49c4b3a674477dde39e753bfab49ead03ae99 -r67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77 --- Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 07a49c4b3a674477dde39e753bfab49ead03ae99) +++ Ringtoets/DuneErosion/src/Ringtoets.DuneErosion.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77) @@ -117,7 +117,7 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + Alle hydraulische randvoorwaarden berekenen. Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ExportInfos/DuneLocationCalculationsContextExportInfoTest.cs =================================================================== diff -u --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ExportInfos/DuneLocationCalculationsContextExportInfoTest.cs (revision 0) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ExportInfos/DuneLocationCalculationsContextExportInfoTest.cs (revision 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77) @@ -0,0 +1,177 @@ +// Copyright (C) Stichting Deltares 2017. 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.Linq; +using Core.Common.Base; +using Core.Common.Base.IO; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using Core.Common.Util; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.DuneErosion.Data; +using Ringtoets.DuneErosion.Data.TestUtil; +using Ringtoets.DuneErosion.Forms.PresentationObjects; +using Ringtoets.DuneErosion.IO; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Ringtoets.DuneErosion.Plugin.Test.ExportInfos +{ + [TestFixture] + public class DuneLocationCalculationsContextExportInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new DuneErosionPlugin()) + { + // Call + ExportInfo info = GetExportInfo(plugin); + + // Assert + Assert.IsNotNull(info.CreateFileExporter); + Assert.IsNotNull(info.IsEnabled); + Assert.AreEqual("Hydraulische randvoorwaarden", info.Name); + Assert.AreEqual("Algemeen", info.Category); + TestHelper.AssertImagesAreEqual(CoreCommonGuiResources.ExportIcon, info.Image); + Assert.IsNotNull(info.FileFilterGenerator); + } + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var context = new DuneLocationCalculationsContext(new ObservableList(), + new DuneErosionFailureMechanism(), + assessmentSection, + () => 0.01, + "Category Boundary Name"); + + using (var plugin = new DuneErosionPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + IFileExporter fileExporter = info.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + } + + mocks.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Setup + using (var plugin = new DuneErosionPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + FileFilterGenerator fileFilterGenerator = info.FileFilterGenerator; + + // Assert + Assert.AreEqual("MorphAn randvoorwaarden (*.bnd)|*.bnd", fileFilterGenerator.Filter); + } + } + + [Test] + public void IsEnabled_CalculationsWithoutOutput_ReturnFalse() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var duneLocationCalculations = new ObservableList + { + new DuneLocationCalculation(new TestDuneLocation()) + }; + var context = new DuneLocationCalculationsContext(duneLocationCalculations, + new DuneErosionFailureMechanism(), + assessmentSection, + () => 0.01, + "Category Boundary Name"); + + using (var plugin = new DuneErosionPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + bool isEnabled = info.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + } + + mocks.VerifyAll(); + } + + [Test] + public void IsEnabled_CalculationsWithOutput_ReturnTrue() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var duneLocationCalculations = new ObservableList + { + new DuneLocationCalculation(new TestDuneLocation()) + { + Output = new TestDuneLocationCalculationOutput() + } + }; + var context = new DuneLocationCalculationsContext(duneLocationCalculations, + new DuneErosionFailureMechanism(), + assessmentSection, + () => 0.01, + "Category Boundary Name"); + + using (var plugin = new DuneErosionPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + bool isEnabled = info.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + } + + mocks.VerifyAll(); + } + + private static ExportInfo GetExportInfo(DuneErosionPlugin plugin) + { + return plugin.GetExportInfos().First(ei => ei.DataType == typeof(DuneLocationCalculationsContext)); + } + } +} \ No newline at end of file Fisheye: Tag 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77 refers to a dead (removed) revision in file `Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/ExportInfos/DuneLocationsContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj =================================================================== diff -u -rf5b1a012a17bbfb50abc6e7e1f95599cbcefef3f -r67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj (.../Ringtoets.DuneErosion.Plugin.Test.csproj) (revision f5b1a012a17bbfb50abc6e7e1f95599cbcefef3f) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Plugin.Test/Ringtoets.DuneErosion.Plugin.Test.csproj (.../Ringtoets.DuneErosion.Plugin.Test.csproj) (revision 67af89e6b7c9dcdb24e711f92bd3b8d5c1f32c77) @@ -22,7 +22,7 @@ - +