Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryProperties.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,62 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of a with design water level results for properties panel + /// with information about the category boundary type. + /// + public class DesignWaterLevelCalculationCategoryBoundaryProperties : HydraulicBoundaryLocationCalculationCategoryBoundaryProperties + { + /// + /// + /// Creates a new instance of . + /// + public DesignWaterLevelCalculationCategoryBoundaryProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, + string categoryBoundaryName) + : base(hydraulicBoundaryLocationCalculation, categoryBoundaryName) {} + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Result_Description))] + public override RoundedDouble Result + { + get + { + return base.Result; + } + } + + [ResourcesDescription(typeof(Resources), nameof(Resources.DesignWaterLevelCalculation_Convergence_Description))] + public override CalculationConvergence Convergence + { + get + { + return base.Convergence; + } + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelCalculationOutputProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs =================================================================== diff -u -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (.../DesignWaterLevelHydraulicBoundaryLocationProperties.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationProperties.cs (.../DesignWaterLevelHydraulicBoundaryLocationProperties.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -41,20 +41,20 @@ /// Creates a new instance of . /// public DesignWaterLevelHydraulicBoundaryLocationProperties(HydraulicBoundaryLocation location, - IEnumerable> calculationPerCategoryBoundary) + 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 + public DesignWaterLevelCalculationCategoryBoundaryProperties[] CategoryBoundaries { get { - return CalculationPerCategoryBoundary.Select(calculation => new DesignWaterLevelCalculationOutputProperties(calculation.Item2, - calculation.Item1)).ToArray(); + return CalculationPerCategoryBoundary.Select(calculation => new DesignWaterLevelCalculationCategoryBoundaryProperties(calculation.Item2, + calculation.Item1)).ToArray(); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryProperties.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,65 @@ +// 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 Core.Common.Gui.Attributes; +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 with information + /// about the category boundary type. + /// + public abstract class HydraulicBoundaryLocationCalculationCategoryBoundaryProperties : HydraulicBoundaryLocationCalculationBaseProperties + { + /// + /// Creates a new instance of . + /// + /// The hydraulic boundary location calculation. + /// The name of the category boundary the calculation belongs to. + /// Thrown when any parameter is null. + protected HydraulicBoundaryLocationCalculationCategoryBoundaryProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, + string categoryBoundaryName) + : base(hydraulicBoundaryLocationCalculation) + { + if (categoryBoundaryName == null) + { + throw new ArgumentNullException(nameof(categoryBoundaryName)); + } + + CategoryBoundaryName = categoryBoundaryName; + } + + [PropertyOrder(1)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_General))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationCalculationOutputProperties_CategoryBoundaryName_Description))] + public string CategoryBoundaryName { get; } + + public override string ToString() + { + return CategoryBoundaryName; + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/HydraulicBoundaryLocationCalculationOutputProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationCategoryBoundaryProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationCategoryBoundaryProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationCategoryBoundaryProperties.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,62 @@ +// 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 Core.Common.Base.Data; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// ViewModel of a with wave height results for properties panel + /// with information about the category boundary type. + /// + public class WaveHeightCalculationCategoryBoundaryProperties : HydraulicBoundaryLocationCalculationCategoryBoundaryProperties + { + /// + /// + /// Creates a new instance of . + /// + public WaveHeightCalculationCategoryBoundaryProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, + string categoryBoundaryName) + : base(hydraulicBoundaryLocationCalculation, categoryBoundaryName) {} + + [ResourcesDisplayName(typeof(Resources), nameof(Resources.WaveHeightCalculation_Result_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.WaveHeightCalculation_Result_Description))] + public override RoundedDouble Result + { + get + { + return base.Result; + } + } + + [ResourcesDescription(typeof(Resources), nameof(Resources.WaveHeightCalculation_Convergence_Description))] + public override CalculationConvergence Convergence + { + get + { + return base.Convergence; + } + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightCalculationOutputProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs =================================================================== diff -u -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (.../WaveHeightHydraulicBoundaryLocationProperties.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/WaveHeightHydraulicBoundaryLocationProperties.cs (.../WaveHeightHydraulicBoundaryLocationProperties.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -49,12 +49,12 @@ [ResourcesDisplayName(typeof(Resources), nameof(Resources.FailureMechanismAssemblyCategories_DisplayName))] [ResourcesDescription(typeof(Resources), nameof(Resources.HydraulicBoundaryLocationProperties_CategoryBoundaries_Description))] [TypeConverter(typeof(ExpandableArrayConverter))] - public WaveHeightCalculationOutputProperties[] CategoryBoundaries + public WaveHeightCalculationCategoryBoundaryProperties[] CategoryBoundaries { get { - return CalculationPerCategoryBoundary.Select(calculation => new WaveHeightCalculationOutputProperties(calculation.Item2, - calculation.Item1)).ToArray(); + return CalculationPerCategoryBoundary.Select(calculation => new WaveHeightCalculationCategoryBoundaryProperties(calculation.Item2, + calculation.Item1)).ToArray(); } } } Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r6cd7ed9865da9f211a6e1e3cd4a0ac86b321eef0 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 6cd7ed9865da9f211a6e1e3cd4a0ac86b321eef0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -98,8 +98,8 @@ - - + + @@ -109,7 +109,7 @@ - + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationCategoryBoundaryPropertiesTest.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,113 @@ +// 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 Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DesignWaterLevelCalculationCategoryBoundaryPropertiesTest + { + private const int designWaterLevelPropertyIndex = 1; + private const int convergencePropertyIndex = 6; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new DesignWaterLevelCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(hydraulicBoundaryLocationCalculation, properties.Data); + } + + [Test] + public void Constructor_WithValidData_PropertiesHaveExpectedAttributesValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new DesignWaterLevelCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(8, dynamicProperties.Count); + + const string resultCategory = "Resultaat"; + + PropertyDescriptor designWaterLevelProperty = dynamicProperties[designWaterLevelPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(designWaterLevelProperty, + resultCategory, + "Waterstand [m+NAP]", + "Berekende waterstand.", + true); + + PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty, + resultCategory, + "Convergentie", + "Is convergentie bereikt in de waterstand berekening?", + true); + } + + [Test] + public void GetProperties_Always_ReturnsExpectedValues() + { + // Setup + var random = new Random(); + double designWaterLevel = random.NextDouble(); + var convergence = random.NextEnumValue(); + const string categoryBoundaryName = "A"; + var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(designWaterLevel, + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + convergence, + new TestGeneralResultSubMechanismIllustrationPoint()); + + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = hydraulicBoundaryLocationCalculationOutput + }; + + // Call + var properties = new DesignWaterLevelCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, categoryBoundaryName); + + // Assert + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.Result); + Assert.AreEqual(convergence, properties.Convergence); + Assert.AreEqual(categoryBoundaryName, properties.CategoryBoundaryName); + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelCalculationOutputPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs (.../DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs (.../DesignWaterLevelHydraulicBoundaryLocationPropertiesTest.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -97,7 +97,7 @@ calculations); // Assert - DesignWaterLevelCalculationOutputProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); + DesignWaterLevelCalculationCategoryBoundaryProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); Assert.AreEqual("A", categoryBoundaryCalculation.CategoryBoundaryName); Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, categoryBoundaryCalculation.Result); Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.CalculationConvergence, categoryBoundaryCalculation.Convergence); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationCategoryBoundaryPropertiesTest.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,314 @@ +// 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 Core.Common.Gui.Converters; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class HydraulicBoundaryLocationCalculationCategoryBoundaryPropertiesTest + { + private const int categoryBoundaryNamePropertyIndex = 0; + private const int resultPropertyIndex = 1; + private const int targetProbabilityPropertyIndex = 2; + private const int targetReliabilityPropertyIndex = 3; + private const int calculatedProbabilityPropertyIndex = 4; + private const int calculatedReliabilityPropertyIndex = 5; + private const int convergencePropertyIndex = 6; + private const int shouldCalculateIllustrationPointsIndex = 7; + private const int governingWindDirectionIndex = 8; + private const int alphaValuesIndex = 9; + private const int durationsIndex = 10; + private const int illustrationPointsIndex = 11; + + [Test] + public void Constructor_HydraulicBoundaryLocationCalculationNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(null, "A"); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("hydraulicBoundaryLocationCalculation", paramName); + } + + [Test] + public void Constructor_CategoryBoundaryNameNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties( + new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()), + null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("categoryBoundaryName", paramName); + } + + [Test] + public void Constructor_ExpectedProperties() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + Assert.IsInstanceOf(properties); + } + + [Test] + public void Constructor_WithoutGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(8, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + const string resultCategory = "Resultaat"; + const string illustrationPointsCategory = "Illustratiepunten"; + + PropertyDescriptor categoryBoundaryNameProperty = dynamicProperties[categoryBoundaryNamePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundaryNameProperty, + generalCategory, + "Categoriegrens", + "De categoriegrens behorende bij het resultaat.", + true); + + PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty, + resultCategory, + nameof(properties.Result), + "", + true); + + PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty, + resultCategory, + "Doelkans [1/jaar]", + "De ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty, + resultCategory, + "Betrouwbaarheidsindex doelkans [-]", + "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty, + resultCategory, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty, + resultCategory, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty, + resultCategory, + "Convergentie", + string.Empty, + true); + + PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty, + illustrationPointsCategory, + "Illustratiepunten inlezen", + "Neem de informatie over de illustratiepunten op in het berekeningsresultaat."); + } + + [Test] + public void Constructor_WithGeneralIllustrationPointsResult_PropertiesHaveExpectedAttributesValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = new TestHydraulicBoundaryLocationCalculationOutput(new TestGeneralResultSubMechanismIllustrationPoint()) + }; + + // Call + var properties = new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(12, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + const string resultCategory = "Resultaat"; + const string illustrationPointsCategory = "Illustratiepunten"; + + PropertyDescriptor categoryBoundaryNameProperty = dynamicProperties[categoryBoundaryNamePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(categoryBoundaryNameProperty, + generalCategory, + "Categoriegrens", + "De categoriegrens behorende bij het resultaat.", + true); + + PropertyDescriptor resultProperty = dynamicProperties[resultPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultProperty, + resultCategory, + nameof(properties.Result), + "", + true); + + PropertyDescriptor targetProbabilityProperty = dynamicProperties[targetProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetProbabilityProperty, + resultCategory, + "Doelkans [1/jaar]", + "De ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor targetReliabilityProperty = dynamicProperties[targetReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(targetReliabilityProperty, + resultCategory, + "Betrouwbaarheidsindex doelkans [-]", + "Betrouwbaarheidsindex van de ingevoerde kans waarvoor het resultaat moet worden berekend.", + true); + + PropertyDescriptor calculatedProbabilityProperty = dynamicProperties[calculatedProbabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedProbabilityProperty, + resultCategory, + "Berekende kans [1/jaar]", + "De berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor calculatedReliabilityProperty = dynamicProperties[calculatedReliabilityPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculatedReliabilityProperty, + resultCategory, + "Betrouwbaarheidsindex berekende kans [-]", + "Betrouwbaarheidsindex van de berekende kans van voorkomen van het berekende resultaat.", + true); + + PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty, + resultCategory, + "Convergentie", + string.Empty, + true); + + PropertyDescriptor calculateIllustrationPointsProperty = dynamicProperties[shouldCalculateIllustrationPointsIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(calculateIllustrationPointsProperty, + illustrationPointsCategory, + "Illustratiepunten inlezen", + "Neem de informatie over de illustratiepunten op in het berekeningsresultaat."); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[governingWindDirectionIndex], + illustrationPointsCategory, + "Maatgevende windrichting", + "De windrichting waarvoor de berekende betrouwbaarheidsindex het laagst is.", + true); + + PropertyDescriptor alphaValuesProperty = dynamicProperties[alphaValuesIndex]; + Assert.NotNull(alphaValuesProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(alphaValuesProperty, + illustrationPointsCategory, + "Invloedscoëfficiënten [-]", + "Berekende invloedscoëfficiënten voor alle beschouwde stochasten.", + true); + + PropertyDescriptor durationsProperty = dynamicProperties[durationsIndex]; + Assert.NotNull(durationsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(durationsProperty, + illustrationPointsCategory, + "Tijdsduren [uur]", + "Tijdsduren waarop de stochasten betrekking hebben.", + true); + + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[illustrationPointsIndex], + illustrationPointsCategory, + "Illustratiepunten", + "De lijst van illustratiepunten voor de berekening.", + true); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var random = new Random(39); + const string categoryBoundaryName = "A-Z"; + var calculationConvergence = random.NextEnumValue(); + + var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + calculationConvergence, + null); + + // Call + var properties = new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = hydraulicBoundaryLocationCalculationOutput + }, + categoryBoundaryName); + + // Assert + Assert.AreEqual(categoryBoundaryName, properties.CategoryBoundaryName); + Assert.AreEqual(calculationConvergence, properties.Convergence); + } + + [Test] + public void ToString_Always_ReturnsNameAndLocation() + { + // Setup + const string categoryBoundaryName = "C"; + + // Call + HydraulicBoundaryLocationCalculationCategoryBoundaryProperties properties = new TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties( + new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()), + categoryBoundaryName); + + // Assert + Assert.AreEqual(categoryBoundaryName, properties.ToString()); + } + + private class TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties : HydraulicBoundaryLocationCalculationCategoryBoundaryProperties + { + public TestHydraulicBoundaryLocationCalculationCategoryBoundaryProperties(HydraulicBoundaryLocationCalculation hydraulicBoundaryLocationCalculation, + string categoryBoundaryName) + : base(hydraulicBoundaryLocationCalculation, categoryBoundaryName) {} + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/HydraulicBoundaryLocationCalculationOutputPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationCategoryBoundaryPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationCategoryBoundaryPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationCategoryBoundaryPropertiesTest.cs (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -0,0 +1,113 @@ +// 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 Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Common.Data.TestUtil.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class WaveHeightCalculationCategoryBoundaryPropertiesTest + { + private const int waveHeightPropertyIndex = 1; + private const int convergencePropertyIndex = 6; + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new WaveHeightCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + Assert.IsInstanceOf(properties); + Assert.AreSame(hydraulicBoundaryLocationCalculation, properties.Data); + } + + [Test] + public void Constructor_WithValidData_PropertiesHaveExpectedAttributesValues() + { + // Setup + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()); + + // Call + var properties = new WaveHeightCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, "A"); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(8, dynamicProperties.Count); + + const string resultCategory = "Resultaat"; + + PropertyDescriptor waveHeightProperty = dynamicProperties[waveHeightPropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(waveHeightProperty, + resultCategory, + "Golfhoogte [m]", + "Berekende golfhoogte.", + true); + + PropertyDescriptor convergenceProperty = dynamicProperties[convergencePropertyIndex]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(convergenceProperty, + resultCategory, + "Convergentie", + "Is convergentie bereikt in de golfhoogte berekening?", + true); + } + + [Test] + public void GetProperties_Always_ReturnsExpectedValues() + { + // Setup + var random = new Random(); + double waveHeight = random.NextDouble(); + var convergence = random.NextEnumValue(); + const string categoryBoundaryName = "A"; + var hydraulicBoundaryLocationCalculationOutput = new HydraulicBoundaryLocationCalculationOutput(waveHeight, + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + random.NextDouble(), + convergence, + new TestGeneralResultSubMechanismIllustrationPoint()); + + var hydraulicBoundaryLocationCalculation = new HydraulicBoundaryLocationCalculation(new TestHydraulicBoundaryLocation()) + { + Output = hydraulicBoundaryLocationCalculationOutput + }; + + // Call + var properties = new WaveHeightCalculationCategoryBoundaryProperties(hydraulicBoundaryLocationCalculation, categoryBoundaryName); + + // Assert + Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, properties.Result); + Assert.AreEqual(convergence, properties.Convergence); + Assert.AreEqual(categoryBoundaryName, properties.CategoryBoundaryName); + } + } +} \ No newline at end of file Fisheye: Tag e9602557466ba57cb9d288377cf0a3ab0fb0426c refers to a dead (removed) revision in file `Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightCalculationOutputPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs =================================================================== diff -u -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs (.../WaveHeightHydraulicBoundaryLocationPropertiesTest.cs) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/WaveHeightHydraulicBoundaryLocationPropertiesTest.cs (.../WaveHeightHydraulicBoundaryLocationPropertiesTest.cs) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -97,7 +97,7 @@ calculations); // Assert - WaveHeightCalculationOutputProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); + WaveHeightCalculationCategoryBoundaryProperties categoryBoundaryCalculation = properties.CategoryBoundaries.Single(); Assert.AreEqual("A", categoryBoundaryCalculation.CategoryBoundaryName); Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.Result, categoryBoundaryCalculation.Result); Assert.AreEqual(hydraulicBoundaryLocationCalculation.Output.CalculationConvergence, categoryBoundaryCalculation.Convergence); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -rbb29d09db7cda2fbce4c36d2d544f5ef74c7c103 -re9602557466ba57cb9d288377cf0a3ab0fb0426c --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision bb29d09db7cda2fbce4c36d2d544f5ef74c7c103) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision e9602557466ba57cb9d288377cf0a3ab0fb0426c) @@ -100,8 +100,8 @@ - - + + @@ -110,7 +110,7 @@ - +