Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs =================================================================== diff -u -r5b46971d57aa713831894a0038510017b0c1e3c3 -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs (.../DesignWaterLevelLocationContext.cs) (revision 5b46971d57aa713831894a0038510017b0c1e3c3) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationContext.cs (.../DesignWaterLevelLocationContext.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -26,12 +26,13 @@ namespace Ringtoets.Integration.Forms.PresentationObjects { /// - /// Presentation object for all data required to configure an instance of . + /// Presentation object for all data required to configure an instance of + /// with . /// public class DesignWaterLevelLocationContext : ObservableWrappedObjectContextBase { /// - /// Creates a new instance of . + /// Creates a new instance of . /// /// The which the belongs to. /// Thrown when is null. Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs =================================================================== diff -u -r5b46971d57aa713831894a0038510017b0c1e3c3 -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs (.../DesignWaterLevelLocationsContext.cs) (revision 5b46971d57aa713831894a0038510017b0c1e3c3) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/DesignWaterLevelLocationsContext.cs (.../DesignWaterLevelLocationsContext.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -22,11 +22,13 @@ using System; using Core.Common.Controls.PresentationObjects; using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; namespace Ringtoets.Integration.Forms.PresentationObjects { /// - /// Presentation object for all data required to configure an instance of . + /// Presentation object for all data required to configure an enumeration of + /// with . /// public class DesignWaterLevelLocationsContext : ObservableWrappedObjectContextBase { Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightContext.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/WaveHeightLocationsContext.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,42 @@ +// 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; +using Core.Common.Controls.PresentationObjects; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PresentationObjects +{ + /// + /// Presentation object for all data required to configure an enumeration of + /// with . + /// + public class WaveHeightLocationsContext : ObservableWrappedObjectContextBase + { + /// + /// Creates a new instance of . + /// + /// The which the belongs to. + /// Thrown when is null. + public WaveHeightLocationsContext(IAssessmentSection wrappedAssessmentSection) : base(wrappedAssessmentSection) {} + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -rfea3ed82dfb6dfcad535eef16efcbaa9c01564ed -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fea3ed82dfb6dfcad535eef16efcbaa9c01564ed) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -1,28 +1,7 @@ -// 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.17929 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -308,20 +287,20 @@ } /// - /// Looks up a localized string similar to Toetspeilen. + /// Looks up a localized string similar to Er is geen hydraulische randvoorwaardendatabase beschikbaar om de toetspeilen te berekenen.. /// - public static string DesignWaterLevel_DisplayName { + public static string DesignWaterLevel_No_HRD_To_Calculate { get { - return ResourceManager.GetString("DesignWaterLevel_DisplayName", resourceCulture); + return ResourceManager.GetString("DesignWaterLevel_No_HRD_To_Calculate", resourceCulture); } } /// - /// Looks up a localized string similar to Er is geen hydraulische randvoorwaardendatabase beschikbaar om de toetspeilen te berekenen.. + /// Looks up a localized string similar to Toetspeilen. /// - public static string DesignWaterLevel_No_HRD_To_Calculate { + public static string DesignWaterLevelLocationsContext_DisplayName { get { - return ResourceManager.GetString("DesignWaterLevel_No_HRD_To_Calculate", resourceCulture); + return ResourceManager.GetString("DesignWaterLevelLocationsContext_DisplayName", resourceCulture); } } @@ -744,9 +723,9 @@ /// /// Looks up a localized string similar to Golfhoogtes. /// - public static string WaveHeightContext_DisplayName { + public static string WaveHeightLocationsContext_DisplayName { get { - return ResourceManager.GetString("WaveHeightContext_DisplayName", resourceCulture); + return ResourceManager.GetString("WaveHeightLocationsContext_DisplayName", resourceCulture); } } } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx =================================================================== diff -u -r2eddebcc1427cfc1d806fdb8c6bce6b5f9df6bde -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2eddebcc1427cfc1d806fdb8c6bce6b5f9df6bde) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Properties/Resources.resx (.../Resources.resx) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -299,10 +299,10 @@ T&raject toevoegen... - + Toetspeilen - + Golfhoogtes Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationContextProperties.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,87 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Gui.Attributes; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Properties; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of with for properties panel. + /// + public class DesignWaterLevelLocationContextProperties : HydraulicBoundaryLocationProperties + { + [PropertyOrder(1)] + public override long Id + { + get + { + return base.Id; + } + } + + [PropertyOrder(2)] + public override string Name + { + get + { + return base.Name; + } + } + + [PropertyOrder(3)] + public override Point2D Location + { + get + { + return base.Location; + } + } + + [PropertyOrder(4)] + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_DisplayName")] + [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DesignWaterLevel_Description")] + public string DesignWaterLevel + { + get + { + return double.IsNaN(data.DesignWaterLevel) ? string.Empty : new RoundedDouble(2, data.DesignWaterLevel).ToString(); + } + } + + [PropertyOrder(5)] + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Convergence_DisplayName")] + [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Convergence_DesignWaterLevel_Description")] + public bool Convergence + { + get + { + return data.DesignWaterLevelCalculationConvergence; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs (.../DesignWaterLevelLocationsContextProperties.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/DesignWaterLevelLocationsContextProperties.cs (.../DesignWaterLevelLocationsContextProperties.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -30,19 +30,20 @@ namespace Ringtoets.Integration.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// ViewModel of an enumeration of with + /// for properties panel. /// public class DesignWaterLevelLocationsContextProperties : ObjectProperties { [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesCategory(typeof(Resources), "Categories_General")] [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DisplayName")] [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_Description")] - public HydraulicBoundaryLocationDesignWaterLevelProperties[] Locations + public DesignWaterLevelLocationContextProperties[] Locations { get { - return data.Locations.Select(loc => new HydraulicBoundaryLocationDesignWaterLevelProperties + return data.Locations.Select(loc => new DesignWaterLevelLocationContextProperties { Data = loc }).ToArray(); Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/HydraulicBoundaryLocationWaveHeightProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightContextProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationContextProperties.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,87 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Gui.Attributes; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Properties; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of with for properties panel. + /// + public class WaveHeightLocationContextProperties : HydraulicBoundaryLocationProperties + { + [PropertyOrder(1)] + public override long Id + { + get + { + return base.Id; + } + } + + [PropertyOrder(2)] + public override string Name + { + get + { + return base.Name; + } + } + + [PropertyOrder(3)] + public override Point2D Location + { + get + { + return base.Location; + } + } + + [PropertyOrder(4)] + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_DisplayName")] + [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_WaveHeight_Description")] + public string WaveHeight + { + get + { + return double.IsNaN(data.WaveHeight) ? string.Empty : new RoundedDouble(2, data.WaveHeight).ToString(); + } + } + + [PropertyOrder(5)] + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Convergence_DisplayName")] + [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Convergence_WaveHeight_Description")] + public bool Convergence + { + get + { + return data.WaveHeightCalculationConvergence; + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/WaveHeightLocationsContextProperties.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,53 @@ +// 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.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Properties; +using Ringtoets.HydraRing.Data; + +namespace Ringtoets.Integration.Forms.PropertyClasses +{ + /// + /// ViewModel of an enumeration of with + /// for properties panel. + /// + public class WaveHeightLocationsContextProperties : ObjectProperties + { + [TypeConverter(typeof(ExpandableArrayConverter))] + [ResourcesCategory(typeof(Resources), "Categories_General")] + [ResourcesDisplayName(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_DisplayName")] + [ResourcesDescription(typeof(Properties.Resources), "HydraulicBoundaryDatabase_Locations_Description")] + public WaveHeightLocationContextProperties[] Locations + { + get + { + return data.Locations.Select(loc => new WaveHeightLocationContextProperties + { + Data = loc + }).ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r6f741425dc85f3d9d868d76002a92aa9bd3cb6cb -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 6f741425dc85f3d9d868d76002a92aa9bd3cb6cb) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -56,12 +56,12 @@ - + - - + + @@ -73,7 +73,7 @@ - + Form Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -261,11 +261,11 @@ { GetObjectPropertiesData = context => context.WrappedData.HydraulicBoundaryDatabase }; - yield return new PropertyInfo + yield return new PropertyInfo { GetObjectPropertiesData = context => context.WrappedData }; - yield return new PropertyInfo + yield return new PropertyInfo { GetObjectPropertiesData = context => context.WrappedData.HydraulicBoundaryDatabase }; @@ -291,7 +291,7 @@ yield return new ViewInfo { - GetViewName = (v, o) => RingtoetsFormsResources.DesignWaterLevel_DisplayName, + GetViewName = (v, o) => RingtoetsFormsResources.DesignWaterLevelLocationsContext_DisplayName, GetViewData = context => context.WrappedData, Image = RingtoetsCommonFormsResources.GenericInputOutputIcon, AfterCreate = (view, context) => @@ -486,22 +486,22 @@ yield return new TreeNodeInfo { - Text = designWaterLevel => RingtoetsFormsResources.DesignWaterLevel_DisplayName, + Text = designWaterLevel => RingtoetsFormsResources.DesignWaterLevelLocationsContext_DisplayName, Image = designWaterLevel => RingtoetsCommonFormsResources.GenericInputOutputIcon, ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ? Color.FromKnownColor(KnownColor.GrayText) : Color.FromKnownColor(KnownColor.ControlText), - ContextMenuStrip = DesignWaterLevelContextMenuStrip + ContextMenuStrip = DesignWaterLevelLocationsContextMenuStrip }; - yield return new TreeNodeInfo + yield return new TreeNodeInfo { - Text = waveHeight => RingtoetsFormsResources.WaveHeightContext_DisplayName, + Text = waveHeight => RingtoetsFormsResources.WaveHeightLocationsContext_DisplayName, Image = waveHeight => RingtoetsCommonFormsResources.GenericInputOutputIcon, ForeColor = context => context.WrappedData.HydraulicBoundaryDatabase == null ? Color.FromKnownColor(KnownColor.GrayText) : Color.FromKnownColor(KnownColor.ControlText), - ContextMenuStrip = WaveHeightContextMenuStrip + ContextMenuStrip = WaveHeightLocationsContextMenuStrip }; yield return CreateFailureMechanismSectionResultTreeNodeInfo(); @@ -1026,11 +1026,11 @@ return new object[] { new DesignWaterLevelLocationsContext(nodeData.WrappedData), - new WaveHeightContext(nodeData.WrappedData) + new WaveHeightLocationsContext(nodeData.WrappedData) }; } - private ContextMenuStrip DesignWaterLevelContextMenuStrip(DesignWaterLevelLocationsContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip DesignWaterLevelLocationsContextMenuStrip(DesignWaterLevelLocationsContext nodeData, object parentData, TreeViewControl treeViewControl) { var designWaterLevelItem = new StrictContextMenuItem( RingtoetsFormsResources.DesignWaterLevel_Calculate, @@ -1056,7 +1056,7 @@ .Build(); } - private ContextMenuStrip WaveHeightContextMenuStrip(WaveHeightContext nodeData, object parentData, TreeViewControl treeViewControl) + private ContextMenuStrip WaveHeightLocationsContextMenuStrip(WaveHeightLocationsContext nodeData, object parentData, TreeViewControl treeViewControl) { var waveHeightItem = new StrictContextMenuItem( RingtoetsFormsResources.WaveHeight_Calculate, Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightContextTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/WaveHeightLocationsContextTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,50 @@ +// 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 Core.Common.Controls.PresentationObjects; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Forms.PresentationObjects; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects +{ + [TestFixture] + public class WaveHeightLocationsContextTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var presentationObject = new WaveHeightLocationsContext(assessmentSectionMock); + + // Assert + Assert.IsInstanceOf>(presentationObject); + Assert.AreSame(assessmentSectionMock, presentationObject.WrappedData); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationContextPropertiesTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,173 @@ +// 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.ComponentModel; +using System.Linq; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DesignWaterLevelLocationContextPropertiesTest + { + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + const long id = 1234; + const string name = ""; + const double x = 567.0; + const double y = 890.0; + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + + // Call + DesignWaterLevelLocationContextProperties properties = + new DesignWaterLevelLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + Point2D coordinates = new Point2D(x, y); + Assert.AreEqual(coordinates, properties.Location); + Assert.AreEqual(string.Empty, properties.DesignWaterLevel); + Assert.IsFalse(properties.Convergence); + } + + [Test] + public void GetProperties_ValidDesignWaterLevel_ReturnsExpectedValues() + { + // Setup + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + const double designWaterLevel = 5.123456; + + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y) + { + DesignWaterLevel = designWaterLevel + }; + + // Call + DesignWaterLevelLocationContextProperties properties = + new DesignWaterLevelLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + Point2D coordinates = new Point2D(x, y); + Assert.AreEqual(coordinates, properties.Location); + string expectedDesignWaterLevel = new RoundedDouble(2, designWaterLevel).ToString(); + Assert.AreEqual(expectedDesignWaterLevel, properties.DesignWaterLevel); + Assert.IsFalse(properties.Convergence); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + DesignWaterLevelLocationContextProperties properties = + new DesignWaterLevelLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Call + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + + // Assert + var dynamicPropertyBag = new DynamicPropertyBag(properties); + const string expectedCategory = "Algemeen"; + const string expectedIdDisplayName = "ID"; + const string expectedNameDisplayName = "Naam"; + const string expectedLocationDisplayName = "Coördinaten [m]"; + const string expectedDesignWaterLevelDisplayName = "Toetspeil [m+NAP]"; + const string expectedConvergenceDisplayName = "Convergentie"; + const string expectedIdDescription = "ID van de hydraulische randvoorwaardenlocatie in de database."; + const string expectedNameDescription = "Naam van de hydraulische randvoorwaardenlocatie."; + const string expectedLocationDescription = "Coördinaten van de hydraulische randvoorwaardenlocatie."; + const string expectedDesignWaterLevelDescription = "Berekend toetspeil."; + const string expectedConvergenceDisplayDescription = "Convergentie status van de toetspeil berekening."; + + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + PropertyDescriptor idProperty = dynamicProperties.Find("Id", false); + PropertyDescriptor nameProperty = dynamicProperties.Find("Name", false); + PropertyDescriptor locationProperty = dynamicProperties.Find("Location", false); + PropertyDescriptor designWaterLevelProperty = dynamicProperties.Find("DesignWaterLevel", false); + PropertyDescriptor convergenceProperty = dynamicProperties.Find("Convergence", false); + + Assert.IsInstanceOf(classTypeConverter); + + Assert.IsNotNull(idProperty); + Assert.IsTrue(idProperty.IsReadOnly); + Assert.IsTrue(idProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, idProperty.Category); + Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName); + Assert.AreEqual(expectedIdDescription, idProperty.Description); + Assert.AreEqual(1, idProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(nameProperty); + Assert.IsTrue(nameProperty.IsReadOnly); + Assert.IsTrue(nameProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, nameProperty.Category); + Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName); + Assert.AreEqual(expectedNameDescription, nameProperty.Description); + Assert.AreEqual(2, nameProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(locationProperty); + Assert.IsTrue(locationProperty.IsReadOnly); + Assert.IsTrue(locationProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, locationProperty.Category); + Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); + Assert.AreEqual(expectedLocationDescription, locationProperty.Description); + Assert.AreEqual(3, locationProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(designWaterLevelProperty); + Assert.IsTrue(designWaterLevelProperty.IsReadOnly); + Assert.IsTrue(designWaterLevelProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, designWaterLevelProperty.Category); + Assert.AreEqual(expectedDesignWaterLevelDisplayName, designWaterLevelProperty.DisplayName); + Assert.AreEqual(expectedDesignWaterLevelDescription, designWaterLevelProperty.Description); + Assert.AreEqual(4, designWaterLevelProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(convergenceProperty); + Assert.IsTrue(convergenceProperty.IsReadOnly); + Assert.IsTrue(convergenceProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, convergenceProperty.Category); + Assert.AreEqual(expectedConvergenceDisplayName, convergenceProperty.DisplayName); + Assert.AreEqual(expectedConvergenceDisplayDescription, convergenceProperty.Description); + Assert.AreEqual(5, convergenceProperty.Attributes.OfType().First().Order); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs =================================================================== diff -u -rbf4509c4766e79ae2785d4b4dc875cbdb781856c -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs (.../DesignWaterLevelLocationsContextPropertiesTest.cs) (revision bf4509c4766e79ae2785d4b4dc875cbdb781856c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/DesignWaterLevelLocationsContextPropertiesTest.cs (.../DesignWaterLevelLocationsContextPropertiesTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -64,10 +64,10 @@ }; // Assert - CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(HydraulicBoundaryLocationDesignWaterLevelProperties)); + CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(DesignWaterLevelLocationContextProperties)); Assert.AreEqual(1, properties.Locations.Length); - HydraulicBoundaryLocationDesignWaterLevelProperties designWaterLevelLocationProperties = properties.Locations.First(); + DesignWaterLevelLocationContextProperties designWaterLevelLocationProperties = properties.Locations.First(); Assert.AreEqual(hydraulicBoundaryLocation.Name, designWaterLevelLocationProperties.Name); Assert.AreEqual(hydraulicBoundaryLocation.Id, designWaterLevelLocationProperties.Id); Assert.AreEqual(hydraulicBoundaryLocation.Location, designWaterLevelLocationProperties.Location); Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationDesignWaterLevelPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/HydraulicBoundaryLocationWaveHeightPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightContextPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationContextPropertiesTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,171 @@ +// 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.ComponentModel; +using System.Linq; +using Core.Common.Base.Data; +using Core.Common.Base.Geometry; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WaveHeightLocationContextPropertiesTest + { + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + const long id = 1234; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + + // Call + var properties = new WaveHeightLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + Point2D coordinates = new Point2D(x, y); + Assert.AreEqual(coordinates, properties.Location); + Assert.AreEqual(string.Empty, properties.WaveHeight); + Assert.IsFalse(properties.Convergence); + } + + [Test] + public void GetProperties_ValidWaveHeight_ReturnsExpectedValues() + { + // Setup + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + const double waveHeight = 5.123456; + + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y) + { + WaveHeight = waveHeight + }; + + // Call + var properties = new WaveHeightLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + Point2D coordinates = new Point2D(x, y); + Assert.AreEqual(coordinates, properties.Location); + string expectedWaveHeight = new RoundedDouble(2, waveHeight).ToString(); + Assert.AreEqual(expectedWaveHeight, properties.WaveHeight); + Assert.IsFalse(properties.Convergence); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "", 0.0, 0.0); + var properties = new WaveHeightLocationContextProperties + { + Data = hydraulicBoundaryLocation + }; + + // Call + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + + // Assert + var dynamicPropertyBag = new DynamicPropertyBag(properties); + const string expectedCategory = "Algemeen"; + const string expectedIdDisplayName = "ID"; + const string expectedNameDisplayName = "Naam"; + const string expectedLocationDisplayName = "Coördinaten [m]"; + const string expectedWaveHeightDisplayName = "Hs [m]"; + const string expectedConvergenceDisplayName = "Convergentie"; + const string expectedIdDescription = "ID van de hydraulische randvoorwaardenlocatie in de database."; + const string expectedNameDescription = "Naam van de hydraulische randvoorwaardenlocatie."; + const string expectedLocationDescription = "Coördinaten van de hydraulische randvoorwaardenlocatie."; + const string expectedWaveHeightDescription = "Berekende golfhoogte."; + const string expectedConvergenceDisplayDescription = "Convergentie status van de golfhoogte berekening."; + + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + PropertyDescriptor idProperty = dynamicProperties.Find("Id", false); + PropertyDescriptor nameProperty = dynamicProperties.Find("Name", false); + PropertyDescriptor locationProperty = dynamicProperties.Find("Location", false); + PropertyDescriptor waveHeightProperty = dynamicProperties.Find("WaveHeight", false); + PropertyDescriptor convergenceProperty = dynamicProperties.Find("Convergence", false); + + Assert.IsInstanceOf(classTypeConverter); + + Assert.IsNotNull(idProperty); + Assert.IsTrue(idProperty.IsReadOnly); + Assert.IsTrue(idProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, idProperty.Category); + Assert.AreEqual(expectedIdDisplayName, idProperty.DisplayName); + Assert.AreEqual(expectedIdDescription, idProperty.Description); + Assert.AreEqual(1, idProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(nameProperty); + Assert.IsTrue(nameProperty.IsReadOnly); + Assert.IsTrue(nameProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, nameProperty.Category); + Assert.AreEqual(expectedNameDisplayName, nameProperty.DisplayName); + Assert.AreEqual(expectedNameDescription, nameProperty.Description); + Assert.AreEqual(2, nameProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(locationProperty); + Assert.IsTrue(locationProperty.IsReadOnly); + Assert.IsTrue(locationProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, locationProperty.Category); + Assert.AreEqual(expectedLocationDisplayName, locationProperty.DisplayName); + Assert.AreEqual(expectedLocationDescription, locationProperty.Description); + Assert.AreEqual(3, locationProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(waveHeightProperty); + Assert.IsTrue(waveHeightProperty.IsReadOnly); + Assert.IsTrue(waveHeightProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, waveHeightProperty.Category); + Assert.AreEqual(expectedWaveHeightDisplayName, waveHeightProperty.DisplayName); + Assert.AreEqual(expectedWaveHeightDescription, waveHeightProperty.Description); + Assert.AreEqual(4, waveHeightProperty.Attributes.OfType().First().Order); + + Assert.IsNotNull(convergenceProperty); + Assert.IsTrue(convergenceProperty.IsReadOnly); + Assert.IsTrue(convergenceProperty.IsBrowsable); + Assert.AreEqual(expectedCategory, convergenceProperty.Category); + Assert.AreEqual(expectedConvergenceDisplayName, convergenceProperty.DisplayName); + Assert.AreEqual(expectedConvergenceDisplayDescription, convergenceProperty.Description); + Assert.AreEqual(5, convergenceProperty.Attributes.OfType().First().Order); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/WaveHeightLocationsContextPropertiesTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,121 @@ +// 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.ComponentModel; +using System.Linq; +using Core.Common.Base.Data; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WaveHeightLocationsContextPropertiesTest + { + [Test] + public void DefaultConstructor_ExpectedValues() + { + // Call + var properties = new WaveHeightLocationsContextProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.Stub(); + mockRepository.ReplayAll(); + + HydraulicBoundaryDatabase hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + WaveHeightLocationsContext context = new WaveHeightLocationsContext(assessmentSectionMock) + { + WrappedData = + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase + } + }; + + const double waveHeight = 12.34; + HydraulicBoundaryLocation hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "name", 1.0, 2.0) + { + WaveHeight = waveHeight + }; + context.WrappedData.HydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + + // Call + WaveHeightLocationsContextProperties properties = new WaveHeightLocationsContextProperties + { + Data = hydraulicBoundaryDatabase + }; + + // Assert + CollectionAssert.AllItemsAreInstancesOfType(properties.Locations, typeof(WaveHeightLocationContextProperties)); + Assert.AreEqual(1, properties.Locations.Length); + + WaveHeightLocationContextProperties waveHeightLocationProperties = properties.Locations.First(); + Assert.AreEqual(hydraulicBoundaryLocation.Name, waveHeightLocationProperties.Name); + Assert.AreEqual(hydraulicBoundaryLocation.Id, waveHeightLocationProperties.Id); + Assert.AreEqual(hydraulicBoundaryLocation.Location, waveHeightLocationProperties.Location); + var expectedWaveHeightValue = new RoundedDouble(2, waveHeight).ToString(); + Assert.AreEqual(expectedWaveHeightValue, waveHeightLocationProperties.WaveHeight); + mockRepository.VerifyAll(); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var properties = new WaveHeightLocationsContextProperties(); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + const string expectedLocationsDisplayName = "Locaties"; + const string expectedLocationsDescription = "Locaties uit de hydraulische randvoorwaardendatabase."; + const string expectedLocationsCategory = "Algemeen"; + + // Call + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + + // Assert + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + PropertyDescriptor locationsProperty = dynamicProperties.Find("Locations", false); + + Assert.IsInstanceOf(classTypeConverter); + Assert.IsNotNull(locationsProperty); + Assert.IsInstanceOf(locationsProperty.Converter); + Assert.IsTrue(locationsProperty.IsReadOnly); + Assert.IsTrue(locationsProperty.IsBrowsable); + Assert.AreEqual(expectedLocationsDisplayName, locationsProperty.DisplayName); + Assert.AreEqual(expectedLocationsDescription, locationsProperty.Description); + Assert.AreEqual(expectedLocationsCategory, locationsProperty.Category); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/DesignWaterLevelLocationContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/DesignWaterLevelLocationContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/DesignWaterLevelLocationContextPropertyInfoTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,79 @@ +// 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; +using System.Linq; +using Core.Common.Gui.Plugin; +using NUnit.Framework; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Plugin; + +namespace Ringtoets.Integration.Forms.Test.PropertyInfos +{ + [TestFixture] + public class DesignWaterLevelLocationContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + using (RingtoetsPlugin plugin = new RingtoetsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + Type propertyObjectType = info.PropertyObjectType; + + // Assert + Assert.AreEqual(typeof(DesignWaterLevelLocationContextProperties), propertyObjectType); + } + } + + [Test] + public void GetObjectPropertiesData_Always_ReturnsHydraulicBoundaryLocation() + { + // Setup + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1, "Name", 1.0, 2.0) + { + DesignWaterLevel = 3.0 + }; + + DesignWaterLevelLocationContext context = new DesignWaterLevelLocationContext(hydraulicBoundaryLocation); + + using (RingtoetsPlugin plugin = new RingtoetsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + var objectPropertiesData = info.GetObjectPropertiesData(context); + + // Assert + Assert.AreSame(hydraulicBoundaryLocation, objectPropertiesData); + } + } + + private static PropertyInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(DesignWaterLevelLocationContext)); + } + } +} \ No newline at end of file Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/HydraulicBoundaryLocationDesignWaterLevelPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/WaveHeightContextPropertyInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyInfos/WaveHeightLocationsContextPropertyInfoTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,83 @@ +// 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; +using System.Linq; +using Core.Common.Gui.Plugin; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Plugin; + +namespace Ringtoets.Integration.Forms.Test.PropertyInfos +{ + [TestFixture] + public class WaveHeightLocationsContextPropertyInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + using (RingtoetsPlugin plugin = new RingtoetsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + Type propertyObjectType = info.PropertyObjectType; + + // Assert + Assert.AreEqual(typeof(WaveHeightLocationsContextProperties), propertyObjectType); + } + } + + [Test] + public void GetObjectPropertiesData_Always_ReturnsHydraulicBoundaryDatabase() + { + // Setup + MockRepository mockRepository = new MockRepository(); + var assessmentSectionMock = mockRepository.Stub(); + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + assessmentSectionMock.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; + mockRepository.ReplayAll(); + + WaveHeightLocationsContext context = new WaveHeightLocationsContext(assessmentSectionMock); + + using (RingtoetsPlugin plugin = new RingtoetsPlugin()) + { + PropertyInfo info = GetInfo(plugin); + + // Call + var objectPropertiesData = info.GetObjectPropertiesData(context); + + // Assert + Assert.AreSame(hydraulicBoundaryDatabase, objectPropertiesData); + } + mockRepository.VerifyAll(); + } + + private static PropertyInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetPropertyInfos().First(pi => pi.DataType == typeof(WaveHeightLocationsContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -rbf4509c4766e79ae2785d4b4dc875cbdb781856c -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision bf4509c4766e79ae2785d4b4dc875cbdb781856c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -73,19 +73,19 @@ - + - - + + - - - + + + @@ -104,7 +104,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u -r6f741425dc85f3d9d868d76002a92aa9bd3cb6cb -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 6f741425dc85f3d9d868d76002a92aa9bd3cb6cb) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/DesignWaterLevelLocationsContextTreeNodeInfoTest.cs (.../DesignWaterLevelLocationsContextTreeNodeInfoTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -250,11 +250,11 @@ { HydraulicBoundaryDatabase = hydraulicBoundaryDatabase }; - var designWaterLevelContext = new DesignWaterLevelLocationsContext(assessmentSectionMock); + var context = new DesignWaterLevelLocationsContext(assessmentSectionMock); using (var treeViewControl = new TreeViewControl()) { - guiMock.Expect(g => g.Get(designWaterLevelContext, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + guiMock.Expect(g => g.Get(context, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); guiMock.Expect(g => g.MainWindow).Return(mockRepository.Stub()); mockRepository.ReplayAll(); @@ -264,7 +264,7 @@ TreeNodeInfo info = GetInfo(plugin); plugin.Gui = guiMock; - ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(designWaterLevelContext, null, treeViewControl); + ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(context, null, treeViewControl); // When Action action = () => { contextMenuAdapter.Items[contextMenuRunAssessmentLevelCalculationsIndex].PerformClick(); }; @@ -288,14 +288,14 @@ var assessmentSectionMock = mockRepository.Stub(); mockRepository.ReplayAll(); - var designWaterLevelContext = new DesignWaterLevelLocationsContext(assessmentSectionMock); + var context = new DesignWaterLevelLocationsContext(assessmentSectionMock); using (var plugin = new RingtoetsPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call - Color color = info.ForeColor(designWaterLevelContext); + Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); @@ -311,14 +311,14 @@ assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); mockRepository.ReplayAll(); - var designWaterLevelContext = new DesignWaterLevelLocationsContext(assessmentSectionMock); + var context = new DesignWaterLevelLocationsContext(assessmentSectionMock); using (var plugin = new RingtoetsPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call - Color color = info.ForeColor(designWaterLevelContext); + Color color = info.ForeColor(context); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs =================================================================== diff -u -rbf4509c4766e79ae2785d4b4dc875cbdb781856c -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision bf4509c4766e79ae2785d4b4dc875cbdb781856c) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs (.../HydraulicBoundaryDatabaseContextTreeNodeInfoTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -249,11 +249,11 @@ // Assert Assert.AreEqual(2, objects.Length); - var designWaterLevelContext = (DesignWaterLevelLocationsContext)objects[0]; - Assert.AreSame(assessmentSection, designWaterLevelContext.WrappedData); + var designWaterLevelLocationsContext = (DesignWaterLevelLocationsContext)objects[0]; + Assert.AreSame(assessmentSection, designWaterLevelLocationsContext.WrappedData); - var waveHeightContext = (WaveHeightContext)objects[1]; - Assert.AreSame(assessmentSection, waveHeightContext.WrappedData); + var waveHeightLocationsContext = (WaveHeightLocationsContext)objects[1]; + Assert.AreSame(assessmentSection, waveHeightLocationsContext.WrappedData); } mocks.VerifyAll(); } Fisheye: Tag 82c089ea04d564cd80d55a8e0f74a112efbe9c0f refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightContextTreeNodeInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/TreeNodeInfos/WaveHeightLocationsContextTreeNodeInfoTest.cs (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -0,0 +1,336 @@ +// 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; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.ContextMenu; +using Core.Common.Gui.TestUtil.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.Properties; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.Plugin; + +namespace Ringtoets.Integration.Forms.Test.TreeNodeInfos +{ + public class WaveHeightLocationsContextTreeNodeInfoTest : NUnitFormTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Assert + Assert.AreEqual(typeof(WaveHeightLocationsContext), info.TagType); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + } + } + + [Test] + public void Text_Always_ReturnsSetName() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + string text = info.Text(null); + + // Assert + const string expectedName = "Golfhoogtes"; + Assert.AreEqual(expectedName, text); + } + } + + [Test] + public void Image_Always_ReturnsGenericIcon() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(Resources.GenericInputOutputIcon, image); + } + } + + [Test] + public void ContextMenuStrip_Always_CallsContextMenuBuilderMethods() + { + // Setup + var guiMock = mockRepository.StrictMock(); + var menuBuilderMock = mockRepository.StrictMock(); + var assessmentSectionMock = mockRepository.Stub(); + + var nodeData = new WaveHeightLocationsContext(assessmentSectionMock); + + menuBuilderMock.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddSeparator()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilderMock); + menuBuilderMock.Expect(mb => mb.Build()).Return(null); + guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(menuBuilderMock); + + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = guiMock; + + // Call + info.ContextMenuStrip(nodeData, null, treeViewControl); + } + } + // Assert + mockRepository.VerifyAll(); + } + + [Test] + public void ContextMenuStrip_NoHydraulicBoundaryDatabaseSet_ContextMenuItemCalculateDisabled() + { + // Setup + var guiMock = mockRepository.StrictMock(); + var assessmentSectionMock = mockRepository.Stub(); + + var nodeData = new WaveHeightLocationsContext(assessmentSectionMock); + + guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = guiMock; + + // Call + var contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl); + + // Assert + const string expectedItemText = "&Berekenen"; + const string expectedItemTooltip = "Er is geen hydraulische randvoorwaardendatabase beschikbaar om de golfhoogtes te berekenen."; + TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, Resources.FailureMechanismIcon, false); + } + } + + mockRepository.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void ContextMenuStrip_HydraulicBoundaryDatabaseSet_ContextMenuItemCalculateEnabled() + { + // Setup + var guiMock = mockRepository.StrictMock(); + var assessmentSectionMock = mockRepository.Stub(); + + var nodeData = new WaveHeightLocationsContext(assessmentSectionMock) + { + WrappedData = + { + HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase() + } + }; + guiMock.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + guiMock.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(nodeData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + plugin.Gui = guiMock; + + // Call + ContextMenuStrip contextMenu = info.ContextMenuStrip(nodeData, null, treeViewControl); + + // Assert + const string expectedItemText = "&Berekenen"; + const string expectedItemTooltip = "Bereken de golfhoogtes."; + + TestHelper.AssertContextMenuStripContainsItem(contextMenu, 0, expectedItemText, expectedItemTooltip, Resources.FailureMechanismIcon); + } + } + + mockRepository.VerifyAll(); // Expect no calls on arguments + } + + [Test] + public void ForeColor_ContextHasNoHydraulicBoundaryDatabase_ReturnDisabledColor() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + mockRepository.ReplayAll(); + + var context = new WaveHeightLocationsContext(assessmentSectionMock); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.GrayText), color); + } + mockRepository.VerifyAll(); + } + + [Test] + public void ForeColor_ContextHasHydraulicBoundaryDatabase_ReturnControlColor() + { + // Setup + var assessmentSectionMock = mockRepository.Stub(); + assessmentSectionMock.HydraulicBoundaryDatabase = new HydraulicBoundaryDatabase(); + mockRepository.ReplayAll(); + + var context = new WaveHeightLocationsContext(assessmentSectionMock); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + + // Call + Color color = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), color); + } + mockRepository.VerifyAll(); + } + + [Test] + public void GivenHydraulicBoundaryDatabaseWithNonExistingFilePath_WhenCalculatingWaveHeightFromContextMenu_ThenLogMessagesAddedPreviousOutputNotAffected() + { + // Given + var guiMock = mockRepository.DynamicMock(); + + var contextMenuRunWaveHeightCalculationsIndex = 0; + + var hydraulicBoundaryLocation1 = new HydraulicBoundaryLocation(100001, "", 1.1, 2.2); + var hydraulicBoundaryLocation2 = new HydraulicBoundaryLocation(100002, "", 3.3, 4.4) + { + WaveHeight = 4.2 + }; + + var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase + { + Locations = + { + hydraulicBoundaryLocation1, + hydraulicBoundaryLocation2 + }, + FilePath = "D:/nonExistingDirectory/nonExistingFile", + Version = "random" + }; + + var assessmentSectionMock = new AssessmentSection(AssessmentSectionComposition.Dike) + { + HydraulicBoundaryDatabase = hydraulicBoundaryDatabase + }; + var context = new WaveHeightLocationsContext(assessmentSectionMock); + + using (var treeViewControl = new TreeViewControl()) + { + guiMock.Expect(cmp => cmp.Get(context, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); + + mockRepository.ReplayAll(); + + using (var plugin = new RingtoetsPlugin()) + { + TreeNodeInfo info = GetInfo(plugin); + plugin.Gui = guiMock; + + ContextMenuStrip contextMenuAdapter = info.ContextMenuStrip(context, null, treeViewControl); + + // When + Action action = () => { contextMenuAdapter.Items[contextMenuRunWaveHeightCalculationsIndex].PerformClick(); }; + + // Then + string message = string.Format("Berekeningen konden niet worden gestart. Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.", + hydraulicBoundaryDatabase.FilePath); + TestHelper.AssertLogMessageWithLevelIsGenerated(action, new Tuple(message, LogLevelConstant.Error)); + + Assert.IsNaN(hydraulicBoundaryLocation1.WaveHeight); // No result set + Assert.AreEqual(4.2, hydraulicBoundaryLocation2.WaveHeight); // Previous result not cleared + } + } + mockRepository.VerifyAll(); + } + + private static TreeNodeInfo GetInfo(RingtoetsPlugin plugin) + { + return plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(WaveHeightLocationsContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r718348fd1a88ab775f495dad750379e4cbedb25f -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 718348fd1a88ab775f495dad750379e4cbedb25f) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -247,16 +247,16 @@ Assert.IsNull(designWaterLevelLocationsContextProperties.AfterCreate); var designWaterLevelLocationContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(DesignWaterLevelLocationContext)); - Assert.AreEqual(typeof(HydraulicBoundaryLocationDesignWaterLevelProperties), designWaterLevelLocationContextProperties.PropertyObjectType); + Assert.AreEqual(typeof(DesignWaterLevelLocationContextProperties), designWaterLevelLocationContextProperties.PropertyObjectType); Assert.IsNull(designWaterLevelLocationContextProperties.AdditionalDataCheck); Assert.IsNotNull(designWaterLevelLocationContextProperties.GetObjectPropertiesData); Assert.IsNull(designWaterLevelLocationContextProperties.AfterCreate); - var waveHeightContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(WaveHeightContext)); - Assert.AreEqual(typeof(WaveHeightContextProperties), waveHeightContextProperties.PropertyObjectType); - Assert.IsNull(waveHeightContextProperties.AdditionalDataCheck); - Assert.IsNotNull(waveHeightContextProperties.GetObjectPropertiesData); - Assert.IsNull(waveHeightContextProperties.AfterCreate); + var waveHeightLocationsContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(WaveHeightLocationsContext)); + Assert.AreEqual(typeof(WaveHeightLocationsContextProperties), waveHeightLocationsContextProperties.PropertyObjectType); + Assert.IsNull(waveHeightLocationsContextProperties.AdditionalDataCheck); + Assert.IsNotNull(waveHeightLocationsContextProperties.GetObjectPropertiesData); + Assert.IsNull(waveHeightLocationsContextProperties.AfterCreate); } } @@ -413,7 +413,7 @@ Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContributionContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(HydraulicBoundaryDatabaseContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(DesignWaterLevelLocationsContext))); - Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(WaveHeightLocationsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionResultContext))); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/HydraulicBoundaryLocationDesignWaterLevelsViewInfoTest.cs =================================================================== diff -u -r7057fbcd8621dc714af88e47454b9af566e769de -r82c089ea04d564cd80d55a8e0f74a112efbe9c0f --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/HydraulicBoundaryLocationDesignWaterLevelsViewInfoTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewInfoTest.cs) (revision 7057fbcd8621dc714af88e47454b9af566e769de) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ViewInfos/HydraulicBoundaryLocationDesignWaterLevelsViewInfoTest.cs (.../HydraulicBoundaryLocationDesignWaterLevelsViewInfoTest.cs) (revision 82c089ea04d564cd80d55a8e0f74a112efbe9c0f) @@ -111,10 +111,10 @@ var assessmentSection = mocks.Stub(); assessmentSection.HydraulicBoundaryDatabase = hydraulicBoundaryDatabase; mocks.ReplayAll(); - var designWaterLevelContext = new DesignWaterLevelLocationsContext(assessmentSection); + var context = new DesignWaterLevelLocationsContext(assessmentSection); // Call - var viewData = info.GetViewData(designWaterLevelContext); + var viewData = info.GetViewData(context); // Assert Assert.AreSame(assessmentSection, viewData);