Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r0a6fd2fa18908a63fc029833ea3735709ebd5829 -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0a6fd2fa18908a63fc029833ea3735709ebd5829) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -376,42 +376,51 @@ } /// - /// Looks up a localized string similar to Oriëntatie van de normaal van het kunstwerk ten opzichte van het noorden.. + /// Looks up a localized string similar to Het kunstwerk dat gebruikt wordt in de berekening.. /// - public static string StructureNormalOrientation_Description { + public static string Structure_Description { get { - return ResourceManager.GetString("StructureNormalOrientation_Description", resourceCulture); + return ResourceManager.GetString("Structure_Description", resourceCulture); } } /// - /// Looks up a localized string similar to Oriëntatie [°]. + /// Looks up a localized string similar to Kunstwerk. /// - public static string StructureNormalOrientation_DisplayName { + public static string Structure_DisplayName { get { - return ResourceManager.GetString("StructureNormalOrientation_DisplayName", resourceCulture); + return ResourceManager.GetString("Structure_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to Het kunstwerk wat gebruikt wordt in de berekening.. + /// Looks up a localized string similar to Oriëntatie van de normaal van het kunstwerk ten opzichte van het noorden.. /// - public static string Structure_Description { + public static string StructureNormalOrientation_Description { get { - return ResourceManager.GetString("Structure_Description", resourceCulture); + return ResourceManager.GetString("StructureNormalOrientation_Description", resourceCulture); } } /// - /// Looks up a localized string similar to Kunstwerk. + /// Looks up a localized string similar to Oriëntatie [°]. /// - public static string Structure_DisplayName { + public static string StructureNormalOrientation_DisplayName { get { - return ResourceManager.GetString("Structure_DisplayName", resourceCulture); + return ResourceManager.GetString("StructureNormalOrientation_DisplayName", resourceCulture); } } /// + /// Looks up a localized string similar to Selecteer kunstwerken. + /// + public static string StructureSelectionDialog_StructureSelectionDialog_Select_structures { + get { + return ResourceManager.GetString("StructureSelectionDialog_StructureSelectionDialog_Select_structures", resourceCulture); + } + } + + /// /// Looks up a localized string similar to De breedte van de kruin van het kunstwerk.. /// public static string WidthFlowApertures_Description { Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx =================================================================== diff -u -r0a6fd2fa18908a63fc029833ea3735709ebd5829 -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision 0a6fd2fa18908a63fc029833ea3735709ebd5829) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -220,7 +220,7 @@ Naam - Het kunstwerk wat gebruikt wordt in de berekening. + Het kunstwerk dat gebruikt wordt in de berekening. Kunstwerk @@ -231,4 +231,7 @@ Voorlandprofiel + + Selecteer kunstwerken + \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj =================================================================== diff -u -r7164a642dc83ca7a1fd78513cbff9da53c052602 -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -56,7 +56,7 @@ - + Form Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs =================================================================== diff -u --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs (revision 0) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructureSelectionDialog.cs (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -0,0 +1,55 @@ +// 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.Linq; +using System.Windows.Forms; +using Ringtoets.Common.Forms; +using Ringtoets.Common.Forms.Views; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Forms.Properties; + +namespace Ringtoets.HeightStructures.Forms +{ + public class StructureSelectionDialog : SelectionDialogBase + { + /// + /// Creates a new instance of . + /// + /// The parent of the dialog. + /// The collection of to show in the dialog. + /// Thrown when any parameter is null. + public StructureSelectionDialog(IWin32Window dialogParent, IEnumerable structures) + : base(dialogParent) + { + if (structures == null) + { + throw new ArgumentNullException("structures"); + } + + Text = Resources.StructureSelectionDialog_StructureSelectionDialog_Select_structures; + InitializeDataGridView(Resources.Structure_DisplayName); + + SetDataSource(structures.Select(structure => new SelectableRow(structure, structure.Name)).ToArray()); + } + } +} \ No newline at end of file Fisheye: Tag e59a92bdf530c0f3522a25253350f6f6f593ddbd refers to a dead (removed) revision in file `Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/StructuresSelectionDialog.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs =================================================================== diff -u -r7164a642dc83ca7a1fd78513cbff9da53c052602 -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision 7164a642dc83ca7a1fd78513cbff9da53c052602) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresPlugin.cs (.../HeightStructuresPlugin.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -409,7 +409,7 @@ private void ShowHeightStructuresSelectionDialog(HeightStructuresCalculationGroupContext nodeData) { - using (var dialog = new StructuresSelectionDialog(Gui.MainWindow, nodeData.FailureMechanism.HeightStructures)) + using (var dialog = new StructureSelectionDialog(Gui.MainWindow, nodeData.FailureMechanism.HeightStructures)) { dialog.ShowDialog(); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs =================================================================== diff -u -rc3c2bba57ff003c569aefa73e42ac6122fcf5bfa -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision c3c2bba57ff003c569aefa73e42ac6122fcf5bfa) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil.Test/TestHeightStructureTest.cs (.../TestHeightStructureTest.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -84,5 +84,64 @@ Assert.AreEqual(2, allowedLevelIncreaseStorage.StandardDeviation.NumberOfDecimalPlaces); Assert.AreEqual(0.23, allowedLevelIncreaseStorage.StandardDeviation.Value); } + + [Test] + public void Constructor_CustomName_ExpectedValues() + { + // Setup + var customName = "A different name for structure"; + + // Call + var heightStructure = new TestHeightStructure(customName); + + // Assert + Assert.AreEqual(customName, heightStructure.Name); + Assert.AreEqual("Id", heightStructure.Id); + var location = new Point2D(0, 0); + Assert.AreEqual(location.X, heightStructure.Location.X); + Assert.AreEqual(location.Y, heightStructure.Location.Y); + + Assert.IsInstanceOf(heightStructure.StructureNormalOrientation); + Assert.AreEqual(2, heightStructure.StructureNormalOrientation.NumberOfDecimalPlaces); + Assert.AreEqual(0.12, heightStructure.StructureNormalOrientation.Value); + + NormalDistribution levelCrestStructure = heightStructure.LevelCrestStructure; + Assert.AreEqual(2, levelCrestStructure.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(234.57, levelCrestStructure.Mean.Value); + Assert.AreEqual(2, levelCrestStructure.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.23, levelCrestStructure.StandardDeviation.Value); + + LogNormalDistribution flowWidthAtBottomProtection = heightStructure.FlowWidthAtBottomProtection; + Assert.AreEqual(2, flowWidthAtBottomProtection.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(345.68, flowWidthAtBottomProtection.Mean.Value); + Assert.AreEqual(2, flowWidthAtBottomProtection.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.35, flowWidthAtBottomProtection.StandardDeviation.Value); + + VariationCoefficientLogNormalDistribution criticalOvertoppingDischarge = heightStructure.CriticalOvertoppingDischarge; + Assert.AreEqual(2, criticalOvertoppingDischarge.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(456.79, criticalOvertoppingDischarge.Mean.Value); + Assert.AreEqual(2, criticalOvertoppingDischarge.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.46, criticalOvertoppingDischarge.CoefficientOfVariation.Value); + + VariationCoefficientNormalDistribution widthFlowApertures = heightStructure.WidthFlowApertures; + Assert.AreEqual(2, widthFlowApertures.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(567.89, widthFlowApertures.Mean.Value); + Assert.AreEqual(2, widthFlowApertures.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.57, widthFlowApertures.CoefficientOfVariation.Value); + + Assert.AreEqual(0.67890, heightStructure.FailureProbabilityStructureWithErosion); + + VariationCoefficientLogNormalDistribution storageStructureArea = heightStructure.StorageStructureArea; + Assert.AreEqual(2, storageStructureArea.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(112.22, storageStructureArea.Mean.Value); + Assert.AreEqual(2, storageStructureArea.CoefficientOfVariation.NumberOfDecimalPlaces); + Assert.AreEqual(0.11, storageStructureArea.CoefficientOfVariation.Value); + + LogNormalDistribution allowedLevelIncreaseStorage = heightStructure.AllowedLevelIncreaseStorage; + Assert.AreEqual(2, allowedLevelIncreaseStorage.Mean.NumberOfDecimalPlaces); + Assert.AreEqual(225.34, allowedLevelIncreaseStorage.Mean.Value); + Assert.AreEqual(2, allowedLevelIncreaseStorage.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(0.23, allowedLevelIncreaseStorage.StandardDeviation.Value); + } } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs =================================================================== diff -u -rc3c2bba57ff003c569aefa73e42ac6122fcf5bfa -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision c3c2bba57ff003c569aefa73e42ac6122fcf5bfa) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.TestUtil/TestHeightStructure.cs (.../TestHeightStructure.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -29,5 +29,10 @@ : base("Test", "Id", new Point2D(0, 0), 0.12345, 234.567, 0.23456, 345.678, 0.34567, 456.789, 0.45678, 567.890, 0.56789, 0.67890, 112.223, 0.11222, 225.336, 0.22533) {} + + public TestHeightStructure(string name) + : base(name, "Id", new Point2D(0, 0), 0.12345, 234.567, 0.23456, + 345.678, 0.34567, 456.789, 0.45678, 567.890, 0.56789, + 0.67890, 112.223, 0.11222, 225.336, 0.22533) {} } } \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs =================================================================== diff -u -rc3c2bba57ff003c569aefa73e42ac6122fcf5bfa -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision c3c2bba57ff003c569aefa73e42ac6122fcf5bfa) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresInputContextPropertiesTest.cs (.../HeightStructuresInputContextPropertiesTest.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -417,7 +417,7 @@ Assert.IsFalse(heightStructureProperty.IsReadOnly); Assert.AreEqual(schematizationCategory, heightStructureProperty.Category); Assert.AreEqual("Kunstwerk", heightStructureProperty.DisplayName); - Assert.AreEqual("Het kunstwerk wat gebruikt wordt in de berekening.", heightStructureProperty.Description); + Assert.AreEqual("Het kunstwerk dat gebruikt wordt in de berekening.", heightStructureProperty.Description); PropertyDescriptor heightStructureLocationProperty = dynamicProperties[heightStructureLocationPropertyIndex]; Assert.IsTrue(heightStructureLocationProperty.IsReadOnly); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -rc3c2bba57ff003c569aefa73e42ac6122fcf5bfa -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision c3c2bba57ff003c569aefa73e42ac6122fcf5bfa) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -70,6 +70,7 @@ + Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/StructureSelectionDialogTest.cs (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -0,0 +1,138 @@ +// 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 System.Windows.Forms; +using Core.Common.Base.Geometry; +using Core.Common.Controls.DataGrid; +using NUnit.Extensions.Forms; +using NUnit.Framework; +using Ringtoets.Common.Forms; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Data.TestUtil; + +namespace Ringtoets.HeightStructures.Forms.Test +{ + [TestFixture] + public class StructureSelectionDialogTest + { + private const int selectItemColumnIndex = 0; + private const int nameColumnIndex = 1; + + [Test] + public void Constructor_WithoutParent_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new StructureSelectionDialog(null, Enumerable.Empty()); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("dialogParent", parameter); + } + + [Test] + public void Constructor_WithoutSurfaceLines_ThrowsArgumentNullException() + { + // Setup + using (var viewParent = new Form()) + { + // Call + TestDelegate test = () => new StructureSelectionDialog(viewParent, null); + + // Assert + string parameter = Assert.Throws(test).ParamName; + Assert.AreEqual("structures", parameter); + } + } + + [Test] + public void Constructor_WithParentAndSurfaceLines_DefaultProperties() + { + // Setup + using (var viewParent = new Form()) + { + // Call + using (var dialog = new StructureSelectionDialog(viewParent, Enumerable.Empty())) + { + // Assert + Assert.IsInstanceOf>(dialog); + Assert.IsEmpty(dialog.SelectedItems); + Assert.AreEqual("Selecteer kunstwerken", dialog.Text); + } + } + } + + [Test] + public void Constructor_DataGridViewCorrectlyInitialized() + { + // Setup & Call + using (var viewParent = new Form()) + using (var dialog = new StructureSelectionDialog(viewParent, Enumerable.Empty())) + { + dialog.Show(); + + // Assert + Assert.IsEmpty(dialog.SelectedItems); + + var dataGridViewControl = (DataGridViewControl) new ControlTester("DataGridViewControl", dialog).TheObject; + var dataGridView = dataGridViewControl.Controls.OfType().First(); + Assert.AreEqual(2, dataGridView.ColumnCount); + + var locationCalculateColumn = (DataGridViewCheckBoxColumn) dataGridView.Columns[selectItemColumnIndex]; + Assert.AreEqual("Gebruik", locationCalculateColumn.HeaderText); + Assert.AreEqual("Selected", locationCalculateColumn.DataPropertyName); + Assert.IsFalse(locationCalculateColumn.ReadOnly); + + var nameColumn = (DataGridViewTextBoxColumn) dataGridView.Columns[nameColumnIndex]; + Assert.AreEqual("Kunstwerk", nameColumn.HeaderText); + Assert.AreEqual("Name", nameColumn.DataPropertyName); + Assert.AreEqual(DataGridViewAutoSizeColumnMode.Fill, nameColumn.AutoSizeMode); + Assert.IsTrue(nameColumn.ReadOnly); + } + } + + [Test] + public void Constructor_SurfaceLinesOneEntry_OneRowInGrid() + { + // Setup + var testname = "Test"; + var heightStructure = new TestHeightStructure(testname); + + // Call + using (var viewParent = new Form()) + using (var dialog = new StructureSelectionDialog(viewParent, new[] + { + heightStructure + })) + { + // Assert + dialog.Show(); + + var dataGridViewControl = (DataGridViewControl) new ControlTester("DataGridViewControl").TheObject; + Assert.AreEqual(1, dataGridViewControl.Rows.Count); + Assert.IsFalse((bool) dataGridViewControl.Rows[0].Cells[selectItemColumnIndex].Value); + Assert.AreEqual(testname, (string) dataGridViewControl.Rows[0].Cells[nameColumnIndex].Value); + } + } + + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/UITypeEditors/HeightStructuresInputContextStructureEditorTest.cs =================================================================== diff -u -r0a6fd2fa18908a63fc029833ea3735709ebd5829 -re59a92bdf530c0f3522a25253350f6f6f593ddbd --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/UITypeEditors/HeightStructuresInputContextStructureEditorTest.cs (.../HeightStructuresInputContextStructureEditorTest.cs) (revision 0a6fd2fa18908a63fc029833ea3735709ebd5829) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/UITypeEditors/HeightStructuresInputContextStructureEditorTest.cs (.../HeightStructuresInputContextStructureEditorTest.cs) (revision e59a92bdf530c0f3522a25253350f6f6f593ddbd) @@ -28,6 +28,7 @@ using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Data.TestUtil; using Ringtoets.HeightStructures.Forms.PresentationObjects; using Ringtoets.HeightStructures.Forms.PropertyClasses; using Ringtoets.HeightStructures.Forms.UITypeEditors; @@ -131,13 +132,5 @@ Assert.AreSame(heightStructure, result); mockRepository.VerifyAll(); } - - private class TestHeightStructure : HeightStructure - { - public TestHeightStructure() - : base("Test", "Id", new Point2D(0, 0), 0.12345, 234.567, 0.23456, - 345.678, 0.34567, 456.789, 0.45678, 567.890, 0.56789, - 0.67890, 112.223, 0.11222, 225.336, 0.22533) {} - } } } \ No newline at end of file