Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -1884,7 +1884,7 @@ } /// - /// Looks up a localized string similar to Realisaties in het illustratiepunt. + /// Looks up a localized string similar to Stochastwaarden. /// public static string IllustrationPoint_Realization_DisplayName { get { @@ -1902,7 +1902,7 @@ } /// - /// Looks up a localized string similar to Waarden in het illustratiepunt. + /// Looks up a localized string similar to Afgeleide grootheden. /// public static string IllustrationPoint_Result_DisplayName { get { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -1117,7 +1117,7 @@ Realisaties van de stochasten in het illustratiepunt. - Realisaties in het illustratiepunt + Stochastwaarden Invloedscoëfficient^2 @@ -1210,7 +1210,7 @@ Waarden van variabelen in het illustratiepunt. - Waarden in het illustratiepunt + Afgeleide grootheden Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointValuesProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointValuesProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/IllustrationPointValuesProperties.cs (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -0,0 +1,88 @@ +// 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.Attributes; +using Core.Common.Gui.Converters; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// Properties of the values in the sub mechanism illustration point. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class IllustrationPointValuesProperties : ObjectProperties + { + /// + /// Creates a new instance of the . + /// + /// The sub mechanism illustration point + /// to create the properties for. + /// Thrown when + /// is null. + public IllustrationPointValuesProperties(SubMechanismIllustrationPoint illustrationPoint) + { + if (illustrationPoint == null) + { + throw new ArgumentNullException(nameof(illustrationPoint)); + } + Data = illustrationPoint; + } + + [PropertyOrder(0)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_Realization_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_Realization_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueAsRoundedDoubleWithoutTrailingZeroesElement( + nameof(SubMechanismIllustrationPointStochast.Name), + nameof(SubMechanismIllustrationPointStochast.Realization))] + public SubMechanismIllustrationPointStochast[] Realizations + { + get + { + return data.Stochasts.ToArray(); + } + } + + [PropertyOrder(1)] + [ResourcesCategory(typeof(Resources), nameof(Resources.Categories_IllustrationPoints))] + [ResourcesDisplayName(typeof(Resources), nameof(Resources.IllustrationPoint_Result_DisplayName))] + [ResourcesDescription(typeof(Resources), nameof(Resources.IllustrationPoint_Result_Description))] + [TypeConverter(typeof(KeyValueExpandableArrayConverter))] + [KeyValueAsRoundedDoubleWithoutTrailingZeroesElement( + nameof(IllustrationPointResult.Description), + nameof(IllustrationPointResult.Value))] + public IllustrationPointResult[] Results + { + get + { + return data.IllustrationPointResults.ToArray(); + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r04f5526f955c773d4987e820e2aca2614dfbd8d8 -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 04f5526f955c773d4987e820e2aca2614dfbd8d8) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -86,6 +86,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs =================================================================== diff -u -r6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs (.../FaultTreeIllustrationPointPropertiesTest.cs) (revision 6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/FaultTreeIllustrationPointPropertiesTest.cs (.../FaultTreeIllustrationPointPropertiesTest.cs) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -44,8 +44,6 @@ private const int durationsPropertyIndex = 5; private const int illustrationPointPropertyIndex = 6; - private const string illustrationPointsCategoryName = "Illustratiepunten"; - [Test] public void Constructor_ChildNodesNull_ThrowsArgumentNullException() { @@ -148,6 +146,7 @@ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(7, dynamicProperties.Count); + const string illustrationPointsCategoryName = "Illustratiepunten"; PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, illustrationPointsCategoryName, Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointValuesPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointValuesPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/IllustrationPointValuesPropertiesTest.cs (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -0,0 +1,138 @@ +// 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.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Ringtoets.Common.Data.IllustrationPoints; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class IllustrationPointValuesPropertiesTest + { + private const int realizationsPropertyIndex = 0; + private const int resultsPropertyIndex = 1; + + [Test] + public void Constructor_SubMechanismIllustrationPointNull_ThrowsArgumentNullException() + { + // Call + TestDelegate call = () => new IllustrationPointValuesProperties(null); + + // Assert + var exception = Assert.Throws(call); + Assert.AreEqual("illustrationPoint", exception.ParamName); + } + + [Test] + public void Constructor_ValidArgumentValues_ReturnsExpectedProperties() + { + // Setup + var random = new Random(21); + var illustrationPoint = new SubMechanismIllustrationPoint(string.Empty, + random.NextDouble(), + Enumerable.Empty(), + Enumerable.Empty()); + + // Call + var properties = new IllustrationPointValuesProperties(illustrationPoint); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(illustrationPoint, properties.Data); + + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + TestHelper.AssertTypeConverter(nameof(IllustrationPointValuesProperties.Realizations)); + TestHelper.AssertTypeConverter(nameof(IllustrationPointValuesProperties.Results)); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedValues() + { + // Setup + var random = new Random(21); + var stochasts = new[] + { + new SubMechanismIllustrationPointStochast("some name", random.NextDouble(), random.NextDouble(), random.NextDouble()) + }; + var illustrationPointResults = new[] + { + new IllustrationPointResult("some description", random.NextDouble()) + }; + + var illustrationPoint = new SubMechanismIllustrationPoint("name", + random.NextDouble(), + stochasts, + illustrationPointResults); + + // Call + var properties = new IllustrationPointValuesProperties(illustrationPoint); + + // Assert + CollectionAssert.AreEqual(illustrationPoint.Stochasts, properties.Realizations); + CollectionAssert.AreEqual(illustrationPoint.IllustrationPointResults, properties.Results); + } + + [Test] + public void GetProperties_ValidData_ReturnsExpectedAttributeValues() + { + // Setup + var random = new Random(21); + var illustrationPoint = new SubMechanismIllustrationPoint("name", + random.NextDouble(), + Enumerable.Empty(), + Enumerable.Empty()); + + // Call + var properties = new IllustrationPointValuesProperties(illustrationPoint); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(2, dynamicProperties.Count); + + const string category = "Illustratiepunten"; + + PropertyDescriptor realizationsProperty = dynamicProperties[realizationsPropertyIndex]; + Assert.NotNull(realizationsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(realizationsProperty, + category, + "Stochastwaarden", + "Realisaties van de stochasten in het illustratiepunt.", + true); + + PropertyDescriptor resultsProperty = dynamicProperties[resultsPropertyIndex]; + Assert.NotNull(resultsProperty.Attributes[typeof(KeyValueElementAttribute)]); + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultsProperty, + category, + "Afgeleide grootheden", + "Waarden van variabelen in het illustratiepunt.", + true); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs =================================================================== diff -u -r6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision 6fbc05ec2d0ab27a8eee7d61fc939f1798abd6ae) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/SubMechanismIllustrationPointPropertiesTest.cs (.../SubMechanismIllustrationPointPropertiesTest.cs) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -44,8 +44,6 @@ private const int realizationsPropertyIndex = 6; private const int resultsPropertyIndex = 7; - private const string illustrationPointsCategoryName = "Illustratiepunten"; - [Test] public void Constructor_ExpectedValues() { @@ -128,6 +126,7 @@ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(subMechanismProperties); Assert.AreEqual(8, dynamicProperties.Count); + const string illustrationPointsCategoryName = "Illustratiepunten"; PropertyDescriptor probabilityProperty = dynamicProperties[probabilityPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(probabilityProperty, illustrationPointsCategoryName, @@ -173,14 +172,14 @@ PropertyDescriptor realizationsProperty = dynamicProperties[realizationsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(realizationsProperty, illustrationPointsCategoryName, - "Realisaties in het illustratiepunt", + "Stochastwaarden", "Realisaties van de stochasten in het illustratiepunt.", true); PropertyDescriptor resultsProperty = dynamicProperties[resultsPropertyIndex]; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(resultsProperty, illustrationPointsCategoryName, - "Waarden in het illustratiepunt", + "Afgeleide grootheden", "Waarden van variabelen in het illustratiepunt.", true); } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs =================================================================== diff -u -r98337ba56cc4d4b2217c26812e96e9401a263d56 -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (.../TopLevelSubMechanismIllustrationPointPropertiesTest.cs) (revision 98337ba56cc4d4b2217c26812e96e9401a263d56) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TopLevelSubMechanismIllustrationPointPropertiesTest.cs (.../TopLevelSubMechanismIllustrationPointPropertiesTest.cs) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -170,12 +170,12 @@ const string closingSituation = "closingSituation"; const string windDirectionName = "windDirection"; - var context = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(windDirectionName), - closingSituation, - submechanismIllustrationPoint); + var illustrationPoint = new TopLevelSubMechanismIllustrationPoint(WindDirectionTestFactory.CreateTestWindDirection(windDirectionName), + closingSituation, + submechanismIllustrationPoint); // Call - var properties = new TopLevelSubMechanismIllustrationPointProperties(context, Enumerable.Empty()); + var properties = new TopLevelSubMechanismIllustrationPointProperties(illustrationPoint, Enumerable.Empty()); // Assert Assert.AreEqual(illustrationPointName, properties.Name); @@ -271,7 +271,7 @@ Assert.NotNull(illustrationPointRealizationsProperty.Attributes[typeof(KeyValueElementAttribute)]); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointRealizationsProperty, generalCategory, - "Realisaties in het illustratiepunt", + "Stochastwaarden", "Realisaties van de stochasten in het illustratiepunt.", true); @@ -280,7 +280,7 @@ Assert.NotNull(illustrationPointResultsProperty.Attributes[typeof(KeyValueElementAttribute)]); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointResultsProperty, generalCategory, - "Waarden in het illustratiepunt", + "Afgeleide grootheden", "Waarden van variabelen in het illustratiepunt.", true); } @@ -309,8 +309,8 @@ PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); Assert.AreEqual(8, dynamicProperties.Count); - const string generalCategory = "Algemeen"; + const string generalCategory = "Algemeen"; PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(dynamicProperties[namePropertyIndex], generalCategory, "Naam", @@ -358,7 +358,7 @@ Assert.NotNull(illustrationPointRealizationsProperty.Attributes[typeof(KeyValueElementAttribute)]); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointRealizationsProperty, generalCategory, - "Realisaties in het illustratiepunt", + "Stochastwaarden", "Realisaties van de stochasten in het illustratiepunt.", true); @@ -367,7 +367,7 @@ Assert.NotNull(illustrationPointResultsProperty.Attributes[typeof(KeyValueElementAttribute)]); PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(illustrationPointResultsProperty, generalCategory, - "Waarden in het illustratiepunt", + "Afgeleide grootheden", "Waarden van variabelen in het illustratiepunt.", true); } Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r04f5526f955c773d4987e820e2aca2614dfbd8d8 -rfd69c584e0201271b6994b2b0d7d5ce07be23ad4 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 04f5526f955c773d4987e820e2aca2614dfbd8d8) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision fd69c584e0201271b6994b2b0d7d5ce07be23ad4) @@ -107,6 +107,7 @@ +