Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj
===================================================================
diff -u -re13aad684439fe0ce56760077b13a7c5b03674de -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision e13aad684439fe0ce56760077b13a7c5b03674de)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -64,6 +64,7 @@
+
UserControl
Index: Ringtoets/Common/src/Ringtoets.Common.Forms/UITypeEditors/SelectionEditor.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.Forms/UITypeEditors/SelectionEditor.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.Forms/UITypeEditors/SelectionEditor.cs (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -0,0 +1,126 @@
+// 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.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing.Design;
+using System.Linq;
+using System.Windows.Forms;
+using System.Windows.Forms.Design;
+using Core.Common.Gui.PropertyBag;
+
+namespace Ringtoets.Common.Forms.UITypeEditors
+{
+ ///
+ /// This class provides a base implementation of and defines a drop down list
+ /// edit-control used for calculation input data.
+ ///
+ /// The type of items that populate the list-edit control.
+ /// The type which' properties populates the dropdown editor.
+ public class SelectionEditor : UITypeEditor
+ where TProperty : class
+ where TPropertiesClass : IObjectProperties
+ {
+ private IWindowsFormsEditorService editorService;
+
+ public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
+ {
+ return UITypeEditorEditStyle.DropDown;
+ }
+
+ public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object originalValue)
+ {
+ if (provider != null)
+ {
+ editorService = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
+ }
+
+ if (editorService != null && context != null)
+ {
+ // Create editor:
+ ListBox listBox = CreateSelectionControl(context);
+
+ // Open editor for user to select an item:
+ editorService.DropDownControl(listBox);
+
+ // Return user selected object, or original value if user did not select anything:
+ return listBox.SelectedItem ?? originalValue;
+ }
+ return base.EditValue(context, provider, originalValue);
+ }
+
+ ///
+ /// Gets which member to show of in the dropdown editor.
+ ///
+ protected string DisplayMember { private get; set; }
+
+ ///
+ /// Gets the available options which populate the dropdown editor.
+ ///
+ /// The context on which to base the available options.
+ /// A of objects of type which contains all the available options.
+ protected virtual IEnumerable GetAvailableOptions(ITypeDescriptorContext context)
+ {
+ return Enumerable.Empty();
+ }
+
+ ///
+ /// Gets the current option which should be selected in the dropdown editor.
+ ///
+ /// The context on which to base the current option.
+ /// The object of type which is currently selected.
+ protected virtual TProperty GetCurrentOption(ITypeDescriptorContext context)
+ {
+ return null;
+ }
+
+ ///
+ /// Takes a context and from this, obtains the object which populates the dropdown editor.
+ ///
+ /// The context from which the object is obtained.
+ /// The object which' properties populates the dropdown editor.
+ protected static TPropertiesClass GetPropertiesObject(ITypeDescriptorContext context)
+ {
+ return (TPropertiesClass) ((DynamicPropertyBag) context.Instance).WrappedObject;
+ }
+
+ private ListBox CreateSelectionControl(ITypeDescriptorContext context)
+ {
+ var listBox = new ListBox
+ {
+ SelectionMode = SelectionMode.One,
+ DisplayMember = DisplayMember
+ };
+ listBox.SelectedValueChanged += (sender, eventArgs) => editorService.CloseDropDown();
+
+ foreach (TProperty option in GetAvailableOptions(context))
+ {
+ int index = listBox.Items.Add(option);
+ if (ReferenceEquals(GetCurrentOption(context), option))
+ {
+ listBox.SelectedIndex = index;
+ }
+ }
+ return listBox;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj
===================================================================
diff -u -r64d5609bb2912cd52dc74deffdd189222e240599 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -69,6 +69,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/SelectionEditorTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/SelectionEditorTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/UITypeEditors/SelectionEditorTest.cs (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -0,0 +1,109 @@
+// 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.ComponentModel;
+using System.Drawing.Design;
+using System.Windows.Forms.Design;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Forms.UITypeEditors;
+
+namespace Ringtoets.Common.Forms.Test.UITypeEditors
+{
+ [TestFixture]
+ public class PipingInputContextSelectionEditorTest
+ {
+ [Test]
+ public void GetEditStyle_Always_ReturnDropDown()
+ {
+ // Setup
+ var editor = new SelectionEditor();
+
+ // Call
+ var editStyle = editor.GetEditStyle();
+
+ // Assert
+ Assert.AreEqual(UITypeEditorEditStyle.DropDown, editStyle);
+ }
+
+ [Test]
+ public void EditValue_NoProviderNoContext_ReturnsOriginalValue()
+ {
+ // Setup
+ var editor = new SelectionEditor();
+ var someValue = new object();
+
+ // Call
+ var result = editor.EditValue(null, null, someValue);
+
+ // Assert
+ Assert.AreSame(someValue, result);
+ }
+
+ [Test]
+ public void EditValue_NoContext_ReturnsOriginalValue()
+ {
+ // Setup
+ var editor = new SelectionEditor();
+ var mockRepository = new MockRepository();
+ var provider = mockRepository.StrictMock();
+ var service = mockRepository.StrictMock();
+ provider.Expect(p => p.GetService(null)).IgnoreArguments().Return(service);
+ mockRepository.ReplayAll();
+
+ var someValue = new object();
+
+ // Call
+ var result = editor.EditValue(null, provider, someValue);
+
+ // Assert
+ Assert.AreSame(someValue, result);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void EditValue_Always_ReturnsOriginalValue()
+ {
+ // Setup
+ var editor = new SelectionEditor();
+ var mockRepository = new MockRepository();
+ var provider = mockRepository.StrictMock();
+ var service = mockRepository.StrictMock();
+ var context = mockRepository.StrictMock();
+ provider.Expect(p => p.GetService(null)).IgnoreArguments().Return(service);
+ service.Expect(s => s.DropDownControl(null)).IgnoreArguments();
+ mockRepository.ReplayAll();
+
+ var someValue = new object();
+
+ // Call
+ var result = editor.EditValue(context, provider, someValue);
+
+ // Assert
+ Assert.AreSame(someValue, result);
+
+ mockRepository.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs
===================================================================
diff -u -r0a94ed42cb943659d68be2ce6fb430f8f29fc3f3 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 0a94ed42cb943659d68be2ce6fb430f8f29fc3f3)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsCalculation.cs (.../GrassCoverErosionInwardsCalculation.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -26,7 +26,6 @@
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Probabilistics;
using Ringtoets.GrassCoverErosionInwards.Data.Properties;
-using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Data
{
@@ -119,9 +118,6 @@
InputParameters.SetForeshoreGeometry(foreshoreSections);
InputParameters.UseForeshore = true;
- // Hydraulic boundaries location
- InputParameters.HydraulicBoundaryLocation = new HydraulicBoundaryLocation(1300001, "Demo", 0.0, 1.1);
-
// Dike height
InputParameters.DikeHeight = new RoundedDouble(InputParameters.DikeHeight.NumberOfDecimalPlaces, 10);
}
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsContext.cs
===================================================================
diff -u -rb1a215180352084c8f320439c1893c639917f338 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsContext.cs (.../GrassCoverErosionInwardsContext.cs) (revision b1a215180352084c8f320439c1893c639917f338)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PresentationObjects/GrassCoverErosionInwardsContext.cs (.../GrassCoverErosionInwardsContext.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -20,11 +20,14 @@
// All rights reserved.
using System;
+using System.Collections.Generic;
+using System.Linq;
using Core.Common.Base;
using Core.Common.Controls.PresentationObjects;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
+using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects
{
@@ -75,5 +78,19 @@
/// Gets the assessment section which the failure mechanism context belongs to.
///
public IAssessmentSection AssessmentSection { get; private set; }
+
+ ///
+ /// Gets the available hydraulic boundary locations in order for the user to select one to
+ /// set .
+ ///
+ public IEnumerable AvailableHydraulicBoundaryLocations
+ {
+ get
+ {
+ return AssessmentSection.HydraulicBoundaryDatabase == null ?
+ Enumerable.Empty() :
+ AssessmentSection.HydraulicBoundaryDatabase.Locations;
+ }
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -152,6 +152,15 @@
}
///
+ /// Looks up a localized string similar to Hydraulische gegevens.
+ ///
+ public static string Categories_HydraulicData {
+ get {
+ return ResourceManager.GetString("Categories_HydraulicData", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Lengte-effect parameters.
///
public static string Categories_LengthEffect {
@@ -479,6 +488,24 @@
}
///
+ /// Looks up a localized string similar to De locatie met hydraulische randvoorwaarden die gebruikt wordt tijdens de berekening..
+ ///
+ public static string HydraulicBoundaryLocation_Description {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocation_Description", resourceCulture);
+ }
+ }
+
+ ///
+ /// Looks up a localized string similar to Locatie met hydraulische randvoorwaarden.
+ ///
+ public static string HydraulicBoundaryLocation_DisplayName {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryLocation_DisplayName", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to De gemiddelde waarde van de lognormale verdeling..
///
public static string LognormalDistribution_Mean_Description {
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx
===================================================================
diff -u -r8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -286,4 +286,13 @@
De standaardafwijking van de lognormale verdeling.
+
+ Hydraulische gegevens
+
+
+ De locatie met hydraulische randvoorwaarden die gebruikt wordt tijdens de berekening.
+
+
+ Locatie met hydraulische randvoorwaarden
+
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs
===================================================================
diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -19,13 +19,19 @@
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing.Design;
using System.Globalization;
using Core.Common.Base.Data;
using Core.Common.Gui.Attributes;
using Core.Common.Gui.PropertyBag;
using Core.Common.Utils.Attributes;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Forms.Properties;
+using Ringtoets.GrassCoverErosionInwards.Forms.TypeConverters;
+using Ringtoets.GrassCoverErosionInwards.Forms.UITypeEditors;
+using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses
{
@@ -40,6 +46,7 @@
private const int orientationPropertyIndex = 4;
private const int breakWaterPropertyIndex = 5;
private const int criticalFlowRatePropertyIndex = 6;
+ private const int hydraulicBoundaryLocationPropertyIndex = 7;
[PropertyOrder(dikeGeometryPropertyIndex)]
[ResourcesCategory(typeof(Resources), "Categories_Schematisation")]
@@ -134,5 +141,28 @@
};
}
}
+
+ [PropertyOrder(hydraulicBoundaryLocationPropertyIndex)]
+ [Editor(typeof(GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor), typeof(UITypeEditor))]
+ [ResourcesCategory(typeof(Resources), "Categories_HydraulicData")]
+ [ResourcesDisplayName(typeof(Resources), "HydraulicBoundaryLocation_DisplayName")]
+ [ResourcesDescription(typeof(Resources), "HydraulicBoundaryLocation_Description")]
+ public HydraulicBoundaryLocation HydraulicBoundaryLocation
+ {
+ get
+ {
+ return data.WrappedData.HydraulicBoundaryLocation;
+ }
+ set
+ {
+ data.WrappedData.HydraulicBoundaryLocation = value;
+ data.WrappedData.NotifyObservers();
+ }
+ }
+
+ public IEnumerable GetAvailableHydraulicBoundaryLocations()
+ {
+ return data.AvailableHydraulicBoundaryLocations;
+ }
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj
===================================================================
diff -u -r54bb4197ebc3b67e9ba167a6669791726c33e12e -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 54bb4197ebc3b67e9ba167a6669791726c33e12e)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -67,6 +67,7 @@
+
@@ -109,6 +110,11 @@
Ringtoets.Common.Forms
False
+
+ {70f8cc9c-5bc8-4fb2-b201-eae7fa8088c2}
+ Ringtoets.HydraRing.Data
+ False
+
{90DE728E-48EF-4665-AB38-3D88E41D9F4D}
Ringtoets.GrassCoverErosionInwards.Data
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor.cs (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -0,0 +1,56 @@
+// 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.Collections.Generic;
+using System.ComponentModel;
+using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Forms.UITypeEditors;
+using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.UITypeEditors
+{
+ ///
+ /// This class defines a drop down list edit-control from which the user can select a
+ /// from a collection.
+ ///
+ public class GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor :
+ SelectionEditor
+ {
+ ///
+ /// Creates a new instance of .
+ ///
+ public GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor()
+ {
+ DisplayMember = TypeUtils.GetMemberName(hbl => hbl.Name);
+ }
+
+ protected override IEnumerable GetAvailableOptions(ITypeDescriptorContext context)
+ {
+ return GetPropertiesObject(context).GetAvailableHydraulicBoundaryLocations();
+ }
+
+ protected override HydraulicBoundaryLocation GetCurrentOption(ITypeDescriptorContext context)
+ {
+ return GetPropertiesObject(context).HydraulicBoundaryLocation;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs
===================================================================
diff -u -ra3357275af675af3714fc89b99c554c288759ae2 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision a3357275af675af3714fc89b99c554c288759ae2)
+++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Plugin/GrassCoverErosionInwardsGuiPlugin.cs (.../GrassCoverErosionInwardsGuiPlugin.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -197,11 +197,11 @@
private void CalculateAll(IFailureMechanism failureMechanism, IEnumerable calculations, IAssessmentSection assessmentSection)
{
- ActivityProgressDialogRunner.Run(Gui.MainWindow, calculations.Select(calc =>
- CreateHydraRingTargetProbabilityCalculationActivity(
- failureMechanism.Sections.First(), // TODO: Pass dike section based on cross section of calculation with reference line
- Path.GetDirectoryName(assessmentSection.HydraulicBoundaryDatabase.FilePath),
- calc)).ToList());
+ ActivityProgressDialogRunner.Run(Gui.MainWindow, calculations.Where(calc => calc.InputParameters.HydraulicBoundaryLocation != null)
+ .Select(calc => CreateHydraRingTargetProbabilityCalculationActivity(
+ failureMechanism.Sections.First(), // TODO: Pass dike section based on cross section of calculation with reference line
+ Path.GetDirectoryName(assessmentSection.HydraulicBoundaryDatabase.FilePath),
+ calc)).ToList());
}
private static string AllDataAvailable(IAssessmentSection assessmentSection, GrassCoverErosionInwardsFailureMechanism failureMechanism)
@@ -462,6 +462,10 @@
private void PerformCalculation(GrassCoverErosionInwardsCalculation calculation, GrassCoverErosionInwardsCalculationContext context)
{
+ if (calculation.InputParameters.HydraulicBoundaryLocation == null)
+ {
+ return;
+ }
var activity = CreateHydraRingTargetProbabilityCalculationActivity(
context.FailureMechanism.Sections.First(), // TODO: Pass dike section based on cross section of calculation with reference line
Path.GetDirectoryName(context.AssessmentSection.HydraulicBoundaryDatabase.FilePath),
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs
===================================================================
diff -u -re5b2c4a69ceb564c0455170e37eeb3024cff61fe -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision e5b2c4a69ceb564c0455170e37eeb3024cff61fe)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.Test/GrassCoverErosionInwardsCalculationTest.cs (.../GrassCoverErosionInwardsCalculationTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -213,10 +213,6 @@
Assert.IsTrue(inputParameters.DikeGeometry.Any());
Assert.IsTrue(inputParameters.UseForeshore);
- // Hydraulic boundaries location
- Assert.AreEqual("Demo", inputParameters.HydraulicBoundaryLocation.Name);
- Assert.AreEqual(1300001, inputParameters.HydraulicBoundaryLocation.Id);
-
// Dike height
var expectedDikeHeight = new RoundedDouble(inputParameters.DikeHeight.NumberOfDecimalPlaces, 10);
Assert.AreEqual(expectedDikeHeight, inputParameters.DikeHeight);
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/GrassCoverErosionInwardsCalculationFactoryTest.cs
===================================================================
diff -u -r89cf0d104a6e12180d2fae471ae318cad256707a -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/GrassCoverErosionInwardsCalculationFactoryTest.cs (.../GrassCoverErosionInwardsCalculationFactoryTest.cs) (revision 89cf0d104a6e12180d2fae471ae318cad256707a)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Data.TestUtil.Test/GrassCoverErosionInwardsCalculationFactoryTest.cs (.../GrassCoverErosionInwardsCalculationFactoryTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -96,21 +96,12 @@
Assert.AreEqual(a.FshallowModelFactor.Mean, b.FshallowModelFactor.Mean);
Assert.AreEqual(a.FshallowModelFactor.StandardDeviation, b.FshallowModelFactor.StandardDeviation);
CollectionAssertAreEqual(a.ForeshoreGeometry.ToList(), b.ForeshoreGeometry.ToList());
- AssertHydraulicBoundaryLocationAreEqual(a.HydraulicBoundaryLocation, b.HydraulicBoundaryLocation);
Assert.AreEqual(a.Orientation, b.Orientation);
Assert.AreEqual(a.OvertoppingModelFactor, b.OvertoppingModelFactor);
Assert.AreEqual(a.UseBreakWater, b.UseBreakWater);
Assert.AreEqual(a.UseForeshore, b.UseForeshore);
}
- private static void AssertHydraulicBoundaryLocationAreEqual(HydraulicBoundaryLocation a, HydraulicBoundaryLocation b)
- {
- Assert.AreEqual(a.Name, b.Name);
- Assert.AreEqual(a.DesignWaterLevel, b.DesignWaterLevel);
- Assert.AreEqual(a.Id, b.Id);
- Assert.AreEqual(a.Location, b.Location);
- }
-
private static void CollectionAssertAreEqual(IList a, IList b)
{
Assert.AreEqual(a.Count, b.Count);
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs
===================================================================
diff -u -r06069298b641698f3a5b617dbfa5ace095448de4 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs (.../GrassCoverErosionInwardsContextTest.cs) (revision 06069298b641698f3a5b617dbfa5ace095448de4)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PresentationObjects/GrassCoverErosionInwardsContextTest.cs (.../GrassCoverErosionInwardsContextTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -20,13 +20,15 @@
// All rights reserved.
using System;
+using System.Linq;
using Core.Common.Base;
using Core.Common.TestUtil;
using NUnit.Framework;
using Rhino.Mocks;
using Ringtoets.Common.Data.AssessmentSection;
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PresentationObjects
{
@@ -46,6 +48,7 @@
{
// Setup
var assessmentSectionMock = mockRepository.StrictMock();
+ assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase).Return(null);
var failureMechanismMock = mockRepository.StrictMock();
mockRepository.ReplayAll();
@@ -59,7 +62,7 @@
Assert.AreSame(target, context.WrappedData);
Assert.AreSame(assessmentSectionMock, context.AssessmentSection);
Assert.AreSame(failureMechanismMock, context.FailureMechanism);
-
+ CollectionAssert.IsEmpty(context.AvailableHydraulicBoundaryLocations);
mockRepository.VerifyAll();
}
@@ -121,6 +124,29 @@
}
[Test]
+ public void AvailableHydraulicBoundaryLocations_HydraulicBoundaryDatabaseSet_ReturnsAllHydraulicBoundaryLocations()
+ {
+ // Setup
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(new HydraulicBoundaryLocation(1, "name", 1.1, 2.2));
+ var assessmentSectionMock = mockRepository.StrictMock();
+ assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase).Repeat.Twice();
+ var failureMechanismMock = mockRepository.StrictMock();
+ mockRepository.ReplayAll();
+
+ var target = new ObservableObject();
+ var context = new SimpleGrassCoverErosionInwardsContext(target, failureMechanismMock, assessmentSectionMock);
+
+ // Call
+ var availableHydraulicBoundaryLocations = context.AvailableHydraulicBoundaryLocations;
+
+ // Assert
+ Assert.AreEqual(1, availableHydraulicBoundaryLocations.Count());
+ Assert.AreEqual(hydraulicBoundaryDatabase.Locations, availableHydraulicBoundaryLocations);
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
public void Attach_Observer_ObserverAttachedToWrappedObject()
{
// Setup
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs
===================================================================
diff -u -r8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision 8c915b3e32d3e34f825bdb6d114344b5a2eb4ca8)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -30,6 +30,7 @@
using Ringtoets.GrassCoverErosionInwards.Data;
using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
+using Ringtoets.HydraRing.Data;
namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.PropertyClasses
{
@@ -103,6 +104,7 @@
Assert.AreEqual(breakWaterProperties.BreakWaterType, properties.BreakWater.BreakWaterType);
Assert.AreEqual(input.CriticalFlowRate.Mean, properties.CriticalFlowRate.Mean);
Assert.AreEqual(input.CriticalFlowRate.StandardDeviation, properties.CriticalFlowRate.StandardDeviation);
+ Assert.AreEqual(input.HydraulicBoundaryLocation, properties.HydraulicBoundaryLocation);
mockRepository.VerifyAll();
}
@@ -111,8 +113,11 @@
{
// Setup
var observerMock = mockRepository.StrictMock();
- const int numberProperties = 2;
+ const int numberProperties = 3;
observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties);
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(0, "name", 0.0, 1.1);
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
var assessmentSectionMock = mockRepository.StrictMock();
var failureMechanismMock = mockRepository.StrictMock();
var generalInput = new GeneralGrassCoverErosionInwardsInput();
@@ -132,10 +137,12 @@
// Call
properties.DikeHeight = newDikeHeight.ToString();
properties.Orientation = newOrientation.Value.ToString(CultureInfo.InvariantCulture);
+ properties.HydraulicBoundaryLocation = hydraulicBoundaryLocation;
// Assert
Assert.AreEqual(newDikeHeight, input.DikeHeight);
Assert.AreEqual(newOrientation, input.Orientation);
+ Assert.AreEqual(hydraulicBoundaryLocation, input.HydraulicBoundaryLocation);
mockRepository.VerifyAll();
}
@@ -159,43 +166,56 @@
// Assert
var dynamicPropertyBag = new DynamicPropertyBag(properties);
PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties();
- Assert.AreEqual(7, dynamicProperties.Count);
+ Assert.AreEqual(8, dynamicProperties.Count);
PropertyDescriptor dikeGeometryProperty = dynamicProperties[dikeGeometryPropertyIndex];
Assert.IsNotNull(dikeGeometryProperty);
Assert.IsTrue(dikeGeometryProperty.IsReadOnly);
+ Assert.AreEqual("Schematisatie", dikeGeometryProperty.Category);
Assert.AreEqual("Dijkgeometrie", dikeGeometryProperty.DisplayName);
Assert.AreEqual("Eigenschappen van de dijkgeometrie.", dikeGeometryProperty.Description);
PropertyDescriptor dikeHeightProperty = dynamicProperties[dikeHeightPropertyIndex];
Assert.IsNotNull(dikeHeightProperty);
Assert.IsFalse(dikeHeightProperty.IsReadOnly);
+ Assert.AreEqual("Schematisatie", dikeHeightProperty.Category);
Assert.AreEqual("Dijkhoogte [m+NAP]", dikeHeightProperty.DisplayName);
Assert.AreEqual("De hoogte van de dijk [m+NAP].", dikeHeightProperty.Description);
PropertyDescriptor foreshoreProperty = dynamicProperties[foreshorePropertyIndex];
Assert.IsNotNull(foreshoreProperty);
Assert.IsTrue(foreshoreProperty.IsReadOnly);
+ Assert.AreEqual("Schematisatie", foreshoreProperty.Category);
Assert.AreEqual("Voorland", foreshoreProperty.DisplayName);
Assert.AreEqual("Eigenschappen van het voorland.", foreshoreProperty.Description);
PropertyDescriptor orientationProperty = dynamicProperties[orientationPropertyIndex];
Assert.IsNotNull(orientationProperty);
Assert.IsFalse(orientationProperty.IsReadOnly);
+ Assert.AreEqual("Schematisatie", orientationProperty.Category);
Assert.AreEqual("Oriëntatie [º]", orientationProperty.DisplayName);
Assert.AreEqual("Oriëntatie van de dijk.", orientationProperty.Description);
PropertyDescriptor breakWaterProperty = dynamicProperties[breakWaterPropertyIndex];
Assert.IsNotNull(breakWaterProperty);
Assert.IsTrue(breakWaterProperty.IsReadOnly);
+ Assert.AreEqual("Schematisatie", breakWaterProperty.Category);
Assert.AreEqual("Havendam", breakWaterProperty.DisplayName);
Assert.AreEqual("Eigenschappen van de havendam.", breakWaterProperty.Description);
PropertyDescriptor criticalFlowRateProperty = dynamicProperties[criticalFlowRatePropertyIndex];
Assert.IsNotNull(criticalFlowRateProperty);
Assert.IsTrue(criticalFlowRateProperty.IsReadOnly);
+ Assert.AreEqual("Toetseisen", criticalFlowRateProperty.Category);
Assert.AreEqual("Kritisch overslagdebiet [m³/s/m]", criticalFlowRateProperty.DisplayName);
Assert.AreEqual("Kritisch overslagdebiet per strekkende meter.", criticalFlowRateProperty.Description);
+
+ PropertyDescriptor hydraulicBoundaryLocationProperty = dynamicProperties[hydraulicBoundaryLocationPropertyIndex];
+ Assert.IsNotNull(hydraulicBoundaryLocationProperty);
+ Assert.IsFalse(hydraulicBoundaryLocationProperty.IsReadOnly);
+ Assert.AreEqual("Hydraulische gegevens", hydraulicBoundaryLocationProperty.Category);
+ Assert.AreEqual("Locatie met hydraulische randvoorwaarden", hydraulicBoundaryLocationProperty.DisplayName);
+ Assert.AreEqual("De locatie met hydraulische randvoorwaarden die gebruikt wordt tijdens de berekening.", hydraulicBoundaryLocationProperty.Description);
mockRepository.VerifyAll();
}
@@ -205,5 +225,6 @@
private const int orientationPropertyIndex = 3;
private const int breakWaterPropertyIndex = 4;
private const int criticalFlowRatePropertyIndex = 5;
+ private const int hydraulicBoundaryLocationPropertyIndex = 6;
}
}
\ No newline at end of file
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj
===================================================================
diff -u -rc80d8e79efaeb35561e45f31b5a0092944886838 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision c80d8e79efaeb35561e45f31b5a0092944886838)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -90,6 +90,7 @@
+
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs
===================================================================
diff -u -ra3357275af675af3714fc89b99c554c288759ae2 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision a3357275af675af3714fc89b99c554c288759ae2)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationContextTreeNodeInfoTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -464,17 +464,23 @@
string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
+ var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(1,string.Empty, 0.0,1.1);
var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase
{
FilePath = validFilePath,
Version = "random"
};
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
var assessmentSectionMock = mocks.StrictMock();
assessmentSectionMock.Stub(asm => asm.HydraulicBoundaryDatabase).Return(hydraulicBoundaryDatabase);
var calculation = new GrassCoverErosionInwardsCalculation(new GeneralGrassCoverErosionInwardsInput())
{
- Output = new GrassCoverErosionInwardsOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN)
+ Output = new GrassCoverErosionInwardsOutput(double.NaN, double.NaN, double.NaN, double.NaN, double.NaN),
+ InputParameters =
+ {
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation
+ }
};
var calculationContext = new GrassCoverErosionInwardsCalculationContext(calculation, failureMechanism, assessmentSectionMock);
Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditorTest.cs
===================================================================
diff -u
--- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditorTest.cs (revision 0)
+++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/UITypeEditors/GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditorTest.cs (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -0,0 +1,147 @@
+// 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.ComponentModel;
+using System.Windows.Forms.Design;
+using Core.Common.Gui.PropertyBag;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.GrassCoverErosionInwards.Data;
+using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects;
+using Ringtoets.GrassCoverErosionInwards.Forms.PropertyClasses;
+using Ringtoets.GrassCoverErosionInwards.Forms.UITypeEditors;
+using Ringtoets.HydraRing.Data;
+
+namespace Ringtoets.GrassCoverErosionInwards.Forms.Test.UITypeEditors
+{
+ [TestFixture]
+ public class GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditorTest
+ {
+ private MockRepository mockRepository;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mockRepository = new MockRepository();
+ }
+
+ [Test]
+ public void EditValue_NoCurrentItemInAvailableItems_ReturnsOriginalValue()
+ {
+ // Setup
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ hydraulicBoundaryDatabase.Locations.Add(new TestHydraulicBoundaryLocation());
+ var grassCoverErosionInwardsInput = new GrassCoverErosionInwardsInput(new GeneralGrassCoverErosionInwardsInput());
+ var calculationMock = mockRepository.StrictMock();
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase)
+ .Return(hydraulicBoundaryDatabase)
+ .Repeat.AtLeastOnce();
+ var inputContext = new GrassCoverErosionInwardsInputContext(grassCoverErosionInwardsInput,
+ calculationMock,
+ failureMechanism,
+ assessmentSectionMock);
+
+ var properties = new GrassCoverErosionInwardsInputContextProperties
+ {
+ Data = inputContext
+ };
+ var editor = new GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor();
+ var propertyBag = new DynamicPropertyBag(properties);
+
+ var serviceProviderMock = mockRepository.StrictMock();
+ var serviceMock = mockRepository.StrictMock();
+ var descriptorContextMock = mockRepository.StrictMock();
+ serviceProviderMock.Expect(p => p.GetService(null)).IgnoreArguments().Return(serviceMock);
+ serviceMock.Expect(s => s.DropDownControl(null)).IgnoreArguments();
+ descriptorContextMock.Expect(c => c.Instance).Return(propertyBag).Repeat.Twice();
+ mockRepository.ReplayAll();
+
+ var someValue = new object();
+
+ // Call
+ var result = editor.EditValue(descriptorContextMock, serviceProviderMock, someValue);
+
+ // Assert
+ Assert.AreSame(someValue, result);
+
+ mockRepository.VerifyAll();
+ }
+
+ [Test]
+ public void EditValue_WithCurrentItemInAvailableItems_ReturnsCurrentItem()
+ {
+ // Setup
+ var hydraulicBoundaryDatabase = new HydraulicBoundaryDatabase();
+ var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation();
+ hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation);
+ var grassCoverErosionInwardsInput = new GrassCoverErosionInwardsInput(new GeneralGrassCoverErosionInwardsInput())
+ {
+ HydraulicBoundaryLocation = hydraulicBoundaryLocation
+ };
+ var calculationMock = mockRepository.StrictMock();
+ var failureMechanism = new GrassCoverErosionInwardsFailureMechanism();
+ var assessmentSectionMock = mockRepository.StrictMock();
+ assessmentSectionMock.Expect(asm => asm.HydraulicBoundaryDatabase)
+ .Return(hydraulicBoundaryDatabase)
+ .Repeat.AtLeastOnce();
+ var inputContext = new GrassCoverErosionInwardsInputContext(grassCoverErosionInwardsInput,
+ calculationMock,
+ failureMechanism,
+ assessmentSectionMock);
+
+ var properties = new GrassCoverErosionInwardsInputContextProperties
+ {
+ Data = inputContext
+ };
+ var editor = new GrassCoverErosionInwardsInputContextHydraulicBoundaryLocationEditor();
+ var propertyBag = new DynamicPropertyBag(properties);
+
+ var serviceProviderMock = mockRepository.StrictMock();
+ var serviceMock = mockRepository.StrictMock();
+ var descriptorContextMock = mockRepository.StrictMock();
+ serviceProviderMock.Expect(p => p.GetService(null)).IgnoreArguments().Return(serviceMock);
+ serviceMock.Expect(s => s.DropDownControl(null)).IgnoreArguments();
+ serviceMock.Expect(s => s.CloseDropDown()).IgnoreArguments();
+ descriptorContextMock.Expect(c => c.Instance).Return(propertyBag).Repeat.Twice();
+ mockRepository.ReplayAll();
+
+ var someValue = new object();
+
+ // Call
+ var result = editor.EditValue(descriptorContextMock, serviceProviderMock, someValue);
+
+ // Assert
+ Assert.AreSame(hydraulicBoundaryLocation, result);
+
+ mockRepository.VerifyAll();
+ }
+
+ private class TestHydraulicBoundaryLocation : HydraulicBoundaryLocation
+ {
+ public TestHydraulicBoundaryLocation() : base(0, string.Empty, 0, 0) {}
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj
===================================================================
diff -u -r64d5609bb2912cd52dc74deffdd189222e240599 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Ringtoets.Piping.Forms.csproj (.../Ringtoets.Piping.Forms.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -92,7 +92,6 @@
-
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditor.cs
===================================================================
diff -u -r428346aca4810ed68d8778943246f581cb1a4386 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditor.cs (.../PipingInputContextHydraulicBoundaryLocationEditor.cs) (revision 428346aca4810ed68d8778943246f581cb1a4386)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditor.cs (.../PipingInputContextHydraulicBoundaryLocationEditor.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -1,15 +1,38 @@
-using System.Collections.Generic;
+// 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.Collections.Generic;
using System.ComponentModel;
using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Forms.UITypeEditors;
using Ringtoets.HydraRing.Data;
+using Ringtoets.Piping.Forms.PropertyClasses;
namespace Ringtoets.Piping.Forms.UITypeEditors
{
///
/// This class defines a drop down list edit-control from which the user can select a
/// from a collection.
///
- public class PipingInputContextHydraulicBoundaryLocationEditor : PipingInputContextSelectionEditor
+ public class PipingInputContextHydraulicBoundaryLocationEditor : SelectionEditor
{
///
/// Creates a new instance of .
Fisheye: Tag 4539b4546747c257739b1695b9ebc9c29e393ffe refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSelectionEditor.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditor.cs
===================================================================
diff -u -rd515de49557312e4af41b1c051c900d39d1f9e2f -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditor.cs (.../PipingInputContextStochasticSoilModelSelectionEditor.cs) (revision d515de49557312e4af41b1c051c900d39d1f9e2f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilModelSelectionEditor.cs (.../PipingInputContextStochasticSoilModelSelectionEditor.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -22,15 +22,17 @@
using System.Collections.Generic;
using System.ComponentModel;
using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Forms.UITypeEditors;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Forms.PropertyClasses;
namespace Ringtoets.Piping.Forms.UITypeEditors
{
///
/// This class defines a drop down list edit-control from which the user can select a
/// from a collection.
///
- public class PipingInputContextStochasticSoilModelSelectionEditor : PipingInputContextSelectionEditor
+ public class PipingInputContextStochasticSoilModelSelectionEditor : SelectionEditor
{
///
/// Creates a new instance of .
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditor.cs
===================================================================
diff -u -r8832cfacbfb0a999d9dd5ddcb93fd81bdb2fb09f -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditor.cs (.../PipingInputContextStochasticSoilProfileSelectionEditor.cs) (revision 8832cfacbfb0a999d9dd5ddcb93fd81bdb2fb09f)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextStochasticSoilProfileSelectionEditor.cs (.../PipingInputContextStochasticSoilProfileSelectionEditor.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -22,15 +22,17 @@
using System.Collections.Generic;
using System.ComponentModel;
using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Forms.UITypeEditors;
using Ringtoets.Piping.Data;
+using Ringtoets.Piping.Forms.PropertyClasses;
namespace Ringtoets.Piping.Forms.UITypeEditors
{
///
/// This class defines a drop down list edit-control from which the user can select a
/// from a collection.
///
- public class PipingInputContextStochasticSoilProfileSelectionEditor : PipingInputContextSelectionEditor
+ public class PipingInputContextStochasticSoilProfileSelectionEditor : SelectionEditor
{
///
/// Creates a new instance of .
Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSurfaceLineSelectionEditor.cs
===================================================================
diff -u -rd82fa09fe9ae053ce7702ba89ef23ae029640d1b -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSurfaceLineSelectionEditor.cs (.../PipingInputContextSurfaceLineSelectionEditor.cs) (revision d82fa09fe9ae053ce7702ba89ef23ae029640d1b)
+++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/UITypeEditors/PipingInputContextSurfaceLineSelectionEditor.cs (.../PipingInputContextSurfaceLineSelectionEditor.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -22,6 +22,8 @@
using System.Collections.Generic;
using System.ComponentModel;
using Core.Common.Utils.Reflection;
+using Ringtoets.Common.Forms.UITypeEditors;
+using Ringtoets.Piping.Forms.PropertyClasses;
using Ringtoets.Piping.Primitives;
namespace Ringtoets.Piping.Forms.UITypeEditors
@@ -30,7 +32,7 @@
/// This class defines a drop down list edit-control from which the user can select a
/// from a collection.
///
- public class PipingInputContextSurfaceLineSelectionEditor : PipingInputContextSelectionEditor
+ public class PipingInputContextSurfaceLineSelectionEditor : SelectionEditor
{
///
/// Creates a new instance of .
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj
===================================================================
diff -u -r64d5609bb2912cd52dc74deffdd189222e240599 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 64d5609bb2912cd52dc74deffdd189222e240599)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/Ringtoets.Piping.Forms.Test.csproj (.../Ringtoets.Piping.Forms.Test.csproj) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -97,7 +97,6 @@
-
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditorTest.cs
===================================================================
diff -u -rec5eeafbbd987b02a9d9c07b7e920c03d567f3f7 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditorTest.cs (.../PipingInputContextHydraulicBoundaryLocationEditorTest.cs) (revision ec5eeafbbd987b02a9d9c07b7e920c03d567f3f7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextHydraulicBoundaryLocationEditorTest.cs (.../PipingInputContextHydraulicBoundaryLocationEditorTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -1,4 +1,25 @@
-using System;
+// 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.ComponentModel;
using System.Linq;
using System.Windows.Forms.Design;
Fisheye: Tag 4539b4546747c257739b1695b9ebc9c29e393ffe refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSelectionEditorTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs
===================================================================
diff -u -rec5eeafbbd987b02a9d9c07b7e920c03d567f3f7 -r4539b4546747c257739b1695b9ebc9c29e393ffe
--- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs (.../PipingInputContextSurfaceLineSelectionEditorTest.cs) (revision ec5eeafbbd987b02a9d9c07b7e920c03d567f3f7)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/UITypeEditors/PipingInputContextSurfaceLineSelectionEditorTest.cs (.../PipingInputContextSurfaceLineSelectionEditorTest.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe)
@@ -1,4 +1,25 @@
-using System;
+// 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.ComponentModel;
using System.Linq;
using System.Windows.Forms.Design;