Index: Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs =================================================================== diff -u -r7446453edff30c3f9c4871da3896dbd7c9f3a44c -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 7446453edff30c3f9c4871da3896dbd7c9f3a44c) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -1,14 +1,17 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.18063 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace Core.Common.Gui.Properties { + using System; + + /// /// A strongly-typed resource class, for looking up localized strings, etc. /// @@ -917,78 +920,87 @@ } /// - /// Looks up a localized string similar to {0} gui plugin(s) were loaded. + /// Looks up a localized string similar to Initializing graphical user interface .... /// - public static string DeltaShellGui_LoadPlugins__0__gui_plugin_s__were_loaded { + public static string DeltaShellGui_Run_Initializing_graphical_user_interface____ { get { - return ResourceManager.GetString("DeltaShellGui_LoadPlugins__0__gui_plugin_s__were_loaded", resourceCulture); + return ResourceManager.GetString("DeltaShellGui_Run_Initializing_graphical_user_interface____", resourceCulture); } } /// - /// Looks up a localized string similar to Searching for Gui plugins .... + /// Looks up a localized string similar to Started in {0:f2} sec. /// - public static string DeltaShellGui_LoadPlugins_Searching_for_Gui_plugins____ { + public static string DeltaShellGui_Run_Started_in__0_f2__sec { get { - return ResourceManager.GetString("DeltaShellGui_LoadPlugins_Searching_for_Gui_plugins____", resourceCulture); + return ResourceManager.GetString("DeltaShellGui_Run_Started_in__0_f2__sec", resourceCulture); } } /// - /// Looks up a localized string similar to Initializing graphical user interface .... + /// Looks up a localized string similar to Starting application .... /// - public static string DeltaShellGui_Run_Initializing_graphical_user_interface____ { + public static string DeltaShellGui_Run_Starting_application____ { get { - return ResourceManager.GetString("DeltaShellGui_Run_Initializing_graphical_user_interface____", resourceCulture); + return ResourceManager.GetString("DeltaShellGui_Run_Starting_application____", resourceCulture); } } /// - /// Looks up a localized string similar to Started in {0:f2} sec. + /// Looks up a localized string similar to Logo file {0} does not exist. /// - public static string DeltaShellGui_Run_Started_in__0_f2__sec { + public static string DeltaShellGui_ShowSplashScreen_Logo_file__0__does_not_exist { get { - return ResourceManager.GetString("DeltaShellGui_Run_Started_in__0_f2__sec", resourceCulture); + return ResourceManager.GetString("DeltaShellGui_ShowSplashScreen_Logo_file__0__does_not_exist", resourceCulture); } } /// - /// Looks up a localized string similar to Starting application .... + /// Looks up a localized string similar to User has cancelled start, exiting .... /// - public static string DeltaShellGui_Run_Starting_application____ { + public static string DeltaShellGui_ShowSplashScreen_User_has_cancelled_start__exiting____ { get { - return ResourceManager.GetString("DeltaShellGui_Run_Starting_application____", resourceCulture); + return ResourceManager.GetString("DeltaShellGui_ShowSplashScreen_User_has_cancelled_start__exiting____", resourceCulture); } } /// - /// Looks up a localized string similar to Waiting until new project is initialized .... + /// Looks up a localized string similar to De representatieve waarde die gebruikt wordt door de berekening.. /// - public static string DeltaShellGui_Run_Waiting_until_new_project_is_initialized____ { + public static string DesignVariableTypeConverter_DesignValue_Description { get { - return ResourceManager.GetString("DeltaShellGui_Run_Waiting_until_new_project_is_initialized____", resourceCulture); + return ResourceManager.GetString("DesignVariableTypeConverter_DesignValue_Description", resourceCulture); } } /// - /// Looks up a localized string similar to Logo file {0} does not exist. + /// Looks up a localized string similar to Rekenwaarde. /// - public static string DeltaShellGui_ShowSplashScreen_Logo_file__0__does_not_exist { + public static string DesignVariableTypeConverter_DesignValue_DisplayName { get { - return ResourceManager.GetString("DeltaShellGui_ShowSplashScreen_Logo_file__0__does_not_exist", resourceCulture); + return ResourceManager.GetString("DesignVariableTypeConverter_DesignValue_DisplayName", resourceCulture); } } /// - /// Looks up a localized string similar to User has cancelled start, exiting .... + /// Looks up a localized string similar to Type verdeling. /// - public static string DeltaShellGui_ShowSplashScreen_User_has_cancelled_start__exiting____ { + public static string DesignVariableTypeConverter_DestributionType_DisplayName { get { - return ResourceManager.GetString("DeltaShellGui_ShowSplashScreen_User_has_cancelled_start__exiting____", resourceCulture); + return ResourceManager.GetString("DesignVariableTypeConverter_DestributionType_DisplayName", resourceCulture); } } /// + /// Looks up a localized string similar to De soort kansverdeling waarin deze parameter in gedefiniëerd wordt.. + /// + public static string DesignVariableTypeConverter_DistributionType_Description { + get { + return ResourceManager.GetString("DesignVariableTypeConverter_DistributionType_Description", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap DocumentHS { @@ -997,17 +1009,6 @@ return ((System.Drawing.Bitmap)(obj)); } } - - /// - /// Looks up a localized string similar to Aantal ({0}). - /// - internal static string ExpandableArrayConverter_ConvertTo_Aantal_0_ - { - get - { - return ResourceManager.GetString("ExpandableArrayConverter_ConvertTo_Aantal_0_", resourceCulture); - } - } /// /// Looks up a localized resource of type System.Drawing.Bitmap. @@ -1070,6 +1071,15 @@ } /// + /// Looks up a localized string similar to Aantal ({0}). + /// + public static string ExpandableArrayConverter_ConvertTo_Aantal_0_ { + get { + return ResourceManager.GetString("ExpandableArrayConverter_ConvertTo_Aantal_0_", resourceCulture); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap feed { @@ -2336,16 +2346,6 @@ /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// - public static System.Drawing.Bitmap PlayHS12_32 { - get { - object obj = ResourceManager.GetObject("PlayHS12_32", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Looks up a localized resource of type System.Drawing.Bitmap. - /// public static System.Drawing.Bitmap plugin { get { object obj = ResourceManager.GetObject("plugin", resourceCulture); @@ -3114,6 +3114,16 @@ } /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + public static System.Drawing.Icon Ringtoets { + get { + object obj = ResourceManager.GetObject("Ringtoets", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// public static System.Drawing.Bitmap SaveAllHS { Index: Core/Common/src/Core.Common.Gui/Properties/Resources.resx =================================================================== diff -u -reee6c7815d1e418eac38c1c552fb279c0887ef55 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision eee6c7815d1e418eac38c1c552fb279c0887ef55) +++ Core/Common/src/Core.Common.Gui/Properties/Resources.resx (.../Resources.resx) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -1217,4 +1217,16 @@ Aantal ({0}) + + Type verdeling + + + De soort kansverdeling waarin deze parameter in gedefiniëerd wordt. + + + Rekenwaarde + + + De representatieve waarde die gebruikt wordt door de berekening. + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs =================================================================== diff -u -r5076e379f409c3b5ba41eb98256e3dd5d140571c -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs (.../PipingSemiProbabilisticDesignValueFactory.cs) (revision 5076e379f409c3b5ba41eb98256e3dd5d140571c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Calculation/Piping/PipingSemiProbabilisticDesignValueFactory.cs (.../PipingSemiProbabilisticDesignValueFactory.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -15,9 +15,8 @@ /// public static DesignVariable GetThicknessCoverageLayer(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.ThicknessCoverageLayer) { - Distribution = pipingData.ThicknessCoverageLayer, Percentile = 0.05 }; } @@ -27,9 +26,8 @@ /// public static DesignVariable GetPhreaticLevelExit(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.PhreaticLevelExit) { - Distribution = pipingData.PhreaticLevelExit, Percentile = 0.05 }; } @@ -39,9 +37,8 @@ /// public static DesignVariable GetDampingFactorExit(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.DampingFactorExit) { - Distribution = pipingData.DampingFactorExit, Percentile = 0.95 }; } @@ -55,9 +52,8 @@ /// public static DesignVariable GetSeepageLength(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.SeepageLength) { - Distribution = pipingData.SeepageLength, Percentile = 0.05 }; } @@ -67,9 +63,8 @@ /// public static DesignVariable GetDiameter70(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.Diameter70) { - Distribution = pipingData.Diameter70, Percentile = 0.05 }; } @@ -79,9 +74,8 @@ /// public static DesignVariable GetDarcyPermeability(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.DarcyPermeability) { - Distribution = pipingData.DarcyPermeability, Percentile = 0.95 }; } @@ -91,9 +85,8 @@ /// public static DesignVariable GetThicknessAquiferLayer(PipingData pipingData) { - return new DesignVariable + return new DesignVariable(pipingData.ThicknessAquiferLayer) { - Distribution = pipingData.ThicknessAquiferLayer, Percentile = 0.95 }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs =================================================================== diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs (.../DesignVariable.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/DesignVariable.cs (.../DesignVariable.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -11,20 +11,38 @@ public class DesignVariable { private double percentile; + private IDistribution distribution; /// /// Initializes a new instance of the class with /// equal to 0.5. /// - public DesignVariable() + /// is null. + public DesignVariable(IDistribution distribution) { + Distribution = distribution; percentile = 0.5; } /// /// Gets or sets the probabilistic distribution of the parameter being modeled. /// - public IDistribution Distribution { get; set; } + /// is null. + public IDistribution Distribution + { + get + { + return distribution; + } + set + { + if (value == null) + { + throw new ArgumentNullException("value", Resources.DesignVariable_GetDesignValue_Distribution_must_be_set); + } + distribution = value; + } + } /// /// Gets or sets the percentile used to derive a deterministic value based on . @@ -49,13 +67,8 @@ /// Gets the design value based on the and . /// /// A design value. - /// is null. public double GetDesignValue() { - if (Distribution == null) - { - throw new InvalidOperationException(Resources.DesignVariable_GetDesignValue_Distribution_must_be_set); - } return Distribution.InverseCDF(Percentile); } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs =================================================================== diff -u -rab8195118fb8a60050a3949f6591ce20b15105c6 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs (.../LognormalDistribution.cs) (revision ab8195118fb8a60050a3949f6591ce20b15105c6) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/LognormalDistribution.cs (.../LognormalDistribution.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -51,7 +51,7 @@ { if (p < 0.0 || p > 1) { - throw new ArgumentOutOfRangeException("p", "Kans moet in het bereik van [0, 1] opgegeven worden."); + throw new ArgumentOutOfRangeException("p", Resources.IDistribution_InverseCDF_Probability_must_be_in_range); } return LogNormal.InvCDF(Mean, StandardDeviation, p); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs =================================================================== diff -u -rab8195118fb8a60050a3949f6591ce20b15105c6 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision ab8195118fb8a60050a3949f6591ce20b15105c6) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Probabilistics/NormalDistribution.cs (.../NormalDistribution.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -51,7 +51,7 @@ { if (p < 0.0 || p > 1) { - throw new ArgumentOutOfRangeException("p", "Kans moet in het bereik van [0, 1] opgegeven worden."); + throw new ArgumentOutOfRangeException("p", Resources.IDistribution_InverseCDF_Probability_must_be_in_range); } return Normal.InvCDF(Mean, StandardDeviation, p); } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs =================================================================== diff -u -rcfba2b11da9ac0bb1daf377b8dcb15f7c84e0cfb -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cfba2b11da9ac0bb1daf377b8dcb15f7c84e0cfb) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.34209 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -88,6 +88,15 @@ } /// + /// Looks up a localized string similar to Kans moet in het bereik van [0, 1] opgegeven worden.. + /// + internal static string IDistribution_InverseCDF_Probability_must_be_in_range { + get { + return ResourceManager.GetString("IDistribution_InverseCDF_Probability_must_be_in_range", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Voor het maken van een segment zijn twee punten nodig.. /// internal static string Segment2D_Constructor_Segment_must_be_created_with_two_points { Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx =================================================================== diff -u -rcfba2b11da9ac0bb1daf377b8dcb15f7c84e0cfb -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision cfba2b11da9ac0bb1daf377b8dcb15f7c84e0cfb) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Properties/Resources.resx (.../Resources.resx) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -132,4 +132,7 @@ Voor het maken van een segment zijn twee punten nodig. + + Kans moet in het bereik van [0, 1] opgegeven worden. + \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs =================================================================== diff -u -r5076e379f409c3b5ba41eb98256e3dd5d140571c -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs (.../DesignVariableTypeConverter.cs) (revision 5076e379f409c3b5ba41eb98256e3dd5d140571c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/DesignVariableTypeConverter.cs (.../DesignVariableTypeConverter.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -4,6 +4,7 @@ using System.Linq; using System.Linq.Expressions; using Core.Common.Base; +using Core.Common.Gui.Properties; using Core.Common.Utils.PropertyBag.Dynamic; using Ringtoets.Piping.Data.Probabilistics; @@ -43,12 +44,18 @@ var designVariable = (DesignVariable)value; PropertyDescriptorCollection propertyDescriptorCollection = TypeDescriptor.GetProperties(designVariable.Distribution); var properties = new PropertyDescriptor[Parameters.Length+2]; - properties[0] = new SimpleReadonlyPropertyDescriptorItem("Type verdeling", "De soort kansverdeling waarin deze parameter in gedefiniëerd wordt.", "DistributionType", DistributionName); + properties[0] = new SimpleReadonlyPropertyDescriptorItem(Resources.DesignVariableTypeConverter_DestributionType_DisplayName, + Resources.DesignVariableTypeConverter_DistributionType_Description, + "DistributionType", + DistributionName); for (int i = 0; i < Parameters.Length; i++) { properties[i+1] = CreatePropertyDescriptor(propertyDescriptorCollection, Parameters[i], observableParent); } - properties[Parameters.Length + 1] = new SimpleReadonlyPropertyDescriptorItem("Rekenwaarde", "De representatieve waarde die gebruikt wordt door de berekening.", "DesignValue", designVariable.GetDesignValue()); + properties[Parameters.Length + 1] = new SimpleReadonlyPropertyDescriptorItem(Resources.DesignVariableTypeConverter_DesignValue_DisplayName, + Resources.DesignVariableTypeConverter_DesignValue_Description, + "DesignValue", + designVariable.GetDesignValue()); return new PropertyDescriptorCollection(properties); } @@ -71,7 +78,7 @@ parameter.Symbol, parameter.Description) { - ObservableParent = observableParent, + ObservableParent = observableParent }; } Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/PropertyDescriptors/SimpleReadonlyPropertyDescriptor.cs =================================================================== diff -u -r5076e379f409c3b5ba41eb98256e3dd5d140571c -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/PropertyDescriptors/SimpleReadonlyPropertyDescriptor.cs (.../SimpleReadonlyPropertyDescriptor.cs) (revision 5076e379f409c3b5ba41eb98256e3dd5d140571c) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/TypeConverters/PropertyDescriptors/SimpleReadonlyPropertyDescriptor.cs (.../SimpleReadonlyPropertyDescriptor.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -4,9 +4,9 @@ namespace Ringtoets.Piping.Forms.TypeConverters.PropertyDescriptors { /// - /// This class defines a simple readonly property item that actually isn't an actual - /// property of an object, but a standalone piece of data. Because the piece of data - /// does not belong to some component, the data is readonly and cannot be set or changed. + /// This class defines a simple readonly property item that isn't an actual property + /// of an object, but a standalone piece of data. Because the piece of data does not + /// belong to some component, the data is readonly and cannot be set or changed. /// public class SimpleReadonlyPropertyDescriptorItem : PropertyDescriptor { Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs =================================================================== diff -u -r5d53c93d9e66f38ca73d333f85855ec815f962c5 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs (.../DesignVariableTest.cs) (revision 5d53c93d9e66f38ca73d333f85855ec815f962c5) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Probabilistics/DesignVariableTest.cs (.../DesignVariableTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -12,33 +12,56 @@ public class DesignVariableTest { [Test] - public void DefaultConstructor_ExpectedValues() + public void ParameteredConstructor_ExpectedValues() { + // Setup + var mocks = new MockRepository(); + var distributionMock = mocks.StrictMock(); + mocks.ReplayAll(); + // Call - var designVariable = new DesignVariable(); + var designVariable = new DesignVariable(distributionMock); // Assert - Assert.IsNull(designVariable.Distribution); + Assert.AreSame(distributionMock, designVariable.Distribution); Assert.AreEqual(0.5, designVariable.Percentile); + mocks.VerifyAll(); // Expect no cals on mocks } [Test] + public void ParameteredConstructor_DistributionIsNull_ThrowArgumentNullException() + { + // Call + TestDelegate call = () => new DesignVariable(null); + + // Assert + var exception = Assert.Throws(call); + string customMessagePart = exception.Message.Split(new[] { Environment.NewLine }, StringSplitOptions.None)[0]; + Assert.AreEqual("Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen.", customMessagePart); + } + + [Test] [TestCase(-1234.5678)] [TestCase(0 - 1e-6)] [TestCase(1 + 1e-6)] [TestCase(12345.789)] public void Percentile_SettingInvalidValue_ThrowArgumentOutOfRangeException(double invalidPercentile) { // Setup - var designVariable = new DesignVariable(); + var mocks = new MockRepository(); + var distributionMock = mocks.StrictMock(); + mocks.ReplayAll(); + var designVariable = new DesignVariable(distributionMock); + // Call TestDelegate call = () => designVariable.Percentile = invalidPercentile; // Assert var exception = Assert.Throws(call); string customMessagePart = exception.Message.Split(new []{ Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)[0]; Assert.AreEqual("Percentiel moet in het bereik van [0, 1] vallen.", customMessagePart); + mocks.VerifyAll(); // Expect no cals on mocks } [Test] @@ -48,30 +71,37 @@ public void Percentile_SettingValidValue_PropertySet(double validPercentile) { // Setup - var designVariable = new DesignVariable(); + var mocks = new MockRepository(); + var distributionMock = mocks.StrictMock(); + mocks.ReplayAll(); + var designVariable = new DesignVariable(distributionMock); + // Call designVariable.Percentile = validPercentile; // Assert Assert.AreEqual(validPercentile, designVariable.Percentile); + mocks.VerifyAll(); // Expect no cals on mocks } [Test] - public void GetDesignValue_DistributionNotSet_ThrowInvalidOperationException() + public void Distribution_SetToNull_ThrowArgumentNullException() { // Setup - var designVariable = new DesignVariable - { - Distribution = null - }; + var mocks = new MockRepository(); + var distributionMock = mocks.StrictMock(); + mocks.ReplayAll(); + var designVariable = new DesignVariable(distributionMock); + // Call - TestDelegate call = () => designVariable.GetDesignValue(); + TestDelegate call = () => designVariable.Distribution = null; // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen.", exception.Message); + var exception = Assert.Throws(call); + string customMessagePart = exception.Message.Split(new []{Environment.NewLine}, StringSplitOptions.None)[0]; + Assert.AreEqual("Een kansverdeling moet opgegeven zijn om op basis van die data een rekenwaarde te bepalen.", customMessagePart); } [Test] @@ -86,9 +116,8 @@ distribution.Expect(d => d.InverseCDF(percentile)).Return(expectedValue); mocks.ReplayAll(); - var designVariable = new DesignVariable + var designVariable = new DesignVariable(distribution) { - Distribution = distribution, Percentile = percentile }; Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs =================================================================== diff -u -r15d2770669092ea9574682421c755fc9b6c2e16f -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision 15d2770669092ea9574682421c755fc9b6c2e16f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingCalculationInputsPropertiesTest.cs (.../PipingCalculationInputsPropertiesTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -161,41 +161,20 @@ WaterVolumetricWeight = waterVolumetricWeight, UpliftModelFactor = upliftModelFactor, PiezometricHeadExit = piezometricHeadExit, - DampingFactorExit = new DesignVariable - { - Distribution = dampingFactorExit - }, - PhreaticLevelExit = new DesignVariable - { - Distribution = phreaticLevelExit - }, + DampingFactorExit = new DesignVariable(dampingFactorExit), + PhreaticLevelExit = new DesignVariable(phreaticLevelExit), PiezometricHeadPolder = piezometricHeadPolder, - ThicknessCoverageLayer = new DesignVariable - { - Distribution = thicknessCoverageLayer - }, + ThicknessCoverageLayer = new DesignVariable(thicknessCoverageLayer), SellmeijerModelFactor = sellmeijerModelFactor, SellmeijerReductionFactor = sellmeijerReductionFactor, - SeepageLength = new DesignVariable - { - Distribution = seepageLength - }, + SeepageLength = new DesignVariable(seepageLength), SandParticlesVolumicWeight = sandParticlesVolumicWeight, WhitesDragCoefficient = whitesDragCoefficient, - Diameter70 = new DesignVariable - { - Distribution = diameter70 - }, - DarcyPermeability = new DesignVariable - { - Distribution = darcyPermeability - }, + Diameter70 = new DesignVariable(diameter70), + DarcyPermeability = new DesignVariable(darcyPermeability), WaterKinematicViscosity = waterKinematicViscosity, Gravity = gravity, - ThicknessAquiferLayer = new DesignVariable - { - Distribution = thicknessAquiferLayer - }, + ThicknessAquiferLayer = new DesignVariable(thicknessAquiferLayer), MeanDiameter70 = meanDiameter70, BeddingAngle = beddingAngle, SurfaceLine = surfaceLine, Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs =================================================================== diff -u -r19c7e0f59561a8e4888cd83bde1ca19acd8ea308 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision 19c7e0f59561a8e4888cd83bde1ca19acd8ea308) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/LognormalDistributionDesignVariableTypeConverterTest.cs (.../LognormalDistributionDesignVariableTypeConverterTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -49,7 +49,7 @@ Mean = 1.1, StandardDeviation = 2.2 }; - var designVariable = new DesignVariable { Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new LognormalDistributionDesignVariableTypeConverter(); @@ -80,7 +80,7 @@ { // Setup var distribution = new LognormalDistribution(); - var designVariable = new DesignVariable{ Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new LognormalDistributionDesignVariableTypeConverter(); // Call @@ -157,16 +157,17 @@ Assert.IsNotNull(properties); // Event - properties[propertyIndexToChange].SetValue(dampingFactorExit, 2.3); + const double newValue = 2.3; + properties[propertyIndexToChange].SetValue(dampingFactorExit, newValue); // Result switch (propertyIndexToChange) { case 1: - Assert.AreEqual(2.3, pipingData.DampingFactorExit.Mean); + Assert.AreEqual(newValue, pipingData.DampingFactorExit.Mean); break; case 2: - Assert.AreEqual(2.3, pipingData.DampingFactorExit.StandardDeviation); + Assert.AreEqual(newValue, pipingData.DampingFactorExit.StandardDeviation); break; } mocks.VerifyAll(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs =================================================================== diff -u -r19c7e0f59561a8e4888cd83bde1ca19acd8ea308 -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs (.../NormalDistributionDesignVariableTypeConverterTest.cs) (revision 19c7e0f59561a8e4888cd83bde1ca19acd8ea308) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/NormalDistributionDesignVariableTypeConverterTest.cs (.../NormalDistributionDesignVariableTypeConverterTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -49,7 +49,7 @@ Mean = 1.1, StandardDeviation = 2.2 }; - var designVariable = new DesignVariable{ Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new NormalDistributionDesignVariableTypeConverter(); // Call @@ -79,7 +79,7 @@ { // Setup var distribution = new NormalDistribution(); - var designVariable = new DesignVariable { Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new NormalDistributionDesignVariableTypeConverter(); // Call @@ -156,16 +156,17 @@ Assert.IsNotNull(properties); // Event - properties[propertyIndexToChange].SetValue(designVariable, 2.3); + const double newValue = 2.3; + properties[propertyIndexToChange].SetValue(designVariable, newValue); // Result switch (propertyIndexToChange) { case 1: - Assert.AreEqual(2.3, pipingData.PhreaticLevelExit.Mean); + Assert.AreEqual(newValue, pipingData.PhreaticLevelExit.Mean); break; case 2: - Assert.AreEqual(2.3, pipingData.PhreaticLevelExit.StandardDeviation); + Assert.AreEqual(newValue, pipingData.PhreaticLevelExit.StandardDeviation); break; } mocks.VerifyAll(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs =================================================================== diff -u -r5076e379f409c3b5ba41eb98256e3dd5d140571c -rc921a50a3d1e0e6bfceff4fdff0b27705825af11 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs (.../ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs) (revision 5076e379f409c3b5ba41eb98256e3dd5d140571c) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/TypeConverters/ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs (.../ShiftedLognormalDistributionDesignVariableTypeConverterTest.cs) (revision c921a50a3d1e0e6bfceff4fdff0b27705825af11) @@ -43,7 +43,7 @@ StandardDeviation = 2.2, Shift = 3.3 }; - var designVariable = new DesignVariable { Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new ShiftedLognormalDistributionDesignVariableTypeConverter(); // Call @@ -73,7 +73,7 @@ { // Setup var distribution = new ShiftedLognormalDistribution(); - var designVariable = new DesignVariable { Distribution = distribution }; + var designVariable = new DesignVariable(distribution); var converter = new ShiftedLognormalDistributionDesignVariableTypeConverter(); // Call