Index: Core/Common/src/Core.Common.Utils/Attributes/ResourcesDisplayNameAttribute.cs =================================================================== diff -u -r4512af7782ee31b36941bb280b54d9da2953dd71 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/src/Core.Common.Utils/Attributes/ResourcesDisplayNameAttribute.cs (.../ResourcesDisplayNameAttribute.cs) (revision 4512af7782ee31b36941bb280b54d9da2953dd71) +++ Core/Common/src/Core.Common.Utils/Attributes/ResourcesDisplayNameAttribute.cs (.../ResourcesDisplayNameAttribute.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -28,6 +28,7 @@ /// Variation on , enables the display name to be fetched from resources. /// /// Do not combine this with on the same item + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Enum | AttributeTargets.Field)] public sealed class ResourcesDisplayNameAttribute : DisplayNameAttribute { /// Fisheye: Tag eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Utils/Attributes/ResourcesEnumDisplayNameAttribute.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Core/Common/src/Core.Common.Utils/Core.Common.Utils.csproj (.../Core.Common.Utils.csproj) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -84,7 +84,6 @@ Properties\GlobalAssembly.cs - Index: Core/Common/test/Core.Common.Utils.Test/Attributes/ResourcesDisplayNameAttributeTest.cs =================================================================== diff -u -r29cfa36a80794e6c3264d29ec8e72d204f3302d3 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/test/Core.Common.Utils.Test/Attributes/ResourcesDisplayNameAttributeTest.cs (.../ResourcesDisplayNameAttributeTest.cs) (revision 29cfa36a80794e6c3264d29ec8e72d204f3302d3) +++ Core/Common/test/Core.Common.Utils.Test/Attributes/ResourcesDisplayNameAttributeTest.cs (.../ResourcesDisplayNameAttributeTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -1,8 +1,28 @@ -using System; +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. +using System; +using System.Linq; using Core.Common.Utils.Attributes; using Core.Common.Utils.Test.Properties; - using NUnit.Framework; namespace Core.Common.Utils.Test.Attributes @@ -41,5 +61,61 @@ // Assert Assert.AreEqual(Resources.SomeStringResource, attribute.DisplayName); } + + [Test] + public void Enum_StringResource_ExpectedValues() + { + // Call + var fieldInfo = typeof(SimpleEnum).GetFields().FirstOrDefault(fi => fi.FieldType == typeof(SimpleEnum)); + Assert.IsNotNull(fieldInfo); + var resourcesDisplayNameAttribute = (ResourcesDisplayNameAttribute) Attribute.GetCustomAttribute(fieldInfo, typeof(ResourcesDisplayNameAttribute)); + + // Assert + Assert.IsNotNull(resourcesDisplayNameAttribute); + Assert.AreEqual(Resources.EnumStringResource, resourcesDisplayNameAttribute.DisplayName); + } + + [Test] + public void Property_StringResource_ExpectedValues() + { + // Call + var fieldInfo = typeof(SimpleClass).GetProperty("Name"); + Assert.IsNotNull(fieldInfo); + var resourcesDisplayNameAttribute = (ResourcesDisplayNameAttribute) Attribute.GetCustomAttribute(fieldInfo, typeof(ResourcesDisplayNameAttribute)); + + // Assert + Assert.IsNotNull(resourcesDisplayNameAttribute); + Assert.AreEqual(Resources.MethodStringResource, resourcesDisplayNameAttribute.DisplayName); + } + + [Test] + public void Class_StringResource_ExpectedValues() + { + // Call + var resourcesDisplayNameAttribute = (ResourcesDisplayNameAttribute) Attribute.GetCustomAttribute(typeof(SimpleClass), typeof(ResourcesDisplayNameAttribute)); + + // Assert + Assert.IsNotNull(resourcesDisplayNameAttribute); + Assert.AreEqual(Resources.ClassStringResource, resourcesDisplayNameAttribute.DisplayName); + } + + private enum SimpleEnum + { + [ResourcesDisplayName(typeof(Resources), "EnumStringResource")] + FirstValue + } + + [ResourcesDisplayName(typeof(Resources), "ClassStringResource")] + private class SimpleClass + { + [ResourcesDisplayName(typeof(Resources), "MethodStringResource")] + public string Name + { + get + { + return string.Empty; + } + } + } } } \ No newline at end of file Fisheye: Tag eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Utils.Test/Attributes/ResourcesEnumDisplayNameAttributeTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -73,7 +73,6 @@ - Index: Core/Common/test/Core.Common.Utils.Test/Properties/Resources.Designer.cs =================================================================== diff -u -rf9f9c0b7a1648fa87a6b423140e09d29c4b26a9d -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/test/Core.Common.Utils.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f9f9c0b7a1648fa87a6b423140e09d29c4b26a9d) +++ Core/Common/test/Core.Common.Utils.Test/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -91,6 +91,15 @@ } /// + /// Looks up a localized string similar to Awesome class value. + /// + internal static string ClassStringResource { + get { + return ResourceManager.GetString("ClassStringResource", resourceCulture); + } + } + + /// /// Looks up a localized string similar to . /// internal static string EmbeddedResource1 { @@ -109,6 +118,24 @@ } /// + /// Looks up a localized string similar to Awesome enum value. + /// + internal static string EnumStringResource { + get { + return ResourceManager.GetString("EnumStringResource", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Awesome method value. + /// + internal static string MethodStringResource { + get { + return ResourceManager.GetString("MethodStringResource", resourceCulture); + } + } + + /// /// Looks up a localized string similar to . /// internal static string NonEmbeddedResource { Index: Core/Common/test/Core.Common.Utils.Test/Properties/Resources.resx =================================================================== diff -u -rf9f9c0b7a1648fa87a6b423140e09d29c4b26a9d -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Core/Common/test/Core.Common.Utils.Test/Properties/Resources.resx (.../Resources.resx) (revision f9f9c0b7a1648fa87a6b423140e09d29c4b26a9d) +++ Core/Common/test/Core.Common.Utils.Test/Properties/Resources.resx (.../Resources.resx) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -151,4 +151,13 @@ ..\Resources\NonEmbeddedResource.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + Awesome class value + + + Awesome enum value + + + Awesome method value + \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs (.../BreakWaterType.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/BreakWaterType.cs (.../BreakWaterType.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -32,19 +32,19 @@ /// /// A wall. /// - [ResourcesEnumDisplayName(typeof(Resources), "BreakWaterType_Wall_DisplayName")] + [ResourcesDisplayName(typeof(Resources), "BreakWaterType_Wall_DisplayName")] Wall = 1, /// /// A watertight retaining structure. /// - [ResourcesEnumDisplayName(typeof(Resources), "BreakWaterType_Caisson_DisplayName")] + [ResourcesDisplayName(typeof(Resources), "BreakWaterType_Caisson_DisplayName")] Caisson = 2, /// /// A barrier that impounds water or underground streams. /// - [ResourcesEnumDisplayName(typeof(Resources), "BreakWaterType_Dam_DisplayName")] + [ResourcesDisplayName(typeof(Resources), "BreakWaterType_Dam_DisplayName")] Dam = 3 } } \ No newline at end of file Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GeneralGrassCoverErosionInwardsInput.cs (.../GeneralGrassCoverErosionInwardsInput.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -37,11 +37,13 @@ CriticalOvertoppingModelFactor = 1.0; FbFactor = new NormalDistribution(2) { - Mean = new RoundedDouble(2, 4.75), StandardDeviation = new RoundedDouble(2, 0.5) + Mean = new RoundedDouble(2, 4.75), + StandardDeviation = new RoundedDouble(2, 0.5) }; FnFactor = new NormalDistribution(2) { - Mean = new RoundedDouble(2, 2.6), StandardDeviation = new RoundedDouble(2, 0.35) + Mean = new RoundedDouble(2, 2.6), + StandardDeviation = new RoundedDouble(2, 0.35) }; OvertoppingModelFactor = 1.0; FrunupModelFactor = new NormalDistribution(2) @@ -51,7 +53,8 @@ }; FshallowModelFactor = new NormalDistribution(2) { - Mean = new RoundedDouble(2, 0.92), StandardDeviation = new RoundedDouble(2, 0.24) + Mean = new RoundedDouble(2, 0.92), + StandardDeviation = new RoundedDouble(2, 0.24) }; } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs =================================================================== diff -u -rdec46d5efaad5332ffb2a96e67ec11209ddc5515 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision dec46d5efaad5332ffb2a96e67ec11209ddc5515) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Data/GrassCoverErosionInwardsFailureMechanism.cs (.../GrassCoverErosionInwardsFailureMechanism.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -57,7 +57,7 @@ public GeneralGrassCoverErosionInwardsInput GeneralInput { get; private set; } /// - /// Length-effect parameters. + /// Gets the length-effect parameters. /// public NormProbabilityGrassCoverErosionInwardsInput NormProbabilityInput { get; private set; } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -487,7 +487,7 @@ } /// - /// Looks up a localized string similar to Naam van de grasbekleding erosie kruin en binnentalud berekening. + /// Looks up a localized string similar to De naam van de berekening voor grasbekleding erosie kruin en binnentalud.. /// public static string GrassCoverErosionInwardsInputCalculation_Name_Description { get { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Properties/Resources.resx (.../Resources.resx) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -266,7 +266,7 @@ Frunup model factor [-] - Naam van de grasbekleding erosie kruin en binnentalud berekening + De naam van de berekening voor grasbekleding erosie kruin en binnentalud. Naam Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeGeometryProperties.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeGeometryProperties.cs (.../DikeGeometryProperties.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DikeGeometryProperties.cs (.../DikeGeometryProperties.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -21,7 +21,6 @@ using System.Collections.Generic; using System.ComponentModel; -using System.Globalization; using System.Linq; using Core.Common.Base.Data; using Core.Common.Gui.Attributes; @@ -44,20 +43,20 @@ [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesDisplayName(typeof(Resources), "DikeGeometry_Coordinates_DisplayName")] [ResourcesDescription(typeof(Resources), "DikeGeometry_Coordinates_Description")] - public string[] Coordinates + public RoundedDouble[] Coordinates { get { var startingPoint = data.WrappedData.DikeGeometry.FirstOrDefault(); if (startingPoint == null) { - return new string[0]; + return new RoundedDouble[0]; } - var coordinates = new List + var coordinates = new List { - new RoundedDouble(2, startingPoint.StartingPoint.X).Value.ToString(CultureInfo.InvariantCulture) + new RoundedDouble(2, startingPoint.StartingPoint.X) }; - coordinates.AddRange(data.WrappedData.DikeGeometry.Select(d => new RoundedDouble(2, d.EndingPoint.X).Value.ToString(CultureInfo.InvariantCulture))); + coordinates.AddRange(data.WrappedData.DikeGeometry.Select(d => new RoundedDouble(2, d.EndingPoint.X))); return coordinates.ToArray(); } } @@ -66,12 +65,12 @@ [TypeConverter(typeof(ExpandableArrayConverter))] [ResourcesDisplayName(typeof(Resources), "DikeGeometry_Roughness_DisplayName")] [ResourcesDescription(typeof(Resources), "DikeGeometry_Roughness_Description")] - public string[] Roughness + public RoundedDouble[] Roughness { get { var roughnesses = data.WrappedData.DikeGeometry.Select(d => d.Roughness); - return roughnesses.Select(roughness => new RoundedDouble(2, roughness).Value.ToString(CultureInfo.InvariantCulture)).ToArray(); + return roughnesses.Select(roughness => new RoundedDouble(2, roughness)).ToArray(); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs (.../DistributionProperties.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs (.../DistributionProperties.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -21,7 +21,6 @@ using System; using System.ComponentModel; -using System.Globalization; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; @@ -45,38 +44,38 @@ [ResourcesDisplayName(typeof(Resources), "NormalDistribution_Mean_DisplayName")] [ResourcesDescription(typeof(Resources), "NormalDistribution_Mean_Description")] - public virtual string Mean + public virtual RoundedDouble Mean { get { - return new RoundedDouble(2, data.Mean).Value.ToString(CultureInfo.InvariantCulture); + return data.Mean; } set { if (Observerable == null) { throw new ArgumentException(); } - data.Mean = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, double.Parse(value, CultureInfo.InvariantCulture)); + data.Mean = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, value); Observerable.NotifyObservers(); } } [ResourcesDisplayName(typeof(Resources), "NormalDistribution_StandardDeviation_DisplayName")] [ResourcesDescription(typeof(Resources), "NormalDistribution_StandardDeviation_Description")] - public virtual string StandardDeviation + public virtual RoundedDouble StandardDeviation { get { - return new RoundedDouble(2, data.StandardDeviation).Value.ToString(CultureInfo.InvariantCulture); + return data.StandardDeviation; } set { if (Observerable == null) { throw new ArgumentException(); } - data.StandardDeviation = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, double.Parse(value, CultureInfo.InvariantCulture)); + data.StandardDeviation = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, value); Observerable.NotifyObservers(); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs (.../ForeshoreProperties.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ForeshoreProperties.cs (.../ForeshoreProperties.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -58,7 +58,7 @@ { get { - return data.WrappedData.ForeshoreGeometry.ToArray().Length; + return data.WrappedData.ForeshoreGeometry.Count(); } } Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (.../ReadOnlyNormalDistributionProperties.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (.../ReadOnlyNormalDistributionProperties.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -20,6 +20,7 @@ // All rights reserved. using System.ComponentModel; +using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using Ringtoets.Common.Data.Probabilistics; @@ -41,7 +42,7 @@ } [ReadOnly(true)] - public override string Mean + public override RoundedDouble Mean { get { @@ -50,7 +51,7 @@ } [ReadOnly(true)] - public override string StandardDeviation + public override RoundedDouble StandardDeviation { get { Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/TypeConverters/EnumTypeConverter.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/TypeConverters/EnumTypeConverter.cs (.../EnumTypeConverter.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/TypeConverters/EnumTypeConverter.cs (.../EnumTypeConverter.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -35,14 +35,14 @@ /// /// Initializes a new instance of the class for the given Enum . /// - /// This class is designed such that it looks for on each Enum value. + /// This class is designed such that it looks for on each Enum value. /// A that represents the type of enumeration to associate with this enumeration converter. public EnumTypeConverter(Type type) : base(type) {} private static string GetDisplayName(MemberInfo memberInfo) { - var resourcesEnumDisplayNameAttribute = (ResourcesEnumDisplayNameAttribute) Attribute.GetCustomAttribute(memberInfo, typeof(ResourcesEnumDisplayNameAttribute)); - return (resourcesEnumDisplayNameAttribute != null) ? resourcesEnumDisplayNameAttribute.DisplayName : null; + var resourcesDisplayNameAttribute = (ResourcesDisplayNameAttribute) Attribute.GetCustomAttribute(memberInfo, typeof(ResourcesDisplayNameAttribute)); + return (resourcesDisplayNameAttribute != null) ? resourcesDisplayNameAttribute.DisplayName : null; } #region Convert from Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs (.../DikeGeometryPropertiesTest.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DikeGeometryPropertiesTest.cs (.../DikeGeometryPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -45,7 +45,7 @@ [Test] public void Constructor_ExpectedValues() { - // Setup & Call + // Call var properties = new DikeGeometryProperties(); // Assert Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (.../DistributionPropertiesTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (.../DistributionPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -21,7 +21,6 @@ using System; using System.ComponentModel; -using System.Globalization; using Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; @@ -46,7 +45,7 @@ [Test] public void Constructor_ExpectedValues() { - // Setup & Call + // Call var properties = new SimpleDistributionProperties(); // Assert @@ -72,10 +71,8 @@ properties.Data = distribution; // Assert - var expectedMean = new RoundedDouble(2, distribution.Mean).Value.ToString(CultureInfo.InvariantCulture); - Assert.AreEqual(expectedMean, properties.Mean); - var expectedStandardDeviation = new RoundedDouble(2, distribution.StandardDeviation).Value.ToString(CultureInfo.InvariantCulture); - Assert.AreEqual(expectedStandardDeviation, properties.StandardDeviation); + Assert.AreEqual(distribution.Mean, properties.Mean); + Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation); } [Test] @@ -88,7 +85,7 @@ }; // Call - TestDelegate test = () => properties.Mean = "20"; + TestDelegate test = () => properties.Mean = new RoundedDouble(2, 20); // Assert Assert.Throws(test); @@ -104,7 +101,7 @@ }; // Call - TestDelegate test = () => properties.StandardDeviation = "20"; + TestDelegate test = () => properties.StandardDeviation = new RoundedDouble(2, 20); // Assert Assert.Throws(test); @@ -121,7 +118,7 @@ Data = new SimpleDistribution(), }; mockRepository.ReplayAll(); - const string newMeanValue = "20"; + RoundedDouble newMeanValue = new RoundedDouble(3, 20); // Call properties.Mean = newMeanValue; @@ -142,7 +139,7 @@ Data = new SimpleDistribution(), }; mockRepository.ReplayAll(); - const string newStandardDeviationValue = "20"; + RoundedDouble newStandardDeviationValue = new RoundedDouble(3, 20); // Call properties.StandardDeviation = newStandardDeviationValue; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs (.../GrassCoverErosionInwardsCalculationContextPropertiesTest.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsCalculationContextPropertiesTest.cs (.../GrassCoverErosionInwardsCalculationContextPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -44,7 +44,7 @@ [Test] public void Constructor_ExpectedValues() { - // Setup & Call + // Call var properties = new GrassCoverErosionInwardsCalculationContextProperties(); // Assert Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -rcb52c5ede0d946ce4ea1c704dc2231fba080b402 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision cb52c5ede0d946ce4ea1c704dc2231fba080b402) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -20,9 +20,7 @@ // All rights reserved. using System.ComponentModel; -using System.Globalization; using Core.Common.Base; -using Core.Common.Base.Data; using Core.Common.Gui.PropertyBag; using NUnit.Framework; using Rhino.Mocks; @@ -75,17 +73,17 @@ Assert.AreEqual(2, properties.LengthEffect); var generalInput = new GeneralGrassCoverErosionInwardsInput(); - VerifyRoundedDoubleString(generalInput.FbFactor.Mean, properties.FbFactor.Mean); - VerifyRoundedDoubleString(generalInput.FbFactor.StandardDeviation, properties.FbFactor.StandardDeviation); + Assert.AreEqual(generalInput.FbFactor.Mean, properties.FbFactor.Mean); + Assert.AreEqual(generalInput.FbFactor.StandardDeviation, properties.FbFactor.StandardDeviation); - VerifyRoundedDoubleString(generalInput.FnFactor.Mean, properties.FnFactor.Mean); - VerifyRoundedDoubleString(generalInput.FnFactor.StandardDeviation, properties.FnFactor.StandardDeviation); + Assert.AreEqual(generalInput.FnFactor.Mean, properties.FnFactor.Mean); + Assert.AreEqual(generalInput.FnFactor.StandardDeviation, properties.FnFactor.StandardDeviation); - VerifyRoundedDoubleString(generalInput.FrunupModelFactor.Mean, properties.FrunupModelFactor.Mean); - VerifyRoundedDoubleString(generalInput.FrunupModelFactor.StandardDeviation, properties.FrunupModelFactor.StandardDeviation); + Assert.AreEqual(generalInput.FrunupModelFactor.Mean, properties.FrunupModelFactor.Mean); + Assert.AreEqual(generalInput.FrunupModelFactor.StandardDeviation, properties.FrunupModelFactor.StandardDeviation); - VerifyRoundedDoubleString(generalInput.FshallowModelFactor.Mean, properties.FshallowModelFactor.Mean); - VerifyRoundedDoubleString(generalInput.FshallowModelFactor.StandardDeviation, properties.FshallowModelFactor.StandardDeviation); + Assert.AreEqual(generalInput.FshallowModelFactor.Mean, properties.FshallowModelFactor.Mean); + Assert.AreEqual(generalInput.FshallowModelFactor.StandardDeviation, properties.FshallowModelFactor.StandardDeviation); mockRepository.VerifyAll(); } @@ -178,12 +176,6 @@ Assert.AreEqual("De parameter 'F ondiep model factor' die gebruikt wordt in de berekening.", fshallowProperty.Description); } - private static void VerifyRoundedDoubleString(RoundedDouble roundedDouble, string expectedString) - { - var stringValue = new RoundedDouble(2, roundedDouble).Value.ToString(CultureInfo.InvariantCulture); - Assert.AreEqual(expectedString, stringValue); - } - private const int namePropertyIndex = 0; private const int codePropertyIndex = 1; private const int lengthEffectPropertyIndex = 2; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs =================================================================== diff -u -r61f2445be56feb2180cb0990d8889164c17b79f0 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision 61f2445be56feb2180cb0990d8889164c17b79f0) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsInputContextPropertiesTest.cs (.../GrassCoverErosionInwardsInputContextPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -101,8 +101,8 @@ Assert.AreEqual(breakWaterProperties.UseBreakWater, properties.BreakWater.UseBreakWater); Assert.AreEqual(breakWaterProperties.BreakWaterHeight, properties.BreakWater.BreakWaterHeight); Assert.AreEqual(breakWaterProperties.BreakWaterType, properties.BreakWater.BreakWaterType); - VerifyRoundedDoubleString(input.CriticalFlowRate.Mean, properties.CriticalFlowRate.Mean); - VerifyRoundedDoubleString(input.CriticalFlowRate.StandardDeviation, properties.CriticalFlowRate.StandardDeviation); + Assert.AreEqual(input.CriticalFlowRate.Mean, properties.CriticalFlowRate.Mean); + Assert.AreEqual(input.CriticalFlowRate.StandardDeviation, properties.CriticalFlowRate.StandardDeviation); mockRepository.VerifyAll(); } @@ -199,12 +199,6 @@ mockRepository.VerifyAll(); } - private static void VerifyRoundedDoubleString(RoundedDouble roundedDouble, string expectedString) - { - var stringValue = new RoundedDouble(2, roundedDouble).Value.ToString(CultureInfo.InvariantCulture); - Assert.AreEqual(expectedString, stringValue); - } - private const int dikeGeometryPropertyIndex = 0; private const int dikeHeightPropertyIndex = 1; private const int foreshorePropertyIndex = 2; Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs =================================================================== diff -u -r2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (.../ReadOnlyNormalDistributionPropertiesTest.cs) (revision 2a3b5c8305492fff0fa77b78fa3b2f5e9f8091a5) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (.../ReadOnlyNormalDistributionPropertiesTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -34,7 +34,7 @@ [Test] public void Constructor_ExpectedValues() { - // Setup & Call + // Call var properties = new ReadOnlyNormalDistributionProperties(); // Assert @@ -65,13 +65,13 @@ PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); Assert.AreEqual(4, dynamicProperties.Count); - PropertyDescriptor meanProperty = dynamicProperties[1]; + PropertyDescriptor meanProperty = dynamicProperties.Find("Mean", false); Assert.IsNotNull(meanProperty); Assert.IsTrue(meanProperty.IsReadOnly); - PropertyDescriptor standardDeviation = dynamicProperties[2]; - Assert.IsNotNull(standardDeviation); - Assert.IsTrue(meanProperty.IsReadOnly); + PropertyDescriptor standardDeviationProperty = dynamicProperties.Find("StandardDeviation", false); + Assert.IsNotNull(standardDeviationProperty); + Assert.IsTrue(standardDeviationProperty.IsReadOnly); mockRepository.VerifyAll(); } } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs =================================================================== diff -u -r77c09b9a2aecfd8931db21ab3d16719b0b6e91db -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision 77c09b9a2aecfd8931db21ab3d16719b0b6e91db) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsCalculationGroupContextTreeNodeInfoTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -98,21 +98,21 @@ public void ChildNodeObjects_GroupWithMixedContents_ReturnChildren() { // Setup - var failureMechanismMock = mocks.StrictMock(); var assessmentSectionMock = mocks.StrictMock(); + var calculationItem = mocks.StrictMock(); mocks.ReplayAll(); + var failureMechanism = new GrassCoverErosionInwardsFailureMechanism(); var group = new CalculationGroup(); var childGroup = new CalculationGroup(); - var calculationItem = mocks.StrictMock(); - var childCalculation = new GrassCoverErosionInwardsCalculation(failureMechanismMock.GeneralInput); + var childCalculation = new GrassCoverErosionInwardsCalculation(failureMechanism.GeneralInput); group.Children.Add(childGroup); group.Children.Add(calculationItem); group.Children.Add(childCalculation); var groupContext = new GrassCoverErosionInwardsCalculationGroupContext(group, - failureMechanismMock, + failureMechanism, assessmentSectionMock); // Call @@ -122,12 +122,13 @@ Assert.AreEqual(group.Children.Count, children.Length); var calculationGroupContext = (GrassCoverErosionInwardsCalculationGroupContext) children[0]; Assert.AreSame(childGroup, calculationGroupContext.WrappedData); - Assert.AreSame(failureMechanismMock, calculationGroupContext.FailureMechanism); + Assert.AreSame(failureMechanism, calculationGroupContext.FailureMechanism); Assert.AreSame(assessmentSectionMock, calculationGroupContext.AssessmentSection); Assert.AreSame(calculationItem, children[1]); var calculationContext = (GrassCoverErosionInwardsCalculationContext) children[2]; Assert.AreSame(childCalculation, calculationContext.WrappedData); Assert.AreSame(assessmentSectionMock, calculationContext.AssessmentSection); + mocks.VerifyAll(); } [Test] Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs =================================================================== diff -u -r3b29807e8903b2cea3ee7a00a59b2b50f9de1f12 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs) (revision 3b29807e8903b2cea3ee7a00a59b2b50f9de1f12) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TreeNodeInfos/GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs (.../GrassCoverErosionInwardsInputContextTreeNodeInfoTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -80,7 +80,7 @@ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext( mocksRepository.StrictMock(generalInput), mocksRepository.StrictMock(generalInput), - mocksRepository.StrictMock(), + new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); mocksRepository.ReplayAll(); @@ -101,7 +101,7 @@ var grassCoverErosionInwardsInputContext = new GrassCoverErosionInwardsInputContext( mocksRepository.StrictMock(generalInput), mocksRepository.StrictMock(generalInput), - mocksRepository.StrictMock(), + new GrassCoverErosionInwardsFailureMechanism(), assessmentSection); mocksRepository.ReplayAll(); Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TypeConverters/EnumTypeConverterTest.cs =================================================================== diff -u -r88e4b60f9055cf9153fc5c7b618537accfc3f3fa -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TypeConverters/EnumTypeConverterTest.cs (.../EnumTypeConverterTest.cs) (revision 88e4b60f9055cf9153fc5c7b618537accfc3f3fa) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/TypeConverters/EnumTypeConverterTest.cs (.../EnumTypeConverterTest.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -128,10 +128,10 @@ private enum SimpleEnum { - [ResourcesEnumDisplayName(typeof(Resources), "SimpleEnum_FirstValue_DisplayName")] + [ResourcesDisplayName(typeof(Resources), "SimpleEnum_FirstValue_DisplayName")] FirstValue, - [ResourcesEnumDisplayName(typeof(Resources), "SimpleEnum_SecondValue_DisplayName")] + [ResourcesDisplayName(typeof(Resources), "SimpleEnum_SecondValue_DisplayName")] SecondValue } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationContextProperties.cs =================================================================== diff -u -r23a37b025a5d0358c1f30fb31de41a2c284519a5 -reaa8b3e276e1a0a6a4d0a2f96016879d8d12d394 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationContextProperties.cs (.../PipingCalculationContextProperties.cs) (revision 23a37b025a5d0358c1f30fb31de41a2c284519a5) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingCalculationContextProperties.cs (.../PipingCalculationContextProperties.cs) (revision eaa8b3e276e1a0a6a4d0a2f96016879d8d12d394) @@ -19,10 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using Core.Common.Gui; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; - using Ringtoets.Piping.Forms.PresentationObjects; using Ringtoets.Piping.Forms.Properties;