Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs =================================================================== diff -u -r2ff2a985fe9015df6da49fe43006e5c7631434c3 -rb8efcaa5b85f05c70660fa2f291d093500c90d2b --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2ff2a985fe9015df6da49fe43006e5c7631434c3) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -649,6 +649,15 @@ } /// + /// Looks up a localized string similar to Normaal (afgekapt). + /// + public static string DistributionType_TruncatedNormal { + get { + return ResourceManager.GetString("DistributionType_TruncatedNormal", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap EditDocumentIcon { @@ -2226,6 +2235,60 @@ } /// + /// Looks up a localized string similar to De ondergrens van de afgekapte normale verdeling.. + /// + public static string TruncatedNormalDistribution_LowerBoundary_Description { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_LowerBoundary_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Ondergrens. + /// + public static string TruncatedNormalDistribution_LowerBoundary_DisplayName { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_LowerBoundary_DisplayName", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De gemiddelde waarde van de afgekapte normale verdeling.. + /// + public static string TruncatedNormalDistribution_Mean_Description { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_Mean_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De standaardafwijking van de afgekapte normale verdeling.. + /// + public static string TruncatedNormalDistribution_StandardDeviation_Description { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_StandardDeviation_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to De bovengrens van de afgekapte normale verdeling.. + /// + public static string TruncatedNormalDistribution_UpperBoundary_Description { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_UpperBoundary_Description", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Bovengrens. + /// + public static string TruncatedNormalDistribution_UpperBoundary_DisplayName { + get { + return ResourceManager.GetString("TruncatedNormalDistribution_UpperBoundary_DisplayName", resourceCulture); + } + } + + /// /// Looks up a localized string similar to &Valideren. /// public static string Validate { Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx =================================================================== diff -u -r2ff2a985fe9015df6da49fe43006e5c7631434c3 -rb8efcaa5b85f05c70660fa2f291d093500c90d2b --- Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision 2ff2a985fe9015df6da49fe43006e5c7631434c3) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Properties/Resources.resx (.../Resources.resx) (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -850,4 +850,25 @@ Lengte + + Normaal (afgekapt) + + + De ondergrens van de afgekapte normale verdeling. + + + Ondergrens + + + De gemiddelde waarde van de afgekapte normale verdeling. + + + De standaardafwijking van de afgekapte normale verdeling. + + + De bovengrens van de afgekapte normale verdeling. + + + Bovengrens + \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TruncatedNormalDistributionProperties.cs =================================================================== diff -u --- Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TruncatedNormalDistributionProperties.cs (revision 0) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/PropertyClasses/TruncatedNormalDistributionProperties.cs (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -0,0 +1,108 @@ +// 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 Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +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. + /// + public class TruncatedNormalDistributionProperties : DistributionPropertiesBase + { + /// + /// Creates a new read-only instance of . + /// + public TruncatedNormalDistributionProperties() : this(DistributionPropertiesReadOnly.All, null) {} + + /// + /// Creates a new instance of . + /// + /// Indicates which properties, if any, should be + /// marked as read-only. + /// The object to be notified of changes to properties. + /// Can be null if all properties are marked as read-only by . + /// Thrown when + /// is null and any number of properties in this class is editable. + public TruncatedNormalDistributionProperties(DistributionPropertiesReadOnly propertiesReadOnly, IObservable observable) : + base(propertiesReadOnly, observable) {} + + public override string DistributionType + { + get + { + return Resources.DistributionType_TruncatedNormal; + } + } + + [ResourcesDescription(typeof(Resources), "TruncatedNormalDistribution_Mean_Description")] + public override RoundedDouble Mean + { + get + { + return base.Mean; + } + set + { + base.Mean = value; + } + } + + [ResourcesDescription(typeof(Resources), "TruncatedNormalDistribution_StandardDeviation_Description")] + public override RoundedDouble StandardDeviation + { + get + { + return base.StandardDeviation; + } + } + + [PropertyOrder(4)] + [ResourcesDisplayName(typeof(Resources), "TruncatedNormalDistribution_LowerBoundary_DisplayName")] + [ResourcesDescription(typeof(Resources), "TruncatedNormalDistribution_LowerBoundary_Description")] + public RoundedDouble LowerBoundary + { + get + { + return data.LowerBoundary; + } + } + + [PropertyOrder(4)] + [ResourcesDisplayName(typeof(Resources), "TruncatedNormalDistribution_UpperBoundary_DisplayName")] + [ResourcesDescription(typeof(Resources), "TruncatedNormalDistribution_UpperBoundary_Description")] + public RoundedDouble UpperBoundary + { + get + { + return data.UpperBoundary; + } + } + } +} \ No newline at end of file Index: Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj =================================================================== diff -u -r31d83651ac426afc55ed5796843a2cd5f1770480 -rb8efcaa5b85f05c70660fa2f291d093500c90d2b --- Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision 31d83651ac426afc55ed5796843a2cd5f1770480) +++ Ringtoets/Common/src/Ringtoets.Common.Forms/Ringtoets.Common.Forms.csproj (.../Ringtoets.Common.Forms.csproj) (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -78,6 +78,7 @@ + Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/NormalDistributionPropertiesTest.cs =================================================================== diff -u -r5c5df51bc14a7e25692abf1db5a7476e5036b13f -rb8efcaa5b85f05c70660fa2f291d093500c90d2b --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/NormalDistributionPropertiesTest.cs (.../NormalDistributionPropertiesTest.cs) (revision 5c5df51bc14a7e25692abf1db5a7476e5036b13f) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/NormalDistributionPropertiesTest.cs (.../NormalDistributionPropertiesTest.cs) (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -33,14 +33,6 @@ [TestFixture] public class NormalDistributionPropertiesTest { - private MockRepository mockRepository; - - [SetUp] - public void SetUp() - { - mockRepository = new MockRepository(); - } - [Test] public void Constructor_WithoutParameters_ExpectedValues() { @@ -71,6 +63,7 @@ public void Constructor_WithParameters_ExpectedValues() { // Setup + var mockRepository = new MockRepository(); var observerableMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); @@ -88,6 +81,7 @@ public void Constructor_Always_PropertiesHaveExpectedAttributesValues() { // Setup + var mockRepository = new MockRepository(); var observerableMock = mockRepository.StrictMock(); mockRepository.ReplayAll(); Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TruncatedNormalDistributionPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TruncatedNormalDistributionPropertiesTest.cs (revision 0) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/PropertyClasses/TruncatedNormalDistributionPropertiesTest.cs (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -0,0 +1,130 @@ +// 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.TestUtil; +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 TruncatedNormalDistributionPropertiesTest + { + [Test] + public void Constructor_WithoutParameters_ExpectedValues() + { + // Call + var properties = new TruncatedNormalDistributionProperties(); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Normaal (afgekapt)", properties.DistributionType); + } + + [Test] + [TestCase(DistributionPropertiesReadOnly.Mean)] + [TestCase(DistributionPropertiesReadOnly.StandardDeviation)] + [TestCase(DistributionPropertiesReadOnly.None)] + public void Constructor_NoObservableSetWhileChangesPossible_ThrowArgumentException( + DistributionPropertiesReadOnly flags) + { + // Call + TestDelegate call = () => new TruncatedNormalDistributionProperties(flags, null); + + // Assert + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, "Observable must be specified unless no property can be set."); + } + + [Test] + public void Constructor_WithParameters_ExpectedValues() + { + // Setup + var mockRepository = new MockRepository(); + var observerableMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new TruncatedNormalDistributionProperties(DistributionPropertiesReadOnly.None, observerableMock); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.IsNull(properties.Data); + Assert.AreEqual("Normaal (afgekapt)", properties.DistributionType); + mockRepository.VerifyAll(); + } + + [Test] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues() + { + // Setup + var mockRepository = new MockRepository(); + var observerableMock = mockRepository.StrictMock(); + mockRepository.ReplayAll(); + + // Call + var properties = new TruncatedNormalDistributionProperties(DistributionPropertiesReadOnly.None, observerableMock); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(5, dynamicProperties.Count); + + PropertyDescriptor distributionTypeProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(distributionTypeProperty, + "Misc", + "Type verdeling", + "Het soort kansverdeling waarin deze parameter gedefinieerd wordt.", + true); + + PropertyDescriptor meanProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(meanProperty, + "Misc", + "Verwachtingswaarde", + "De gemiddelde waarde van de afgekapte normale verdeling."); + + PropertyDescriptor standardProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(standardProperty, + "Misc", + "Standaardafwijking", + "De standaardafwijking van de afgekapte normale verdeling."); + + PropertyDescriptor lowerBoundaryProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(lowerBoundaryProperty, + "Misc", + "Ondergrens", + "De ondergrens van de afgekapte normale verdeling.", + true); + + PropertyDescriptor upperBoundaryProperty = dynamicProperties[4]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(upperBoundaryProperty, + "Misc", + "Bovengrens", + "De bovengrens van de afgekapte normale verdeling.", + true); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj =================================================================== diff -u -r31d83651ac426afc55ed5796843a2cd5f1770480 -rb8efcaa5b85f05c70660fa2f291d093500c90d2b --- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision 31d83651ac426afc55ed5796843a2cd5f1770480) +++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/Ringtoets.Common.Forms.Test.csproj (.../Ringtoets.Common.Forms.Test.csproj) (revision b8efcaa5b85f05c70660fa2f291d093500c90d2b) @@ -82,6 +82,7 @@ +