Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs =================================================================== diff -u -rdd3fbc29b15246ce6d2496e685398011e85bd21d -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationsGroupProperties.cs (.../DesignWaterLevelCalculationsGroupProperties.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -24,63 +24,36 @@ using System.ComponentModel; using System.Linq; using Core.Common.Gui.Converters; -using Core.Common.Gui.PropertyBag; using Core.Common.Util.Attributes; using Ringtoets.Common.Data.Hydraulics; using Ringtoets.Common.Forms.Properties; namespace Ringtoets.Common.Forms.PropertyClasses { /// - /// ViewModel of an enumeration of for properties panel. + /// ViewModel of an enumeration of with design water level results for properties panel. /// - public class DesignWaterLevelCalculationsGroupProperties : ObjectProperties> + public class DesignWaterLevelCalculationsGroupProperties : HydraulicBoundaryLocationCalculationsGroupBaseProperties { - private readonly IEnumerable>> calculationsPerCategoryBoundary; - + /// /// /// Creates a new instance of . /// - /// The locations to set as data. - /// A collection of tuples containing the category boundary name and - /// its corresponding collection of . - /// Thrown when any parameter is null. public DesignWaterLevelCalculationsGroupProperties(IEnumerable locations, - IEnumerable>> calculationsPerCategoryBoundary) - { - if (locations == null) - { - throw new ArgumentNullException(nameof(locations)); - } + IEnumerable>> calculationsPerCategoryBoundary) + : base(locations, calculationsPerCategoryBoundary) {} - if (calculationsPerCategoryBoundary == null) - { - throw new ArgumentNullException(nameof(calculationsPerCategoryBoundary)); - } - - this.calculationsPerCategoryBoundary = calculationsPerCategoryBoundary; - - Data = locations; - } - [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_Description))] - public HydraulicBoundaryLocationProperties[] Locations + public DesignWaterLevelHydraulicBoundaryLocationProperties[] Locations { get { - return data.Select(location => new HydraulicBoundaryLocationProperties(location, GetHydraulicBoundaryLocationCalculationsForLocation(location))).ToArray(); + return data.Select(location => new DesignWaterLevelHydraulicBoundaryLocationProperties( + location, GetHydraulicBoundaryLocationCalculationsForLocation(location))).ToArray(); } } - - private IEnumerable> GetHydraulicBoundaryLocationCalculationsForLocation(HydraulicBoundaryLocation location) - { - return calculationsPerCategoryBoundary.Select(boundaryCalculations => - new Tuple( - boundaryCalculations.Item1, - boundaryCalculations.Item2.Single(calculation => ReferenceEquals(calculation.HydraulicBoundaryLocation, location)))); - } } } \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel containing design water level calculations. + /// + public class DesignWaterLevelHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationBaseProperties + { + /// + /// + /// Creates a new instance of . + /// + public DesignWaterLevelHydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location, + IEnumerable> calculationPerCategoryBoundary) + : base(location, calculationPerCategoryBoundary) {} + + [PropertyOrder(4)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))] + [TypeConverter(typeof(ExpandableArrayConverter))] + public DesignWaterLevelCalculationOutputProperties[] CategoryBoundaries + { + get + { + return CalculationPerCategoryBoundary.Select(calculation => new DesignWaterLevelCalculationOutputProperties(calculation.Item2, + calculation.Item1)).ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationBaseProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationBaseProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationBaseProperties.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,107 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Core.Common.Base.Geometry; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// Base viewmodel for a . + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public abstract class HydraulicBoundaryLocationBaseProperties : ObjectProperties + { + protected readonly IEnumerable> CalculationPerCategoryBoundary; + + /// + /// Creates a new instance of . + /// + /// The location to set as data. + /// The calculations belonging to the + /// for each category boundary. + /// Thrown when any parameter is null. + protected HydraulicBoundaryLocationBaseProperties(HydraulicBoundaryLocation location, + IEnumerable> calculationPerCategoryBoundary) + { + if (location == null) + { + throw new ArgumentNullException(nameof(location)); + } + + if (calculationPerCategoryBoundary == null) + { + throw new ArgumentNullException(nameof(calculationPerCategoryBoundary)); + } + + Data = location; + CalculationPerCategoryBoundary = calculationPerCategoryBoundary; + } + + [PropertyOrder(1)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Id_Description))] + public long Id + { + get + { + return data.Id; + } + } + + [PropertyOrder(2)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Name_Description))] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(3)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Location_Coordinates_Description))] + public Point2D Location + { + get + { + return data.Location; + } + } + + public override string ToString() + { + return $"{Name} {Location}"; + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs =================================================================== diff -u -r04ffe9435f3031323b2eeac4718e85dfd6022dbe -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs (.../HydraulicBoundaryLocationCalculationBaseProperties.cs) (revision 04ffe9435f3031323b2eeac4718e85dfd6022dbe) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationBaseProperties.cs (.../HydraulicBoundaryLocationCalculationBaseProperties.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -37,13 +37,13 @@ namespace Ringtoets.Common.Forms.PropertyClasses { /// - /// ViewModel of for properties panel. + /// Base viewmodel of for properties panel. /// [TypeConverter(typeof(ExpandableObjectConverter))] public abstract class HydraulicBoundaryLocationCalculationBaseProperties : ObjectProperties { /// - /// Creates a new instance of . + /// Creates a new instance of . /// /// The hydraulic boundary location calculation. /// Thrown when is null. Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBaseProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBaseProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBaseProperties.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,71 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Gui.PropertyBag; +using Ringtoets.Common.Data.Hydraulics; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// Base viewmodel of an enumeration of with calculations per category boundary for properties panel. + /// + public abstract class HydraulicBoundaryLocationCalculationsGroupBaseProperties : ObjectProperties> + { + private readonly IEnumerable>> calculationsPerCategoryBoundary; + + /// + /// Creates a new instance of . + /// + /// The locations to set as data. + /// A collection of tuples containing the category boundary name and + /// its corresponding collection of . + /// Thrown when any parameter is null. + protected HydraulicBoundaryLocationCalculationsGroupBaseProperties( + IEnumerable locations, + IEnumerable>> calculationsPerCategoryBoundary) + { + if (locations == null) + { + throw new ArgumentNullException(nameof(locations)); + } + + if (calculationsPerCategoryBoundary == null) + { + throw new ArgumentNullException(nameof(calculationsPerCategoryBoundary)); + } + + this.calculationsPerCategoryBoundary = calculationsPerCategoryBoundary; + + Data = locations; + } + + protected IEnumerable> GetHydraulicBoundaryLocationCalculationsForLocation(HydraulicBoundaryLocation location) + { + return calculationsPerCategoryBoundary.Select(boundaryCalculations => + new Tuple( + boundaryCalculations.Item1, + boundaryCalculations.Item2.Single(calculation => ReferenceEquals(calculation.HydraulicBoundaryLocation, location)))); + } + } +} \ No newline at end of file Fisheye: Tag bb29d09db7cda2fbce4c36d2d544f5ef74c7c103 refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationsGroupProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationsGroupProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationsGroupProperties.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,58 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of an enumeration of with wave height results for properties panel. + /// + public class WaveHeightCalculationsGroupProperties : HydraulicBoundaryLocationCalculationsGroupBaseProperties + { + /// + /// + /// Creates a new instance of . + /// + public WaveHeightCalculationsGroupProperties(IEnumerable locations, + IEnumerable>> calculationsPerCategoryBoundary) + : base(locations, calculationsPerCategoryBoundary) {} + + [TypeConverter(typeof(ExpandableArrayConverter))] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryDatabase_Locations_Description))] + public WaveHeightHydraulicBoundaryLocationProperties[] Locations + { + get + { + return data.Select(location => new WaveHeightHydraulicBoundaryLocationProperties(location, GetHydraulicBoundaryLocationCalculationsForLocation(location))).ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,61 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel containing wave height calculations. + /// + public class WaveHeightHydraulicBoundaryLocationProperties : HydraulicBoundaryLocationBaseProperties + { + /// + /// + /// Creates a new instance of . + /// + public WaveHeightHydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location, + IEnumerable> calculationPerCategoryBoundary) + : base(location, calculationPerCategoryBoundary) {} + + [PropertyOrder(4)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))] + [TypeConverter(typeof(ExpandableArrayConverter))] + public WaveHeightCalculationOutputProperties[] CategoryBoundaries + { + get + { + return CalculationPerCategoryBoundary.Select(calculation => new WaveHeightCalculationOutputProperties(calculation.Item2, + calculation.Item1)).ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r6200b56b8a269fc956bb09a102d2f9165fb7dd3d -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 6200b56b8a269fc956bb09a102d2f9165fb7dd3d) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -94,6 +94,10 @@ Resources.resx + + + + @@ -107,7 +111,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs =================================================================== diff -u -rdd3fbc29b15246ce6d2496e685398011e85bd21d -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs (.../DesignWaterLevelCalculationsGroupPropertiesTest.cs) (revision dd3fbc29b15246ce6d2496e685398011e85bd21d) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationsGroupPropertiesTest.cs (.../DesignWaterLevelCalculationsGroupPropertiesTest.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -24,7 +24,6 @@ using System.ComponentModel; using System.Linq; using Core.Common.Gui.Converters; -using Core.Common.Gui.PropertyBag; using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Hydraulics; @@ -37,30 +36,6 @@ public class DesignWaterLevelCalculationsGroupPropertiesTest { [Test] - public void Constructor_LocationsNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new DesignWaterLevelCalculationsGroupProperties(null, - Enumerable.Empty>>()); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("locations", exception.ParamName); - } - - [Test] - public void Constructor_CalculationsPerCategoryBoundaryNull_ThrowsArgumentNullException() - { - // Call - TestDelegate call = () => new DesignWaterLevelCalculationsGroupProperties(Enumerable.Empty(), - null); - - // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("calculationsPerCategoryBoundary", exception.ParamName); - } - - [Test] public void Constructor_ExpectedValues() { // Setup @@ -71,7 +46,7 @@ Enumerable.Empty>>()); // Assert - Assert.IsInstanceOf>>(properties); + Assert.IsInstanceOf(properties); Assert.AreSame(locations, properties.Data); TestHelper.AssertTypeConverter( @@ -117,7 +92,7 @@ }); // Assert - HydraulicBoundaryLocationProperties locationProperties = properties.Locations.Single(); + DesignWaterLevelHydraulicBoundaryLocationProperties locationProperties = properties.Locations.Single(); Assert.AreSame(location, locationProperties.Data); Assert.AreEqual(1, locationProperties.CategoryBoundaries.Length); } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,106 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DesignWaterLevelHydraulicBoundaryLocationPropertiesTest + { + private const int categoryBoundariesPropertyIndex = 3; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new DesignWaterLevelHydraulicBoundaryLocationProperties(location, + Enumerable.Empty>()); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(location, properties.Data); + TestHelper.AssertTypeConverter( + nameof(DesignWaterLevelHydraulicBoundaryLocationProperties.CategoryBoundaries)); + } + + [Test] + public void Constructor_PropertiesHaveExpectedAttributesValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new DesignWaterLevelHydraulicBoundaryLocationProperties(location, + Enumerable.Empty>()); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(4, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor categoryBoundariesProperty = dynamicProperties[categoryBoundariesPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundariesProperty, + generalCategory, + "Categoriegrenzen", + "De berekeningen per categoriegrens voor deze locatie.", + true); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation) + { + Output = new TestHydraulicBoundaryLocationCalculationOutput() + }; + + var calculations = new[] + { + new Tuple("A", hydraulicBoundaryLocationCalculation) + }; + + // Call + var properties = new DesignWaterLevelHydraulicBoundaryLocationProperties(hydraulicBoundaryLocation, + calculations); + + // Assert + DesignWaterLevelCalculationOutputProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); + Assert.AreEqual("A", categoryBoundaryCalculation.CategoryBoundaryName); + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, categoryBoundaryCalculation.Result); + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.CalculationConvergence, categoryBoundaryCalculation.Convergence); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationBasePropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationBasePropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationBasePropertiesTest.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,177 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Base.Geometry; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class HydraulicBoundaryLocationBasePropertiesTest + { + private const int idPropertyIndex = 0; + private const int namePropertyIndex = 1; + private const int coordinatesPropertyIndex = 2; + + [Test] + public void Constructor_LocationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraulicBoundaryLocationBaseProperties(null, + Enumerable.Empty>()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("location", exception.ParamName); + } + + [Test] + public void Constructor_CalculationPerCategoryBoundaryNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraulicBoundaryLocationBaseProperties(new TestHydraulicBoundaryLocation(), + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculationPerCategoryBoundary", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new TestHydraulicBoundaryLocationBaseProperties(location, + Enumerable.Empty>()); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(location, properties.Data); + TestHelper.AssertTypeConverter(); + } + + [Test] + public void Constructor_PropertiesHaveExpectedAttributesValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new TestHydraulicBoundaryLocationBaseProperties(location, + Enumerable.Empty>()); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor idProperty = dynamicProperties[idPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(idProperty, + generalCategory, + "ID", + "ID van de hydraulische randvoorwaardenlocatie in de database.", + true); + + PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "Naam van de hydraulische randvoorwaardenlocatie.", + true); + + PropertyDescriptor coordinatesProperty = dynamicProperties[coordinatesPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(coordinatesProperty, + generalCategory, + "Coördinaten [m]", + "Coördinaten van de hydraulische randvoorwaardenlocatie.", + true); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + const string name = ""; + + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation) + { + Output = new TestHydraulicBoundaryLocationCalculationOutput() + }; + + var calculations = new[] + { + new Tuple("A", hydraulicBoundaryLocationCalculation) + }; + + // Call + var properties = new TestHydraulicBoundaryLocationBaseProperties(hydraulicBoundaryLocation, + calculations); + + // Assert + Assert.AreEqual(id, properties.Id); + Assert.AreEqual(name, properties.Name); + var coordinates = new Point2D(x, y); + Assert.AreEqual(coordinates, properties.Location); + } + + [Test] + public void ToString_Always_ReturnsNameAndLocation() + { + // Setup + const string name = "test"; + const long id = 1234L; + const double x = 567.0; + const double y = 890.0; + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation(id, name, x, y); + + // Call + var properties = new TestHydraulicBoundaryLocationBaseProperties(hydraulicBoundaryLocation, + Enumerable.Empty>()); + + // Assert + string expectedString = $"{name} {new Point2D(x, y)}"; + Assert.AreEqual(expectedString, properties.ToString()); + } + + private class TestHydraulicBoundaryLocationBaseProperties : HydraulicBoundaryLocationBaseProperties + { + public TestHydraulicBoundaryLocationBaseProperties(HydraulicBoundaryLocation location, IEnumerable> calculationPerCategoryBoundary) + : base(location, calculationPerCategoryBoundary) {} + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBasePropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBasePropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationsGroupBasePropertiesTest.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,81 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class HydraulicBoundaryLocationCalculationsGroupBasePropertiesTest + { + [Test] + public void Constructor_LocationsNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraulicBoundaryLocationCalculationGroupProperties(null, + Enumerable.Empty>>()); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("locations", exception.ParamName); + } + + [Test] + public void Constructor_CalculationsPerCategoryBoundaryNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new TestHydraulicBoundaryLocationCalculationGroupProperties(Enumerable.Empty(), + null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("calculationsPerCategoryBoundary", exception.ParamName); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + IEnumerable locations = Enumerable.Empty(); + + // Call + var properties = new TestHydraulicBoundaryLocationCalculationGroupProperties(locations, + Enumerable.Empty>>()); + + // Assert + Assert.IsInstanceOf>>(properties); + Assert.AreSame(locations, properties.Data); + } + + private class TestHydraulicBoundaryLocationCalculationGroupProperties : HydraulicBoundaryLocationCalculationsGroupBaseProperties + { + public TestHydraulicBoundaryLocationCalculationGroupProperties(IEnumerable locations, + IEnumerable>> calculationsPerCategoryBoundary) + : base(locations, calculationsPerCategoryBoundary) {} + } + } +} \ No newline at end of file Fisheye: Tag bb29d09db7cda2fbce4c36d2d544f5ef74c7c103 refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsGroupPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsGroupPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationsGroupPropertiesTest.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,100 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WaveHeightCalculationsGroupPropertiesTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + IEnumerable locations = Enumerable.Empty(); + + // Call + var properties = new WaveHeightCalculationsGroupProperties(locations, + Enumerable.Empty>>()); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(locations, properties.Data); + + TestHelper.AssertTypeConverter( + nameof(WaveHeightCalculationsGroupProperties.Locations)); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Call + var properties = new WaveHeightCalculationsGroupProperties(Enumerable.Empty(), + Enumerable.Empty>>()); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(1, dynamicProperties.Count); + + PropertyDescriptor locationsProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(locationsProperty, + "Algemeen", + "Locaties", + "Locaties uit de hydraulische randvoorwaardendatabase.", + true); + } + + [Test] + public void GetProperties_WithData_ReturnExpectedValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new WaveHeightCalculationsGroupProperties(new[] + { + location + }, + new[] + { + new Tuple>("A", new[] + { + new HydraulicBoundaryLocationCalculation(location) + }) + }); + + // Assert + WaveHeightHydraulicBoundaryLocationProperties locationProperties = properties.Locations.Single(); + Assert.AreSame(location, locationProperties.Data); + Assert.AreEqual(1, locationProperties.CategoryBoundaries.Length); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -0,0 +1,106 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.Converters; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WaveHeightHydraulicBoundaryLocationPropertiesTest + { + private const int categoryBoundariesPropertyIndex = 3; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new WaveHeightHydraulicBoundaryLocationProperties(location, + Enumerable.Empty>()); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(location, properties.Data); + TestHelper.AssertTypeConverter( + nameof(WaveHeightHydraulicBoundaryLocationProperties.CategoryBoundaries)); + } + + [Test] + public void Constructor_PropertiesHaveExpectedAttributesValues() + { + // Setup + var location = new TestHydraulicBoundaryLocation(); + + // Call + var properties = new WaveHeightHydraulicBoundaryLocationProperties(location, + Enumerable.Empty>()); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(4, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor categoryBoundariesProperty = dynamicProperties[categoryBoundariesPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundariesProperty, + generalCategory, + "Categoriegrenzen", + "De berekeningen per categoriegrens voor deze locatie.", + true); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var hydraulicBoundaryLocation = new TestHydraulicBoundaryLocation(); + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(hydraulicBoundaryLocation) + { + Output = new TestHydraulicBoundaryLocationCalculationOutput() + }; + + var calculations = new[] + { + new Tuple("A", hydraulicBoundaryLocationCalculation) + }; + + // Call + var properties = new WaveHeightHydraulicBoundaryLocationProperties(hydraulicBoundaryLocation, + calculations); + + // Assert + WaveHeightCalculationOutputProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); + Assert.AreEqual("A", categoryBoundaryCalculation.CategoryBoundaryName); + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, categoryBoundaryCalculation.Result); + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.CalculationConvergence, categoryBoundaryCalculation.Convergence); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r6200b56b8a269fc956bb09a102d2f9165fb7dd3d -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 6200b56b8a269fc956bb09a102d2f9165fb7dd3d) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) @@ -96,6 +96,10 @@ + + + + @@ -109,7 +113,7 @@ - +