Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -re9126cf0eaf73660d9c85fac899a6324291c7ebe -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision e9126cf0eaf73660d9c85fac899a6324291c7ebe) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -612,6 +612,78 @@ } /// + /// Looks up a localized string similar to De gemiddelde waarde van de lognormale verdeling.. + /// + public static string LognormalDistribution_Mean_Description { + get { + return ResourceManager.GetString("LognormalDistribution_Mean_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De standaardafwijking van de lognormale verdeling.. + /// + public static string LogNormalDistribution_StandardDeviation_Description { + get { + return ResourceManager.GetString("LogNormalDistribution_StandardDeviation_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het soort kansverdeling waarin deze parameter gedefinieerd wordt.. + /// + public static string NormalDistribution_DestributionType_Description { + get { + return ResourceManager.GetString("NormalDistribution_DestributionType_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Type verdeling. + /// + public static string NormalDistribution_DestributionType_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_DestributionType_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De gemiddelde waarde van de normale verdeling.. + /// + public static string NormalDistribution_Mean_Description { + get { + return ResourceManager.GetString("NormalDistribution_Mean_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Verwachtingswaarde. + /// + public static string NormalDistribution_Mean_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_Mean_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De standaardafwijking van de normale verdeling.. + /// + public static string NormalDistribution_StandardDeviation_Description { + get { + return ResourceManager.GetString("NormalDistribution_StandardDeviation_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Standaardafwijking. + /// + public static string NormalDistribution_StandardDeviation_DisplayName { + get { + return ResourceManager.GetString("NormalDistribution_StandardDeviation_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap OutputFolderIcon { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -re9126cf0eaf73660d9c85fac899a6324291c7ebe -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision e9126cf0eaf73660d9c85fac899a6324291c7ebe) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -328,4 +328,28 @@ ..\Resources\table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + De gemiddelde waarde van de lognormale verdeling. + + + De standaardafwijking van de lognormale verdeling. + + + Het soort kansverdeling waarin deze parameter gedefinieerd wordt. + + + Type verdeling + + + De gemiddelde waarde van de normale verdeling. + + + Verwachtingswaarde + + + De standaardafwijking van de normale verdeling. + + + Standaardafwijking + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/DistributionProperties.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,89 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// Property for probabilistic distribution. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public abstract class DistributionProperties : ObjectProperties + { + protected IObservable Observerable; + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_DestributionType_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_DestributionType_Description")] + public abstract string DistributionType { get; } + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_Mean_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_Mean_Description")] + public virtual RoundedDouble Mean + { + get + { + return data.Mean; + } + set + { + if (Observerable == null) + { + throw new ArgumentException(); + } + data.Mean = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, value); + Observerable.NotifyObservers(); + } + } + + [ResourcesDisplayName(typeof(Resources), "NormalDistribution_StandardDeviation_DisplayName")] + [ResourcesDescription(typeof(Resources), "NormalDistribution_StandardDeviation_Description")] + public virtual RoundedDouble StandardDeviation + { + get + { + return data.StandardDeviation; + } + set + { + if (Observerable == null) + { + throw new ArgumentException(); + } + data.StandardDeviation = new RoundedDouble(data.StandardDeviation.NumberOfDecimalPlaces, value); + Observerable.NotifyObservers(); + } + } + + public override string ToString() + { + return data == null ? Resources.NormalDistribution_StandardDeviation_DisplayName : + string.Format("{0} ({1} = {2})", Mean, Resources.NormalDistribution_StandardDeviation_DisplayName, StandardDeviation); + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/LogNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/LogNormalDistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/LogNormalDistributionProperties.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,78 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.Properties; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// An implementation for + /// properties. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class LogNormalDistributionProperties : DistributionProperties + { + public LogNormalDistributionProperties(IObservable observerable) + { + Observerable = observerable; + } + + public override string DistributionType + { + get + { + return "Lognormaal"; + } + } + + [ResourcesDescription(typeof(Resources), "LognormalDistribution_Mean_Description")] + public override RoundedDouble Mean + { + get + { + return base.Mean; + } + set + { + base.Mean = value; + } + } + + [ResourcesDescription(typeof(Resources), "LogNormalDistribution_StandardDeviation_Description")] + public override RoundedDouble StandardDeviation + { + get + { + return base.StandardDeviation; + } + set + { + base.StandardDeviation = value; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyLogNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyLogNormalDistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyLogNormalDistributionProperties.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,66 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// A read-only implementation for + /// properties. + /// + public class ReadOnlyLogNormalDistributionProperties : LogNormalDistributionProperties + { + /// + /// Creates a new instance of the class. + /// + public ReadOnlyLogNormalDistributionProperties() : base(null) {} + + public override string DistributionType + { + get + { + return "Lognormaal"; + } + } + + [ReadOnly(true)] + public override RoundedDouble Mean + { + get + { + return base.Mean; + } + } + + [ReadOnly(true)] + public override RoundedDouble StandardDeviation + { + get + { + return base.StandardDeviation; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,62 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Ringtoets.Common.Data.Probabilistics; + +namespace Ringtoets.Common.Forms.PropertyClasses +{ + /// + /// A read-only implementation for + /// properties. + /// + [TypeConverter(typeof(ExpandableObjectConverter))] + public class ReadOnlyNormalDistributionProperties : DistributionProperties + { + public override string DistributionType + { + get + { + return "Normale verdeling"; + } + } + + [ReadOnly(true)] + public override RoundedDouble Mean + { + get + { + return base.Mean; + } + } + + [ReadOnly(true)] + public override RoundedDouble StandardDeviation + { + get + { + return base.StandardDeviation; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -ra883652e0cf7e59e4d086472939379ad9be36472 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision a883652e0cf7e59e4d086472939379ad9be36472) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -61,6 +61,10 @@ True Resources.resx + + + + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,219 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class DistributionPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new SimpleDistributionProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Standaardafwijking", properties.ToString()); + Assert.AreEqual("SimpleDestributionType", properties.DistributionType); + } + + [Test] + public void Data_SetNewDistributionContextInstance_ReturnCorrectPropertyValues() + { + // Setup + var distribution = new SimpleDistribution + { + Mean = new RoundedDouble(1, 1.1), + StandardDeviation = new RoundedDouble(2, 2.2) + }; + + var properties = new SimpleDistributionProperties(); + + // Call + properties.Data = distribution; + + // Assert + Assert.AreEqual(distribution.Mean, properties.Mean); + Assert.AreEqual(distribution.StandardDeviation, properties.StandardDeviation); + } + + [Test] + public void SetProperties_MeanWithoutObserverable_ThrowsArgumentException() + { + // Setup + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution(), + }; + + // Call + TestDelegate test = () => properties.Mean = new RoundedDouble(2, 20); + + // Assert + Assert.Throws(test); + } + + [Test] + public void SetProperties_StandardDeviationWithoutObserverable_ThrowsArgumentException() + { + // Setup + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution() + }; + + // Call + TestDelegate test = () => properties.StandardDeviation = new RoundedDouble(2, 20); + + // Assert + Assert.Throws(test); + } + + [Test] + public void SetProperties_MeanWithObserverable_ValueSetNotifyObservers() + { + // Setup + var observerableMock = mockRepository.StrictMock(); + observerableMock.Expect(o => o.NotifyObservers()).Repeat.Once(); + var properties = new SimpleObserverableDistributionProperties(observerableMock) + { + Data = new SimpleDistribution(), + }; + mockRepository.ReplayAll(); + RoundedDouble newMeanValue = new RoundedDouble(3, 20); + + // Call + properties.Mean = newMeanValue; + + // Assert + Assert.AreEqual(newMeanValue, properties.Mean); + mockRepository.VerifyAll(); + } + + [Test] + public void SetProperties_StandardDeviationWithObserverable_ValueSetNotifyObservers() + { + // Setup + var observerableMock = mockRepository.StrictMock(); + observerableMock.Expect(o => o.NotifyObservers()).Repeat.Once(); + var properties = new SimpleObserverableDistributionProperties(observerableMock) + { + Data = new SimpleDistribution(), + }; + mockRepository.ReplayAll(); + RoundedDouble newStandardDeviationValue = new RoundedDouble(3, 20); + + // Call + properties.StandardDeviation = newStandardDeviationValue; + + // Assert + Assert.AreEqual(newStandardDeviationValue, properties.StandardDeviation); + mockRepository.VerifyAll(); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Call + var properties = new SimpleDistributionProperties + { + Data = new SimpleDistribution() + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + PropertyDescriptor distributionTypeProperty = dynamicProperties[0]; + Assert.IsNotNull(distributionTypeProperty); + Assert.IsTrue(distributionTypeProperty.IsReadOnly); + + PropertyDescriptor meanProperty = dynamicProperties[1]; + Assert.IsNotNull(meanProperty); + Assert.IsFalse(meanProperty.IsReadOnly); + Assert.AreEqual("Verwachtingswaarde", meanProperty.DisplayName); + Assert.AreEqual("De gemiddelde waarde van de normale verdeling.", meanProperty.Description); + + PropertyDescriptor standardDeviationProperty = dynamicProperties[2]; + Assert.IsNotNull(standardDeviationProperty); + Assert.IsFalse(standardDeviationProperty.IsReadOnly); + Assert.AreEqual("Standaardafwijking", standardDeviationProperty.DisplayName); + Assert.AreEqual("De standaardafwijking van de normale verdeling.", standardDeviationProperty.Description); + } + + private class SimpleDistributionProperties : DistributionProperties + { + public override string DistributionType + { + get + { + return "SimpleDestributionType"; + } + } + } + + private class SimpleObserverableDistributionProperties : DistributionProperties + { + public SimpleObserverableDistributionProperties(IObservable observerable) + { + Observerable = observerable; + } + + public override string DistributionType + { + get + { + return "SimpleDestributionType"; + } + } + } + + private class SimpleDistribution : IDistribution + { + public RoundedDouble Mean { get; set; } + public RoundedDouble StandardDeviation { get; set; } + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,110 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class LogNormalDistributionPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var observerable = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new LogNormalDistributionProperties(observerable); + + // Assert + Assert.IsInstanceOf(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Lognormaal", properties.DistributionType); + mockRepository.VerifyAll(); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var observerable = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new LogNormalDistributionProperties(observerable); + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + var meanAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("Mean")); + Assert.IsNotNull(meanAttributes); + AssertAttributesOfType(meanAttributes, "Verwachtingswaarde", + attribute => attribute.DisplayName); + AssertAttributesOfType(meanAttributes, + "De gemiddelde waarde van de lognormale verdeling.", + attribute => attribute.Description); + + var standardAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("StandardDeviation")); + Assert.IsNotNull(standardAttributes); + AssertAttributesOfType(standardAttributes, "Standaardafwijking", + attribute => attribute.DisplayName); + AssertAttributesOfType(standardAttributes, + "De standaardafwijking van de lognormale verdeling.", + attribute => attribute.Description); + + mockRepository.VerifyAll(); + } + + private static void AssertAttributesOfType(IEnumerable attributes, TR expectedValue, + Func action) + { + var meanDisplayNameAttribute = attributes.OfType(); + Assert.IsNotNull(meanDisplayNameAttribute); + var e = meanDisplayNameAttribute.FirstOrDefault(); + Assert.IsNotNull(e); + Assert.AreEqual(expectedValue, action(e)); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyLogNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyLogNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyLogNormalDistributionPropertiesTest.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using NUnit.Framework; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class ReadOnlyLogNormalDistributionPropertiesTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new ReadOnlyLogNormalDistributionProperties(); + + // Assert + Assert.IsInstanceOf(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Lognormaal", properties.DistributionType); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Call + var properties = new ReadOnlyLogNormalDistributionProperties + { + Data = new LognormalDistribution(1) + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + var meanAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("Mean")); + Assert.IsNotNull(meanAttributes); + AssertAttributesOfType(meanAttributes, true, attribute => attribute.IsReadOnly); + AssertAttributesOfType(meanAttributes, "Verwachtingswaarde", + attribute => attribute.DisplayName); + AssertAttributesOfType(meanAttributes, + "De gemiddelde waarde van de lognormale verdeling.", + attribute => attribute.Description); + + var standardAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("StandardDeviation")); + Assert.IsNotNull(standardAttributes); + AssertAttributesOfType(standardAttributes, true, attribute => attribute.IsReadOnly); + AssertAttributesOfType(standardAttributes, "Standaardafwijking", + attribute => attribute.DisplayName); + AssertAttributesOfType(standardAttributes, + "De standaardafwijking van de lognormale verdeling.", + attribute => attribute.Description); + } + + private static void AssertAttributesOfType(IEnumerable attributes, TR expectedValue, + Func action) + { + var meanDisplayNameAttribute = attributes.OfType(); + Assert.IsNotNull(meanDisplayNameAttribute); + var e = meanDisplayNameAttribute.FirstOrDefault(); + Assert.IsNotNull(e); + Assert.AreEqual(expectedValue, action(e)); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,95 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using NUnit.Framework; +using Ringtoets.Common.Data.Probabilistics; +using Ringtoets.Common.Forms.PropertyClasses; + +namespace Ringtoets.Common.Forms.Test.PropertyClasses +{ + [TestFixture] + public class ReadOnlyNormalDistributionPropertiesTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new ReadOnlyNormalDistributionProperties(); + + // Assert + Assert.IsInstanceOf(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Normale verdeling", properties.DistributionType); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Call + var properties = new ReadOnlyNormalDistributionProperties + { + Data = new NormalDistribution(1) + }; + + // Assert + TypeConverter classTypeConverter = TypeDescriptor.GetConverter(properties, true); + Assert.IsInstanceOf(classTypeConverter); + + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(4, dynamicProperties.Count); + + var meanAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("Mean")); + Assert.IsNotNull(meanAttributes); + AssertAttributesOfType(meanAttributes, true, attribute => attribute.IsReadOnly); + AssertAttributesOfType(meanAttributes, "Verwachtingswaarde", + attribute => attribute.DisplayName); + AssertAttributesOfType(meanAttributes, + "De gemiddelde waarde van de normale verdeling.", + attribute => attribute.Description); + + var standardAttributes = Attribute.GetCustomAttributes(properties.GetType().GetProperty("StandardDeviation")); + Assert.IsNotNull(standardAttributes); + AssertAttributesOfType(standardAttributes, true, attribute => attribute.IsReadOnly); + AssertAttributesOfType(standardAttributes, "Standaardafwijking", + attribute => attribute.DisplayName); + AssertAttributesOfType(standardAttributes, + "De standaardafwijking van de normale verdeling.", + attribute => attribute.Description); + } + + private static void AssertAttributesOfType(IEnumerable attributes, TR expectedValue, + Func action) + { + var meanDisplayNameAttribute = attributes.OfType(); + Assert.IsNotNull(meanDisplayNameAttribute); + var e = meanDisplayNameAttribute.FirstOrDefault(); + Assert.IsNotNull(e); + Assert.AreEqual(expectedValue, action(e)); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -ra883652e0cf7e59e4d086472939379ad9be36472 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision a883652e0cf7e59e4d086472939379ad9be36472) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -66,6 +66,10 @@ + + + + Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/DistributionProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs =================================================================== diff -u -r77158a296743c3b3457336706fdbea047daf4886 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision 77158a296743c3b3457336706fdbea047daf4886) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextProperties.cs (.../GrassCoverErosionInwardsFailureMechanismContextProperties.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -22,6 +22,7 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.Properties; @@ -40,6 +41,27 @@ private const int fnFactorPropertyIndex = 6; private const int fshallowModelFactorPropertyIndex = 7; + #region Length effect parameters + + [PropertyOrder(lengthEffectPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_LengthEffect")] + [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_N_DisplayName")] + [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_N_Description")] + public int LengthEffect + { + get + { + return data.WrappedData.NormProbabilityInput.N; + } + set + { + data.WrappedData.NormProbabilityInput.N = value; + data.WrappedData.NotifyObservers(); + } + } + + #endregion + #region General [PropertyOrder(namePropertyIndex)] @@ -68,27 +90,6 @@ #endregion - #region Length effect parameters - - [PropertyOrder(lengthEffectPropertyIndex)] - [ResourcesCategory(typeof(Resources), "Categories_LengthEffect")] - [ResourcesDisplayName(typeof(Resources), "GrassCoverErosionInwardsInput_N_DisplayName")] - [ResourcesDescription(typeof(Resources), "GrassCoverErosionInwardsInput_N_Description")] - public int LengthEffect - { - get - { - return data.WrappedData.NormProbabilityInput.N; - } - set - { - data.WrappedData.NormProbabilityInput.N = value; - data.WrappedData.NotifyObservers(); - } - } - - #endregion - #region Model settings [PropertyOrder(frunupModelFactorPropertyIndex)] Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs =================================================================== diff -u -r4539b4546747c257739b1695b9ebc9c29e393ffe -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision 4539b4546747c257739b1695b9ebc9c29e393ffe) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/GrassCoverErosionInwardsInputContextProperties.cs (.../GrassCoverErosionInwardsInputContextProperties.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -27,9 +27,9 @@ using Core.Common.Gui.Attributes; using Core.Common.Gui.PropertyBag; using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.PropertyClasses; using Ringtoets.GrassCoverErosionInwards.Forms.PresentationObjects; using Ringtoets.GrassCoverErosionInwards.Forms.Properties; -using Ringtoets.GrassCoverErosionInwards.Forms.TypeConverters; using Ringtoets.GrassCoverErosionInwards.Forms.UITypeEditors; using Ringtoets.HydraRing.Data; Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/LogNormalDistributionProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/PropertyClasses/ReadOnlyNormalDistributionProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/GrassCoverErosionInwards/src/Ringtoets.GrassCoverErosionInwards.Forms/Ringtoets.GrassCoverErosionInwards.Forms.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -59,10 +59,7 @@ - - - Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/DistributionPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs =================================================================== diff -u -r1415a03f7cf9716016602784586b8f5da3cf4def -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision 1415a03f7cf9716016602784586b8f5da3cf4def) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismContextPropertiesTest.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -136,42 +136,49 @@ PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; Assert.IsNotNull(nameProperty); Assert.IsTrue(nameProperty.IsReadOnly); + Assert.AreEqual("Algemeen", nameProperty.Category); Assert.AreEqual("Naam", nameProperty.DisplayName); Assert.AreEqual("De naam van het toetsspoor.", nameProperty.Description); PropertyDescriptor codeProperty = dynamicProperties[codePropertyIndex]; Assert.IsNotNull(codeProperty); Assert.IsTrue(codeProperty.IsReadOnly); + Assert.AreEqual("Algemeen", codeProperty.Category); Assert.AreEqual("Label", codeProperty.DisplayName); Assert.AreEqual("Het label van het toetsspoor.", codeProperty.Description); PropertyDescriptor lengthEffectProperty = dynamicProperties[lengthEffectPropertyIndex]; Assert.IsNotNull(lengthEffectProperty); Assert.IsFalse(lengthEffectProperty.IsReadOnly); + Assert.AreEqual("Lengte-effect parameters", lengthEffectProperty.Category); Assert.AreEqual("N", lengthEffectProperty.DisplayName); Assert.AreEqual("De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.", lengthEffectProperty.Description); PropertyDescriptor frunupModelFactorProperty = dynamicProperties[frunupModelFactorPropertyIndex]; Assert.IsNotNull(frunupModelFactorProperty); Assert.IsTrue(frunupModelFactorProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", frunupModelFactorProperty.Category); Assert.AreEqual("Modelfactor Frunup [-]", frunupModelFactorProperty.DisplayName); Assert.AreEqual("De parameter 'Frunup' die gebruikt wordt in de berekening.", frunupModelFactorProperty.Description); PropertyDescriptor fbModelProperty = dynamicProperties[fbFactorPropertyIndex]; Assert.IsNotNull(fbModelProperty); Assert.IsTrue(fbModelProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", fbModelProperty.Category); Assert.AreEqual("Modelfactor Fb [-]", fbModelProperty.DisplayName); Assert.AreEqual("De parameter 'Fb' die gebruikt wordt in de berekening.", fbModelProperty.Description); PropertyDescriptor fnFactorProperty = dynamicProperties[fnFactorPropertyIndex]; Assert.IsNotNull(fnFactorProperty); Assert.IsTrue(fnFactorProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", fnFactorProperty.Category); Assert.AreEqual("Modelfactor Fn [-]", fnFactorProperty.DisplayName); Assert.AreEqual("De parameter 'Fn' die gebruikt wordt in de berekening.", fnFactorProperty.Description); PropertyDescriptor fshallowProperty = dynamicProperties[fshallowModelFactorPropertyIndex]; Assert.IsNotNull(fshallowProperty); Assert.IsTrue(fshallowProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", fshallowProperty.Category); Assert.AreEqual("Modelfactor Fondiep [-]", fshallowProperty.DisplayName); Assert.AreEqual("De parameter 'Fondiep' die gebruikt wordt in de berekening.", fshallowProperty.Description); } Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/LogNormalDistributionPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag f5ac9de8b45cef4515fa7a051c5af54446f96712 refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/ReadOnlyNormalDistributionPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj =================================================================== diff -u -ra97bb5cc5d80058a536b95a62c4cde7c89d6ef76 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision a97bb5cc5d80058a536b95a62c4cde7c89d6ef76) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj (.../Ringtoets.GrassCoverErosionInwards.Forms.Test.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -68,7 +68,6 @@ True Resources.resx - @@ -82,8 +81,6 @@ - - Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs =================================================================== diff -u -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (.../GeneralHeightStructuresInput.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/GeneralHeightStructuresInput.cs (.../GeneralHeightStructuresInput.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -36,7 +36,7 @@ { GravitationalAcceleration = new RoundedDouble(2, 9.87); - ModelfactorOvertopping = new LognormalDistribution(3) + ModelfactorOvertoppingFlow = new LognormalDistribution(3) { Mean = new RoundedDouble(3, 0.09), StandardDeviation = new RoundedDouble(3, 0.06) @@ -57,9 +57,9 @@ public RoundedDouble GravitationalAcceleration { get; private set; } /// - /// Gets the model factor overtopping. + /// Gets the model factor overtopping flow. /// - public LognormalDistribution ModelfactorOvertopping { get; private set; } + public LognormalDistribution ModelfactorOvertoppingFlow { get; private set; } /// /// Gets the model factor for storage volume. Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Data/HeightStructuresInput.cs (.../HeightStructuresInput.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -307,13 +307,13 @@ } /// - /// Gets the model factor overtopping. + /// Gets the model factor overtopping flow. /// - public LognormalDistribution ModelfactorOvertopping + public LognormalDistribution ModelfactorOvertoppingFlow { get { - return generalInputParameters.ModelfactorOvertopping; + return generalInputParameters.ModelfactorOvertoppingFlow; } } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r80dce3e20a58c31ec56ee8ee734a1127b9a0cb28 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 80dce3e20a58c31ec56ee8ee734a1127b9a0cb28) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -71,6 +71,24 @@ } /// + /// Looks up a localized string similar to Lengte-effect parameters. + /// + public static string Categories_LengthEffect { + get { + return ResourceManager.GetString("Categories_LengthEffect", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Modelfactoren. + /// + public static string Categories_ModelSettings { + get { + return ResourceManager.GetString("Categories_ModelSettings", resourceCulture); + } + } + + /// /// Looks up a localized string similar to {0} mag niet 'null' zijn.. /// public static string HeightStructuresContext_AssertInputsAreNotNull_DataDescription_0_cannot_be_null { @@ -115,5 +133,83 @@ return ResourceManager.GetString("HeightStructuresInputContext_NodeDisplayName", resourceCulture); } } + + /// + /// Looks up a localized string similar to De valversnelling die gebruikt wordt in de berekening.. + /// + public static string HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_Description { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_Descriptio" + + "n", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Valversnelling. + /// + public static string HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_DisplayName { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_DisplayNam" + + "e", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het kombergend oppervlak die gebruikt wordt in de berekening.. + /// + public static string HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_Description { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_Descript" + + "ion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Kombergend oppervlak. + /// + public static string HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_DisplayName { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_DisplayN" + + "ame", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Het modelfactor overslagdebiet die gebruikt wordt in de berekening.. + /// + public static string HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_Description { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_Descripti" + + "on", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Modelfactor overslagdebiet. + /// + public static string HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_DisplayName { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_DisplayNa" + + "me", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.. + /// + public static string HeightStructuresInputFailureMechanismContext_N_Description { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_N_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to N. + /// + public static string HeightStructuresInputFailureMechanismContext_N_DisplayName { + get { + return ResourceManager.GetString("HeightStructuresInputFailureMechanismContext_N_DisplayName", resourceCulture); + } + } } } Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx =================================================================== diff -u -r80dce3e20a58c31ec56ee8ee734a1127b9a0cb28 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision 80dce3e20a58c31ec56ee8ee734a1127b9a0cb28) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Properties/Resources.resx (.../Resources.resx) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -136,4 +136,34 @@ ..\Resources\control_equalizer_blue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + Lengte-effect parameters + + + Modelfactoren + + + De valversnelling die gebruikt wordt in de berekening. + + + Valversnelling + + + Het kombergend oppervlak die gebruikt wordt in de berekening. + + + Kombergend oppervlak + + + Het modelfactor overslagdebiet die gebruikt wordt in de berekening. + + + Modelfactor overslagdebiet + + + De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening. + + + N + \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismContextProperties.cs =================================================================== diff -u --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismContextProperties.cs (revision 0) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/PropertyClasses/HeightStructuresFailureMechanismContextProperties.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,140 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Utils.Attributes; +using Ringtoets.Common.Forms.PropertyClasses; +using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.Properties; +using RingtoetsCommonDataResources = Ringtoets.Common.Data.Properties.Resources; + +namespace Ringtoets.HeightStructures.Forms.PropertyClasses +{ + /// + /// ViewModel of for properties panel. + /// + public class HeightStructuresFailureMechanismContextProperties : ObjectProperties + { + private const int namePropertyIndex = 1; + private const int codePropertyIndex = 2; + private const int gravitationalAccelerationPropertyIndex = 3; + private const int lengthEffectPropertyIndex = 4; + private const int modelfactorOvertoppingFlowPropertyIndex = 5; + private const int modelFactorForStorageVolumePropertyIndex = 6; + + #region Length effect parameters + + [PropertyOrder(lengthEffectPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_LengthEffect")] + [ResourcesDisplayName(typeof(Resources), "HeightStructuresInputFailureMechanismContext_N_DisplayName")] + [ResourcesDescription(typeof(Resources), "HeightStructuresInputFailureMechanismContext_N_Description")] + public int LengthEffect + { + get + { + return data.WrappedData.NormProbabilityInput.N; + } + set + { + data.WrappedData.NormProbabilityInput.N = value; + data.WrappedData.NotifyObservers(); + } + } + + #endregion + + #region General + + [PropertyOrder(namePropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonDataResources), "Categories_General")] + [ResourcesDisplayName(typeof(RingtoetsCommonDataResources), "FailureMechanism_Name_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonDataResources), "FailureMechanism_Name_Description")] + public string Name + { + get + { + return data.WrappedData.Name; + } + } + + [PropertyOrder(codePropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonDataResources), "Categories_General")] + [ResourcesDisplayName(typeof(RingtoetsCommonDataResources), "FailureMechanism_Code_DisplayName")] + [ResourcesDescription(typeof(RingtoetsCommonDataResources), "FailureMechanism_Code_Description")] + public string Code + { + get + { + return data.WrappedData.Code; + } + } + + [PropertyOrder(gravitationalAccelerationPropertyIndex)] + [ResourcesCategory(typeof(RingtoetsCommonDataResources), "Categories_General")] + [ResourcesDisplayName(typeof(Resources), "HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_DisplayName")] + [ResourcesDescription(typeof(Resources), "HeightStructuresInputFailureMechanismContext_GravitationalAcceleration_Description")] + public RoundedDouble GravitationalAcceleration + { + get + { + return data.WrappedData.GeneralInput.GravitationalAcceleration; + } + } + + #endregion + + #region Model settings + + [PropertyOrder(modelfactorOvertoppingFlowPropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_DisplayName")] + [ResourcesDescription(typeof(Resources), "HeightStructuresInputFailureMechanismContext_ModelfactorOvertoppingFlow_Description")] + public ReadOnlyLogNormalDistributionProperties ModelfactorOvertoppingFlow + { + get + { + return new ReadOnlyLogNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.ModelfactorOvertoppingFlow + }; + } + } + + [PropertyOrder(modelFactorForStorageVolumePropertyIndex)] + [ResourcesCategory(typeof(Resources), "Categories_ModelSettings")] + [ResourcesDisplayName(typeof(Resources), "HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_DisplayName")] + [ResourcesDescription(typeof(Resources), "HeightStructuresInputFailureMechanismContext_ModelFactorForStorageVolume_Description")] + public ReadOnlyLogNormalDistributionProperties ModelFactorForStorageVolume + { + get + { + return new ReadOnlyLogNormalDistributionProperties + { + Data = data.WrappedData.GeneralInput.ModelFactorForStorageVolume + }; + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Forms/Ringtoets.HeightStructures.Forms.csproj (.../Ringtoets.HeightStructures.Forms.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -54,6 +54,7 @@ True Resources.resx + UserControl @@ -73,6 +74,16 @@ Core.Common.Controls False + + {30E4C2AE-719E-4D70-9FA9-668A9767FBFA} + Core.Common.Gui + False + + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Utils + False + {c90b77da-e421-43cc-b82e-529651bc21ac} Core.Common.Version Index: Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs =================================================================== diff -u -ref49fd08b8b47114cc398b3e0cdced469037bc4a -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision ef49fd08b8b47114cc398b3e0cdced469037bc4a) +++ Ringtoets/HeightStructures/src/Ringtoets.HeightStructures.Plugin/HeightStructuresGuiPlugin.cs (.../HeightStructuresGuiPlugin.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -34,6 +34,7 @@ using Ringtoets.Common.Forms.TreeNodeInfos; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.PropertyClasses; using Ringtoets.HeightStructures.Forms.Views; using Ringtoets.HydraRing.Calculation.Activities; using Ringtoets.HydraRing.Calculation.Data; @@ -50,6 +51,11 @@ /// public class HeightStructuresGuiPlugin : GuiPlugin { + public override IEnumerable GetPropertyInfos() + { + yield return new PropertyInfo(); + } + public override IEnumerable GetViewInfos() { yield return new ViewInfo< @@ -138,7 +144,7 @@ new StructuresOvertoppingCalculationInput(hydraulicBoundaryLocationId, new HydraRingSection(1, failureMechanismSection.Name, sectionLength, inputParameters.OrientationOfTheNormalOfTheStructure), inputParameters.GravitationalAcceleration, - inputParameters.ModelfactorOvertopping.Mean, inputParameters.ModelfactorOvertopping.StandardDeviation, + inputParameters.ModelfactorOvertoppingFlow.Mean, inputParameters.ModelfactorOvertoppingFlow.StandardDeviation, inputParameters.LevelOfCrestOfStructure.Mean, inputParameters.LevelOfCrestOfStructure.StandardDeviation, inputParameters.OrientationOfTheNormalOfTheStructure, inputParameters.ModelfactorOvertoppingSuperCriticalFlow.Mean, inputParameters.ModelfactorOvertoppingSuperCriticalFlow.StandardDeviation, Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs =================================================================== diff -u -rb784ac8be54e88a798f4b7b7ad54ffe47b587e20 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (.../GeneralHeightStructuresInputTest.cs) (revision b784ac8be54e88a798f4b7b7ad54ffe47b587e20) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/GeneralHeightStructuresInputTest.cs (.../GeneralHeightStructuresInputTest.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -42,8 +42,8 @@ Mean = new RoundedDouble(3, 0.09), StandardDeviation = new RoundedDouble(3, 0.06) }; - Assert.AreEqual(modelfactorOvertopping.Mean, inputParameters.ModelfactorOvertopping.Mean, 1e-6); - Assert.AreEqual(modelfactorOvertopping.StandardDeviation, inputParameters.ModelfactorOvertopping.StandardDeviation, 1e-6); + Assert.AreEqual(modelfactorOvertopping.Mean, inputParameters.ModelfactorOvertoppingFlow.Mean, 1e-6); + Assert.AreEqual(modelfactorOvertopping.StandardDeviation, inputParameters.ModelfactorOvertoppingFlow.StandardDeviation, 1e-6); var modelFactorForStorageVolume = new NormalDistribution(2) { Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs =================================================================== diff -u -r4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision 4aa6d896646fee50b7bc6fadd9c2251b4fdd4f2e) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Data.Test/HeightStructuresInputTest.cs (.../HeightStructuresInputTest.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -58,7 +58,7 @@ Assert.IsNull(input.HydraulicBoundaryLocation); Assert.AreEqual(generalInput.GravitationalAcceleration, input.GravitationalAcceleration); - Assert.AreEqual(generalInput.ModelfactorOvertopping, input.ModelfactorOvertopping); + Assert.AreEqual(generalInput.ModelfactorOvertoppingFlow, input.ModelfactorOvertoppingFlow); Assert.AreEqual(generalInput.ModelFactorForStorageVolume, input.ModelFactorForStorageVolume); Assert.AreEqual(generalInput.ModelFactorForIncomingFlowVolume, input.ModelFactorForIncomingFlowVolume); Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismContextPropertiesTest.cs =================================================================== diff -u --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismContextPropertiesTest.cs (revision 0) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismContextPropertiesTest.cs (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -0,0 +1,182 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.HeightStructures.Data; +using Ringtoets.HeightStructures.Data.Properties; +using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.PropertyClasses; + +namespace Ringtoets.HeightStructures.Forms.Test.PropertyClasses +{ + [TestFixture] + public class HeightStructuresFailureMechanismContextPropertiesTest + { + private MockRepository mockRepository; + + [SetUp] + public void SetUp() + { + mockRepository = new MockRepository(); + } + + [Test] + public void Constructor_ExpectedValues() + { + // Call + var properties = new HeightStructuresFailureMechanismContextProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + } + + [Test] + public void Data_SetNewFailureMechanismContextInstance_ReturnCorrectPropertyValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + var properties = new HeightStructuresFailureMechanismContextProperties(); + + // Call + properties.Data = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock); + + // Assert + Assert.AreEqual(Resources.HeightStructuresFailureMechanism_DisplayName, properties.Name); + Assert.AreEqual(Resources.HeightStructuresFailureMechanism_Code, properties.Code); + Assert.AreEqual(failureMechanism.GeneralInput.GravitationalAcceleration, properties.GravitationalAcceleration); + Assert.AreEqual(2, properties.LengthEffect); + + var generalInput = failureMechanism.GeneralInput; + Assert.AreEqual(generalInput.ModelfactorOvertoppingFlow.Mean, properties.ModelfactorOvertoppingFlow.Mean); + Assert.AreEqual(generalInput.ModelfactorOvertoppingFlow.StandardDeviation, properties.ModelfactorOvertoppingFlow.StandardDeviation); + + Assert.AreEqual(generalInput.ModelFactorForStorageVolume.Mean, properties.ModelFactorForStorageVolume.Mean); + Assert.AreEqual(generalInput.ModelFactorForStorageVolume.StandardDeviation, properties.ModelFactorForStorageVolume.StandardDeviation); + + mockRepository.VerifyAll(); + } + + [Test] + public void SetProperties_IndividualProperties_UpdateDataAndNotifyObservers() + { + // Setup + var observerMock = mockRepository.StrictMock(); + const int numberProperties = 1; + observerMock.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties); + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + failureMechanism.Attach(observerMock); + var properties = new HeightStructuresFailureMechanismContextProperties + { + Data = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock) + }; + const int newLengthEffect = 10; + + // Call + properties.LengthEffect = newLengthEffect; + + // Assert + Assert.AreEqual(newLengthEffect, failureMechanism.NormProbabilityInput.N); + mockRepository.VerifyAll(); + } + + [Test] + public void PropertyAttributes_ReturnExpectedValues() + { + // Setup + var assessmentSectionMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + var failureMechanism = new HeightStructuresFailureMechanism(); + + // Call + var properties = new HeightStructuresFailureMechanismContextProperties + { + Data = new HeightStructuresFailureMechanismContext(failureMechanism, assessmentSectionMock) + }; + + // Assert + var dynamicPropertyBag = new DynamicPropertyBag(properties); + PropertyDescriptorCollection dynamicProperties = dynamicPropertyBag.GetProperties(); + Assert.AreEqual(7, dynamicProperties.Count); + + PropertyDescriptor nameProperty = dynamicProperties[namePropertyIndex]; + Assert.IsNotNull(nameProperty); + Assert.IsTrue(nameProperty.IsReadOnly); + Assert.AreEqual("Algemeen", nameProperty.Category); + Assert.AreEqual("Naam", nameProperty.DisplayName); + Assert.AreEqual("De naam van het toetsspoor.", nameProperty.Description); + + PropertyDescriptor codeProperty = dynamicProperties[codePropertyIndex]; + Assert.IsNotNull(codeProperty); + Assert.IsTrue(codeProperty.IsReadOnly); + Assert.AreEqual("Algemeen", nameProperty.Category); + Assert.AreEqual("Label", codeProperty.DisplayName); + Assert.AreEqual("Het label van het toetsspoor.", codeProperty.Description); + + PropertyDescriptor gravitationalAccelerationProperty = dynamicProperties[gravitationalAccelerationPropertyIndex]; + Assert.IsNotNull(gravitationalAccelerationProperty); + Assert.IsTrue(gravitationalAccelerationProperty.IsReadOnly); + Assert.AreEqual("Algemeen", gravitationalAccelerationProperty.Category); + Assert.AreEqual("Valversnelling", gravitationalAccelerationProperty.DisplayName); + Assert.AreEqual("De valversnelling die gebruikt wordt in de berekening.", gravitationalAccelerationProperty.Description); + + PropertyDescriptor lengthEffectProperty = dynamicProperties[lengthEffectPropertyIndex]; + Assert.IsNotNull(lengthEffectProperty); + Assert.IsFalse(lengthEffectProperty.IsReadOnly); + Assert.AreEqual("Lengte-effect parameters", lengthEffectProperty.Category); + Assert.AreEqual("N", lengthEffectProperty.DisplayName); + Assert.AreEqual("De parameter 'N' die gebruikt wordt voor het lengte effect in de berekening.", lengthEffectProperty.Description); + + PropertyDescriptor modelfactorOvertoppingFlowProperty = dynamicProperties[modelfactorOvertoppingFlowPropertyIndex]; + Assert.IsNotNull(modelfactorOvertoppingFlowProperty); + Assert.IsTrue(modelfactorOvertoppingFlowProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", modelfactorOvertoppingFlowProperty.Category); + Assert.AreEqual("Modelfactor overslagdebiet", modelfactorOvertoppingFlowProperty.DisplayName); + Assert.AreEqual("Het modelfactor overslagdebiet die gebruikt wordt in de berekening.", modelfactorOvertoppingFlowProperty.Description); + + PropertyDescriptor modelFactorForStorageVolumeProperty = dynamicProperties[modelFactorForStorageVolumePropertyIndex]; + Assert.IsNotNull(modelFactorForStorageVolumeProperty); + Assert.IsTrue(modelFactorForStorageVolumeProperty.IsReadOnly); + Assert.AreEqual("Modelfactoren", modelFactorForStorageVolumeProperty.Category); + Assert.AreEqual("Kombergend oppervlak", modelFactorForStorageVolumeProperty.DisplayName); + Assert.AreEqual("Het kombergend oppervlak die gebruikt wordt in de berekening.", modelFactorForStorageVolumeProperty.Description); + } + + private const int namePropertyIndex = 0; + private const int codePropertyIndex = 1; + private const int gravitationalAccelerationPropertyIndex = 2; + private const int lengthEffectPropertyIndex = 3; + private const int modelfactorOvertoppingFlowPropertyIndex = 4; + private const int modelFactorForStorageVolumePropertyIndex = 5; + } +} \ No newline at end of file Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj =================================================================== diff -u -ra97bb5cc5d80058a536b95a62c4cde7c89d6ef76 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision a97bb5cc5d80058a536b95a62c4cde7c89d6ef76) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/Ringtoets.HeightStructures.Forms.Test.csproj (.../Ringtoets.HeightStructures.Forms.Test.csproj) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -59,6 +59,7 @@ + Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs =================================================================== diff -u -ra61d9a646a09ddee65775c179bba12c40003cf84 -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision a61d9a646a09ddee65775c179bba12c40003cf84) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Plugin.Test/HeightStructuresGuiPluginTest.cs (.../HeightStructuresGuiPluginTest.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -31,6 +31,7 @@ using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.HeightStructures.Data; using Ringtoets.HeightStructures.Forms.PresentationObjects; +using Ringtoets.HeightStructures.Forms.PropertyClasses; using Ringtoets.HeightStructures.Forms.Views; namespace Ringtoets.HeightStructures.Plugin.Test @@ -50,6 +51,30 @@ } [Test] + public void GetPropertyInfos_ReturnsSupportedPropertyClasses() + { + // setup + using (var guiPlugin = new HeightStructuresGuiPlugin()) + { + // call + var mocks = new MockRepository(); + mocks.ReplayAll(); + + PropertyInfo[] propertyInfos = guiPlugin.GetPropertyInfos().ToArray(); + + // assert + Assert.AreEqual(1, propertyInfos.Length); + var failureMechanismContextProperties = propertyInfos.Single(pi => pi.DataType == typeof(HeightStructuresFailureMechanismContext)); + Assert.AreEqual(typeof(HeightStructuresFailureMechanismContextProperties), failureMechanismContextProperties.PropertyObjectType); + Assert.IsNull(failureMechanismContextProperties.AdditionalDataCheck); + Assert.IsNull(failureMechanismContextProperties.GetObjectPropertiesData); + Assert.IsNull(failureMechanismContextProperties.AfterCreate); + + mocks.VerifyAll(); + } + } + + [Test] public void GetTreeNodeInfos_ReturnsSupportedTreeNodeInfos() { // Setup Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresOvertoppingCalculationInput.cs =================================================================== diff -u -r315378ecfaa9a06a553863ca91b8f4d6252e7bae -rf5ac9de8b45cef4515fa7a051c5af54446f96712 --- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresOvertoppingCalculationInput.cs (.../StructuresOvertoppingCalculationInput.cs) (revision 315378ecfaa9a06a553863ca91b8f4d6252e7bae) +++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Data/Input/Structures/StructuresOvertoppingCalculationInput.cs (.../StructuresOvertoppingCalculationInput.cs) (revision f5ac9de8b45cef4515fa7a051c5af54446f96712) @@ -30,8 +30,8 @@ { private readonly HydraRingSection section; private readonly double gravitationalAcceleration; - private readonly double modelFactorOvertoppingMean; - private readonly double modelFactorOvertoppingStandardDeviation; + private readonly double modelFactorOvertoppingFlowMean; + private readonly double modelFactorOvertoppingFlowStandardDeviation; private readonly double levelOfCrestOfStructureMean; private readonly double levelOfCrestOfStructureStandardDeviation; private readonly double structureNormalOrientation; @@ -61,8 +61,8 @@ /// The id of the hydraulic station to use during the calculation. /// The section to use during the calculation. /// The gravitational acceleration to use during the calculation. - /// The mean of the model factor overtopping to use during the calculation. - /// The standard deviation of the model factor overtopping to use during the calculation. + /// The mean of the model factor overtopping flow to use during the calculation. + /// The standard deviation of the model factor overtopping flow to use during the calculation. /// The mean of the level of the crest of the structure to use during the calculation. /// The standard deviation of the level of the crest of the structure to use during the calculation. /// The orientation of the normal of the structure to use during the calculation. @@ -87,7 +87,7 @@ /// The variation of the storm duration to use during the calculation. public StructuresOvertoppingCalculationInput(int hydraulicBoundaryLocationId, HydraRingSection hydraRingSection, double hydraRingGravitationalAcceleration, - double hydraRingModelFactorOvertoppingMean, double hydraRingModelFactorOvertoppingStandardDeviation, + double hydraRingModelFactorOvertoppingFlowMean, double hydraRingModelFactorOvertoppingFlowStandardDeviation, double hydraRingLevelOfCrestOfStructureMean, double hydraRingLevelOfCrestOfStructureStandardDeviation, double hydraRingStructureNormalOrientation, double hydraRingModelFactorOvertoppingSupercriticalFlowMean, double hydraRingModelFactorOvertoppingSupercriticalFlowStandardDeviation, @@ -106,8 +106,8 @@ { section = hydraRingSection; gravitationalAcceleration = hydraRingGravitationalAcceleration; - modelFactorOvertoppingMean = hydraRingModelFactorOvertoppingMean; - modelFactorOvertoppingStandardDeviation = hydraRingModelFactorOvertoppingStandardDeviation; + modelFactorOvertoppingFlowMean = hydraRingModelFactorOvertoppingFlowMean; + modelFactorOvertoppingFlowStandardDeviation = hydraRingModelFactorOvertoppingFlowStandardDeviation; levelOfCrestOfStructureMean = hydraRingLevelOfCrestOfStructureMean; levelOfCrestOfStructureStandardDeviation = hydraRingLevelOfCrestOfStructureStandardDeviation; structureNormalOrientation = hydraRingStructureNormalOrientation; @@ -170,10 +170,10 @@ yield return new HydraRingVariable(58, HydraRingDistributionType.Deterministic, gravitationalAcceleration, HydraRingDeviationType.Variation, double.NaN, double.NaN, double.NaN); - // Model factor overtopping + // Model factor overtopping flow yield return new HydraRingVariable(59, HydraRingDistributionType.LogNormal, double.NaN, - HydraRingDeviationType.Standard, modelFactorOvertoppingMean, - modelFactorOvertoppingStandardDeviation, double.NaN); + HydraRingDeviationType.Standard, modelFactorOvertoppingFlowMean, + modelFactorOvertoppingFlowStandardDeviation, double.NaN); // Level of crest of structure yield return new HydraRingVariable(60, HydraRingDistributionType.Normal, double.NaN,