Index: Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs (.../ClosingStructuresFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/ClosingStructures/test/Ringtoets.ClosingStructures.Forms.Test/PropertyClasses/ClosingStructuresFailureMechanismPropertiesTest.cs (.../ClosingStructuresFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -293,7 +293,8 @@ TestDelegate test = () => properties.N2A = value; // Assert - Assert.Throws(test); + const string expectedMessage = "De waarde voor 'N2A' moet in het bereik [0, 40] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentInput.cs =================================================================== diff -u -r759a8a5a3c1b7fd724152a96efeca49e83a76e3e -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentInput.cs (.../ProbabilityAssessmentInput.cs) (revision 759a8a5a3c1b7fd724152a96efeca49e83a76e3e) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Probability/ProbabilityAssessmentInput.cs (.../ProbabilityAssessmentInput.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -42,7 +42,7 @@ /// when determining the maximum tolerated probability of failure. /// The default value for the parameter 'b' to be used to factor in the 'length effect' /// when determining the maximum tolerated probability of failure. - /// Thrown when is not in the range [0, 1]. + /// Thrown when is not in the range [0, 1]. protected ProbabilityAssessmentInput(double a, double b) { A = a; @@ -59,7 +59,7 @@ /// Gets or sets 'a' parameter used to factor in the 'length effect' when determining the /// maximum tolerated probability of failure. /// - /// Thrown when value is not in the range [0, 1]. + /// Thrown when value is not in the range [0, 1]. public double A { get @@ -70,8 +70,9 @@ { if (!validityRangeA.InRange(value)) { - throw new ArgumentException(string.Format(Resources.ProbabilityAssessmentInput_A_Value_must_be_in_Range_0_, - validityRangeA.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture))); + throw new ArgumentOutOfRangeException(nameof(value), + string.Format(Resources.ProbabilityAssessmentInput_A_Value_must_be_in_Range_0_, + validityRangeA.ToString(FormattableConstants.ShowAtLeastOneDecimal, CultureInfo.CurrentCulture))); } a = value; Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs =================================================================== diff -u -r4e9d3556e3cee0365fc0f26d0bad19b50594e12d -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4e9d3556e3cee0365fc0f26d0bad19b50594e12d) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -756,7 +756,7 @@ } /// - /// Looks up a localized string similar to De waarde moet in het bereik {0} liggen.. + /// Looks up a localized string similar to De waarde voor 'a' moet in het bereik {0} liggen.. /// public static string ProbabilityAssessmentInput_A_Value_must_be_in_Range_0_ { get { Index: Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx =================================================================== diff -u -r4e9d3556e3cee0365fc0f26d0bad19b50594e12d -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 4e9d3556e3cee0365fc0f26d0bad19b50594e12d) +++ Ringtoets/Common/src/Ringtoets.Common.Data/Properties/Resources.resx (.../Resources.resx) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -409,6 +409,6 @@ De bestandsmap waar de preprocessor bestanden opslaat moet een waarde hebben. - De waarde moet in het bereik {0} liggen. + De waarde voor 'a' moet in het bereik {0} liggen. \ No newline at end of file Index: Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentInputTest.cs =================================================================== diff -u -r759a8a5a3c1b7fd724152a96efeca49e83a76e3e -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentInputTest.cs (.../ProbabilityAssessmentInputTest.cs) (revision 759a8a5a3c1b7fd724152a96efeca49e83a76e3e) +++ Ringtoets/Common/test/Ringtoets.Common.Data.Test/Probability/ProbabilityAssessmentInputTest.cs (.../ProbabilityAssessmentInputTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -20,6 +20,7 @@ // All rights reserved. using System; +using Core.Common.TestUtil; using NUnit.Framework; using Ringtoets.Common.Data.Probability; @@ -35,7 +36,7 @@ [TestCase(1.1)] [TestCase(8)] [TestCase(double.NaN)] - public void Constructor_InvalidA_ThrowsArgumentException(double a) + public void Constructor_InvalidA_ThrowsArgumentOutOfRangeException(double a) { // Setup var random = new Random(39); @@ -45,8 +46,8 @@ random.NextDouble()); // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("De waarde moet in het bereik [0,0, 1,0] liggen.", exception.Message); + const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } [Test] @@ -71,7 +72,7 @@ [TestCase(1.1)] [TestCase(8)] [TestCase(double.NaN)] - public void A_InvalidValue_ThrowsArgumentException(double a) + public void A_InvalidValue_ThrowsArgumentOutOfRangeException(double a) { // Setup var random = new Random(39); @@ -82,8 +83,8 @@ TestDelegate call = () => probabilityAssessmentInput.A = a; // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("De waarde moet in het bereik [0,0, 1,0] liggen.", exception.Message); + const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); } [Test] Index: Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs (.../DuneErosionFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/DuneErosion/test/Ringtoets.DuneErosion.Forms.Test/PropertyClasses/DuneErosionFailureMechanismPropertiesTest.cs (.../DuneErosionFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -227,6 +227,7 @@ } [Test] + [SetCulture("nl-NL")] [TestCase(0.0)] [TestCase(-1.0)] [TestCase(-20.0)] @@ -252,7 +253,8 @@ TestDelegate test = () => properties.N = (RoundedDouble) newN; // Assert - Assert.Throws(test); + const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/GrassCoverErosionInwards/test/Ringtoets.GrassCoverErosionInwards.Forms.Test/PropertyClasses/GrassCoverErosionInwardsFailureMechanismPropertiesTest.cs (.../GrassCoverErosionInwardsFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -256,6 +256,7 @@ } [Test] + [SetCulture("nl-NL")] [TestCase(0.0)] [TestCase(-1.0)] [TestCase(-20.0)] @@ -282,7 +283,8 @@ TestDelegate test = () => properties.N = (RoundedDouble) newN; // Assert - Assert.Throws(test); + const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/HeightStructures/test/Ringtoets.HeightStructures.Forms.Test/PropertyClasses/HeightStructuresFailureMechanismPropertiesTest.cs (.../HeightStructuresFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -238,6 +238,7 @@ } [Test] + [SetCulture("nl-NL")] [TestCase(0.0)] [TestCase(-1.0)] [TestCase(-20.0)] @@ -264,7 +265,8 @@ TestDelegate test = () => properties.N = (RoundedDouble) value; // Assert - Assert.Throws(test); + const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); } Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/StandAlone/PipingStructureFailureMechanismContext.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/StandAlone/PipingStructureFailureMechanismContext.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PresentationObjects/StandAlone/PipingStructureFailureMechanismContext.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,43 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Data.StandAlone; + +namespace Ringtoets.Integration.Forms.PresentationObjects.StandAlone +{ + /// + /// This class is a presentation object for an instance of . + /// + public class PipingStructureFailureMechanismContext : FailureMechanismContext + { + /// + /// Initializes a new instance of the class. + /// + /// The failure mechanism. + /// The parent of . + /// Thrown when any input argument is null. + public PipingStructureFailureMechanismContext(PipingStructureFailureMechanism failureMechanism, IAssessmentSection assessmentSection) : + base(failureMechanism, assessmentSection) {} + } +} \ No newline at end of file Fisheye: Tag 65ce8c5ab171b234e33e2291998c9d89276db896 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/MacroStabilityOutwardsFailureMechanismProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismProperties.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,175 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.Probability; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.Input; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.PropertyClasses.StandAlone +{ + /// + /// ViewModel of properties panel. + /// + public class MacroStabilityOutwardsFailureMechanismProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The instance to show the properties of. + /// Thrown when input parameter is null. + public MacroStabilityOutwardsFailureMechanismProperties(MacroStabilityOutwardsFailureMechanism data) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + Data = data; + } + + [DynamicVisibleValidationMethod] + public bool DynamicVisibleValidationMethod(string propertyName) + { + if (!data.IsRelevant && ShouldHidePropertyWhenFailureMechanismIrrelevant(propertyName)) + { + return false; + } + + return true; + } + + private bool ShouldHidePropertyWhenFailureMechanismIrrelevant(string propertyName) + { + return nameof(A).Equals(propertyName) + || nameof(B).Equals(propertyName) + || nameof(SectionLength).Equals(propertyName) + || nameof(N).Equals(propertyName); + } + + #region General + + [PropertyOrder(1)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_Description))] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(2)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_Description))] + public string Code + { + get + { + return data.Code; + } + } + + [PropertyOrder(3)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_Description))] + public bool IsRelevant + { + get + { + return data.IsRelevant; + } + } + + #endregion + + #region Semi-probabilistic parameters + + [DynamicVisible] + [PropertyOrder(4)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_A_Description))] + public double A + { + get + { + return data.MacroStabilityOutwardsProbabilityAssessmentInput.A; + } + set + { + data.MacroStabilityOutwardsProbabilityAssessmentInput.A = value; + data.NotifyObservers(); + } + } + + [DynamicVisible] + [PropertyOrder(5)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_B_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_ProbabilityAssessmentInput_B_Description))] + public double B + { + get + { + return data.MacroStabilityOutwardsProbabilityAssessmentInput.B; + } + } + + [DynamicVisible] + [PropertyOrder(6)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ReferenceLine_Length_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.ReferenceLine_Length_Description))] + public RoundedDouble SectionLength + { + get + { + return new RoundedDouble(2, data.MacroStabilityOutwardsProbabilityAssessmentInput.SectionLength); + } + } + + [DynamicVisible] + [PropertyOrder(7)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Rounded_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Rounded_Description))] + public RoundedDouble N + { + get + { + MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = data.MacroStabilityOutwardsProbabilityAssessmentInput; + return new RoundedDouble(2, probabilityAssessmentInput.GetSectionSpecificN(probabilityAssessmentInput.SectionLength)); + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/PipingStructureFailureMechanismProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/PipingStructureFailureMechanismProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/PipingStructureFailureMechanismProperties.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,130 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Base.Data; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Util.Attributes; +using Ringtoets.Integration.Data.StandAlone; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.PropertyClasses.StandAlone +{ + /// + /// ViewModel of properties panel. + /// + public class PipingStructureFailureMechanismProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The instance to show the properties of. + /// Thrown when input parameter is null. + public PipingStructureFailureMechanismProperties(PipingStructureFailureMechanism data) + { + if (data == null) + { + throw new ArgumentNullException(nameof(data)); + } + + Data = data; + } + + #region Semi-probabilistic parameters + + [DynamicVisible] + [PropertyOrder(4)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_LengthEffect))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_N_Description))] + public RoundedDouble N + { + get + { + return data.N; + } + set + { + data.N = value; + data.NotifyObservers(); + } + } + + #endregion + + [DynamicVisibleValidationMethod] + public bool DynamicVisibleValidationMethod(string propertyName) + { + if (!data.IsRelevant && ShouldHidePropertyWhenFailureMechanismIrrelevant(propertyName)) + { + return false; + } + + return true; + } + + private bool ShouldHidePropertyWhenFailureMechanismIrrelevant(string propertyName) + { + return nameof(N).Equals(propertyName); + } + + #region General + + [PropertyOrder(1)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_Description))] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(2)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_Description))] + public string Code + { + get + { + return data.Code; + } + } + + [PropertyOrder(3)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_Description))] + public bool IsRelevant + { + get + { + return data.IsRelevant; + } + } + + #endregion + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/StandAloneFailureMechanismProperties.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/StandAloneFailureMechanismProperties.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAlone/StandAloneFailureMechanismProperties.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,91 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using Core.Common.Gui.Attributes; +using Core.Common.Gui.PropertyBag; +using Core.Common.Util.Attributes; +using Ringtoets.Common.Data.FailureMechanism; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Forms.PropertyClasses.StandAlone +{ + /// + /// ViewModel of properties panel. + /// + public class StandAloneFailureMechanismProperties : ObjectProperties + { + /// + /// Creates a new instance of . + /// + /// The failure mechanism to show the properties for. + /// Thrown when is null. + public StandAloneFailureMechanismProperties(IFailureMechanism failureMechanism) + { + if (failureMechanism == null) + { + throw new ArgumentNullException(nameof(failureMechanism)); + } + + Data = failureMechanism; + } + + #region General + + [PropertyOrder(1)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Name_Description))] + public string Name + { + get + { + return data.Name; + } + } + + [PropertyOrder(2)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_Code_Description))] + public string Code + { + get + { + return data.Code; + } + } + + [PropertyOrder(3)] + [ResourcesCategory(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.Categories_General))] + [ResourcesDisplayName(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_DisplayName))] + [ResourcesDescription(typeof(RingtoetsCommonFormsResources), nameof(RingtoetsCommonFormsResources.FailureMechanism_IsRelevant_Description))] + public bool IsRelevant + { + get + { + return data.IsRelevant; + } + } + + #endregion + } +} \ No newline at end of file Fisheye: Tag 65ce8c5ab171b234e33e2291998c9d89276db896 refers to a dead (removed) revision in file `Ringtoets/Integration/src/Ringtoets.Integration.Forms/PropertyClasses/StandAloneFailureMechanismProperties.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Ringtoets.Integration.Forms.csproj (.../Ringtoets.Integration.Forms.csproj) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -32,6 +32,7 @@ + @@ -40,11 +41,12 @@ - + + - + Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -81,6 +81,7 @@ using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; using Ringtoets.Integration.Forms.Views; using Ringtoets.Integration.Forms.Views.SectionResultViews; using Ringtoets.Integration.Plugin.FileImporters; @@ -176,8 +177,8 @@ ), new FailureMechanismContextAssociation( typeof(PipingStructureFailureMechanism), - (mechanism, assessmentSection) => new FailureMechanismContext( - mechanism, + (mechanism, assessmentSection) => new PipingStructureFailureMechanismContext( + (PipingStructureFailureMechanism) mechanism, assessmentSection) ), new FailureMechanismContextAssociation( @@ -314,6 +315,10 @@ { CreateInstance = context => new MacroStabilityOutwardsFailureMechanismProperties(context.WrappedData) }; + yield return new PropertyInfo + { + CreateInstance = context => new PipingStructureFailureMechanismProperties(context.WrappedData) + }; yield return new PropertyInfo, CalculationGroupContextProperties> { CreateInstance = context => new CalculationGroupContextProperties(context) @@ -661,6 +666,12 @@ MacroStabilityOutwardsFailureMechanismEnabledContextMenuStrip, MacroStabilityOutwardsFailureMechanismDisabledContextMenuStrip); + yield return RingtoetsTreeNodeInfoFactory.CreateFailureMechanismContextTreeNodeInfo( + PipingStructureFailureMechanismEnabledChildNodeObjects, + PipingStructureFailureMechanismDisabledChildNodeObjects, + PipingStructureFailureMechanismEnabledContextMenuStrip, + PipingStructureFailureMechanismDisabledContextMenuStrip); + yield return new TreeNodeInfo { Text = context => RingtoetsCommonFormsResources.FailureMechanismSections_DisplayName, @@ -1508,7 +1519,88 @@ #endregion + #region PipingStructureFailureMechanismContext TreeNodeInfo + private static object[] PipingStructureFailureMechanismEnabledChildNodeObjects(PipingStructureFailureMechanismContext nodeData) + { + return new object[] + { + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Inputs_DisplayName, + GetInputs(nodeData.WrappedData, nodeData.Parent), + TreeFolderCategory.Input), + new CategoryTreeFolder(RingtoetsCommonFormsResources.FailureMechanism_Outputs_DisplayName, + GetOutputs(nodeData.WrappedData), + TreeFolderCategory.Output) + }; + } + + private static object[] PipingStructureFailureMechanismDisabledChildNodeObjects(PipingStructureFailureMechanismContext nodeData) + { + return new object[] + { + nodeData.WrappedData.NotRelevantComments + }; + } + + private static IEnumerable GetInputs(PipingStructureFailureMechanism nodeData, IAssessmentSection assessmentSection) + { + return new object[] + { + new FailureMechanismSectionsContext(nodeData, assessmentSection), + nodeData.InputComments + }; + } + + private static IEnumerable GetOutputs(PipingStructureFailureMechanism nodeData) + { + var macrostabilityOutwards = nodeData as IHasSectionResults; + var failureMechanismSectionResultContexts = new object[2]; + + if (macrostabilityOutwards != null) + { + failureMechanismSectionResultContexts[0] = + new FailureMechanismSectionResultContext(macrostabilityOutwards.SectionResults, nodeData); + } + failureMechanismSectionResultContexts[1] = nodeData.OutputComments; + return failureMechanismSectionResultContexts; + } + + private ContextMenuStrip PipingStructureFailureMechanismEnabledContextMenuStrip(PipingStructureFailureMechanismContext nodeData, object parentData, TreeViewControl treeViewControl) + { + var builder = new RingtoetsContextMenuBuilder(Gui.Get(nodeData, treeViewControl)); + + return builder.AddOpenItem() + .AddSeparator() + .AddToggleRelevancyOfFailureMechanismItem(nodeData, RemoveAllViewsForItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .AddSeparator() + .AddPropertiesItem() + .Build(); + } + + private void RemoveAllViewsForItem(PipingStructureFailureMechanismContext failureMechanismContext) + { + Gui.ViewCommands.RemoveAllViewsForItem(failureMechanismContext); + } + + private ContextMenuStrip PipingStructureFailureMechanismDisabledContextMenuStrip(PipingStructureFailureMechanismContext nodeData, + object parentData, + TreeViewControl treeViewControl) + { + var builder = new RingtoetsContextMenuBuilder(Gui.Get(nodeData, treeViewControl)); + + return builder.AddToggleRelevancyOfFailureMechanismItem(nodeData, RemoveAllViewsForItem) + .AddSeparator() + .AddCollapseAllItem() + .AddExpandAllItem() + .Build(); + } + + #endregion + + #region CategoryTreeFolder TreeNodeInfo /// Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/StandAlone/PipingStructureFailureMechanismContextTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/StandAlone/PipingStructureFailureMechanismContextTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PresentationObjects/StandAlone/PipingStructureFailureMechanismContextTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,68 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; + +namespace Ringtoets.Integration.Forms.Test.PresentationObjects.StandAlone +{ + [TestFixture] + public class PipingStructureFailureMechanismContextTest + { + [Test] + public void Constructor_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + + // Call + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Assert + Assert.IsInstanceOf>(context); + Assert.AreSame(assessmentSection, context.Parent); + Assert.AreSame(failureMechanism, context.WrappedData); + mocks.VerifyAll(); + } + + [Test] + public void Constructor_AssessmentSectionIsNull_ThrowArgumentNullException() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism(); + + // Call + TestDelegate call = () => new PipingStructureFailureMechanismContext(failureMechanism, null); + + // Assert + Assert.Throws(call); + } + } +} \ No newline at end of file Fisheye: Tag 65ce8c5ab171b234e33e2291998c9d89276db896 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/MacroStabilityOutwardsFailureMechanismPropertiesTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,269 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.Probability; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.Input; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses.StandAlone +{ + public class MacroStabilityOutwardsFailureMechanismPropertiesTest + { + [Test] + public void Constructor_DataIsNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new MacroStabilityOutwardsFailureMechanismProperties(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("data", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_ExpectedValues(bool isRelevant) + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + IsRelevant = isRelevant + }; + + // Call + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreEqual(failureMechanism.Name, properties.Name); + Assert.AreEqual(failureMechanism.Code, properties.Code); + Assert.AreEqual(isRelevant, properties.IsRelevant); + + MacroStabilityOutwardsProbabilityAssessmentInput probabilityAssessmentInput = failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput; + Assert.AreEqual(probabilityAssessmentInput.A, properties.A); + Assert.AreEqual(probabilityAssessmentInput.B, properties.B); + Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces); + Assert.AreEqual(probabilityAssessmentInput.GetSectionSpecificN( + probabilityAssessmentInput.SectionLength), + properties.N, + properties.N.GetAccuracy()); + Assert.AreEqual(2, properties.SectionLength.NumberOfDecimalPlaces); + Assert.AreEqual(probabilityAssessmentInput.SectionLength, + properties.SectionLength, + properties.SectionLength.GetAccuracy()); + } + + [Test] + public void Constructor_IsRelevantTrue_PropertiesHaveExpectedAttributesValues() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + IsRelevant = true + }; + + // Call + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(7, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + const string lengthEffectCategory = "Lengte-effect parameters"; + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor labelProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor isRelevantProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, + generalCategory, + "Is relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + true); + + PropertyDescriptor aProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(aProperty, + lengthEffectCategory, + "a [-]", + "De parameter 'a' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans."); + + PropertyDescriptor bProperty = dynamicProperties[4]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(bProperty, + lengthEffectCategory, + "b [m]", + "De parameter 'b' die gebruikt wordt voor het lengte-effect in berekening van de maximaal toelaatbare faalkans.", + true); + + PropertyDescriptor sectionLengthProperty = dynamicProperties[5]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(sectionLengthProperty, + lengthEffectCategory, + "Lengte* [m]", + "Totale lengte van het traject in meters (afgerond).", + true); + + PropertyDescriptor nProperty = dynamicProperties[6]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty, + lengthEffectCategory, + "N* [-]", + "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling (afgerond).", + true); + } + + [Test] + public void Constructor_IsRelevantFalse_PropertiesHaveExpectedAttributesValues() + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + IsRelevant = false + }; + + // Call + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor labelProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor isRelevantProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, + generalCategory, + "Is relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + true); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-1)] + [TestCase(-0.1)] + [TestCase(1.1)] + [TestCase(8)] + public void A_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value) + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + failureMechanism.Attach(observer); + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Call + TestDelegate call = () => properties.A = value; + + // Assert + const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + mocks.VerifyAll(); + } + + [Test] + [TestCase(0)] + [TestCase(0.1)] + [TestCase(1)] + [TestCase(0.0000001)] + [TestCase(0.9999999)] + public void A_SetValidValue_SetsValueAndUpdatesObserver(double value) + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var failureMechanism = new MacroStabilityOutwardsFailureMechanism(); + failureMechanism.Attach(observer); + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Call + properties.A = value; + + // Assert + Assert.AreEqual(value, failureMechanism.MacroStabilityOutwardsProbabilityAssessmentInput.A); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void DynamicVisibleValidationMethod_DependingOnRelevancy_ReturnExpectedVisibility(bool isRelevant) + { + // Setup + var failureMechanism = new MacroStabilityOutwardsFailureMechanism + { + IsRelevant = isRelevant + }; + var properties = new MacroStabilityOutwardsFailureMechanismProperties(failureMechanism); + + // Call & Assert + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Name))); + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code))); + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.IsRelevant))); + + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.A))); + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.B))); + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.SectionLength))); + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.N))); + + Assert.IsTrue(properties.DynamicVisibleValidationMethod(null)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/PipingStructureFailureMechanismPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/PipingStructureFailureMechanismPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/PipingStructureFailureMechanismPropertiesTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,234 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses.StandAlone +{ + public class PipingStructureFailureMechanismPropertiesTest + { + [Test] + public void Constructor_DataIsNull_ThrowArgumentNullException() + { + // Call + TestDelegate test = () => new PipingStructureFailureMechanismProperties(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("data", paramName); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_ExpectedValues(bool isRelevant) + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = isRelevant + }; + + // Call + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreEqual(failureMechanism.Name, properties.Name); + Assert.AreEqual(failureMechanism.Code, properties.Code); + Assert.AreEqual(isRelevant, properties.IsRelevant); + + Assert.AreEqual(2, properties.N.NumberOfDecimalPlaces); + Assert.AreEqual(failureMechanism.N, + properties.N, + properties.N.GetAccuracy()); + } + + [Test] + public void Constructor_IsRelevantTrue_PropertiesHaveExpectedAttributesValues() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = true + }; + + // Call + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(4, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + const string lengthEffectCategory = "Lengte-effect parameters"; + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor labelProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor isRelevantProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, + generalCategory, + "Is relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + true); + + PropertyDescriptor nProperty = dynamicProperties[3]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nProperty, + lengthEffectCategory, + "N [-]", + "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling."); + } + + [Test] + public void Constructor_IsRelevantFalse_PropertiesHaveExpectedAttributesValues() + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = false + }; + + // Call + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Assert + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + const string generalCategory = "Algemeen"; + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor labelProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(labelProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor isRelevantProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, + generalCategory, + "Is relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + true); + } + + [Test] + [SetCulture("nl-NL")] + [TestCase(-1)] + [TestCase(0.9)] + [TestCase(20.1)] + [TestCase(30)] + public void N_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value) + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.Attach(observer); + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Call + TestDelegate call = () => properties.N = (RoundedDouble) value; + + // Assert + const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); + mocks.VerifyAll(); + } + + [Test] + [TestCase(1)] + [TestCase(12)] + [TestCase(20)] + public void A_SetValidValue_SetsValueAndUpdatesObserver(double value) + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + failureMechanism.Attach(observer); + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Call + properties.N = (RoundedDouble) value; + + // Assert + Assert.AreEqual(value, failureMechanism.N, failureMechanism.N.GetAccuracy()); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void DynamicVisibleValidationMethod_DependingOnRelevancy_ReturnExpectedVisibility(bool isRelevant) + { + // Setup + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = isRelevant + }; + var properties = new PipingStructureFailureMechanismProperties(failureMechanism); + + // Call & Assert + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Name))); + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.Code))); + Assert.IsTrue(properties.DynamicVisibleValidationMethod(nameof(properties.IsRelevant))); + + Assert.AreEqual(isRelevant, properties.DynamicVisibleValidationMethod(nameof(properties.N))); + + Assert.IsTrue(properties.DynamicVisibleValidationMethod(null)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/StandAloneFailureMechanismPropertiesTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/StandAloneFailureMechanismPropertiesTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAlone/StandAloneFailureMechanismPropertiesTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,127 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.ComponentModel; +using Core.Common.Gui.PropertyBag; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Data.TestUtil; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; + +namespace Ringtoets.Integration.Forms.Test.PropertyClasses.StandAlone +{ + [TestFixture] + public class StandAloneFailureMechanismPropertiesTest + { + [Test] + public void Constructor_FailureMechanismNull_ThrowsArgumentNullException() + { + // Call + TestDelegate test = () => new StandAloneFailureMechanismProperties(null); + + // Assert + string paramName = Assert.Throws(test).ParamName; + Assert.AreEqual("failureMechanism", paramName); + } + + [Test] + public void Constructor_WithFailureMechanism_ExpectedValues() + { + // Setup + var mocks = new MockRepository(); + var failureMechanism = mocks.Stub(); + mocks.ReplayAll(); + + // Call + var properties = new StandAloneFailureMechanismProperties(failureMechanism); + + // Assert + Assert.IsInstanceOf>(properties); + Assert.AreSame(failureMechanism, properties.Data); + mocks.VerifyAll(); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_WithIsRelevant_ReturnCorrectPropertyValues(bool isRelevant) + { + // Setup + var failureMechanism = new TestFailureMechanism + { + IsRelevant = isRelevant + }; + + // Call + var properties = new StandAloneFailureMechanismProperties(failureMechanism); + + // Assert + Assert.AreEqual(failureMechanism.Name, properties.Name); + Assert.AreEqual(failureMechanism.Code, properties.Code); + Assert.AreEqual(isRelevant, properties.IsRelevant); + } + + [Test] + [TestCase(true)] + [TestCase(false)] + public void Constructor_Always_PropertiesHaveExpectedAttributesValues(bool isRelevant) + { + // Setup + var failureMechanism = new TestFailureMechanism + { + IsRelevant = isRelevant + }; + + // Call + var properties = new StandAloneFailureMechanismProperties(failureMechanism); + + // Assert + const string generalCategory = "Algemeen"; + + PropertyDescriptorCollection dynamicProperties = PropertiesTestHelper.GetAllVisiblePropertyDescriptors(properties); + Assert.AreEqual(3, dynamicProperties.Count); + + PropertyDescriptor nameProperty = dynamicProperties[0]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(nameProperty, + generalCategory, + "Naam", + "De naam van het toetsspoor.", + true); + + PropertyDescriptor codeProperty = dynamicProperties[1]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(codeProperty, + generalCategory, + "Label", + "Het label van het toetsspoor.", + true); + + PropertyDescriptor isRelevantProperty = dynamicProperties[2]; + PropertiesTestHelper.AssertRequiredPropertyDescriptorProperties(isRelevantProperty, + generalCategory, + "Is relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + true); + } + } +} \ No newline at end of file Fisheye: Tag 65ce8c5ab171b234e33e2291998c9d89276db896 refers to a dead (removed) revision in file `Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/PropertyClasses/StandAloneFailureMechanismPropertiesTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Ringtoets.Integration.Forms.Test.csproj (.../Ringtoets.Integration.Forms.Test.csproj) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -37,8 +37,10 @@ + - + + @@ -55,7 +57,7 @@ - + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/MacroStabilityOutwardsFailureMechanismPropertyInfoTest.cs =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/MacroStabilityOutwardsFailureMechanismPropertyInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismPropertyInfoTest.cs) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/MacroStabilityOutwardsFailureMechanismPropertyInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismPropertyInfoTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -25,11 +25,9 @@ using NUnit.Framework; using Rhino.Mocks; using Ringtoets.Common.Data.AssessmentSection; -using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; -using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; namespace Ringtoets.Integration.Plugin.Test.PropertyInfos { Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/PipingStructureFailureMechanismPropertyInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/PipingStructureFailureMechanismPropertyInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/PipingStructureFailureMechanismPropertyInfoTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,81 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Linq; +using Core.Common.Gui.Plugin; +using Core.Common.Gui.PropertyBag; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; + +namespace Ringtoets.Integration.Plugin.Test.PropertyInfos +{ + [TestFixture] + public class PipingStructureFailureMechanismPropertyInfoTest + { + private RingtoetsPlugin plugin; + private PropertyInfo info; + + [SetUp] + public void SetUp() + { + plugin = new RingtoetsPlugin(); + info = plugin.GetPropertyInfos().First(tni => tni.PropertyObjectType == typeof(PipingStructureFailureMechanismProperties)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Assert + Assert.AreEqual(typeof(PipingStructureFailureMechanismContext), info.DataType); + Assert.AreEqual(typeof(PipingStructureFailureMechanismProperties), info.PropertyObjectType); + } + + [Test] + public void CreateInstance_Always_NewPropertiesWithFailureMechanismAsData() + { + // Setup + var mocks = new MockRepository(); + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Call + IObjectProperties objectProperties = info.CreateInstance(context); + + // Assert + Assert.IsInstanceOf(objectProperties); + Assert.AreSame(failureMechanism, objectProperties.Data); + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs =================================================================== diff -u -r2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs (.../StandAloneFailureMechanismPropertyInfoTest.cs) (revision 2ef5183542af0464fab4ebadb3a6c2c4f7ff46b7) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/PropertyInfos/StandAloneFailureMechanismPropertyInfoTest.cs (.../StandAloneFailureMechanismPropertyInfoTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -27,7 +27,7 @@ using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; using Ringtoets.Common.Forms.PresentationObjects; -using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; namespace Ringtoets.Integration.Plugin.Test.PropertyInfos { Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -53,6 +53,7 @@ + @@ -70,6 +71,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -r36d4b4090a4169cc8d25ede0029a3244df8fe74d -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 36d4b4090a4169cc8d25ede0029a3244df8fe74d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -55,6 +55,7 @@ using Ringtoets.Integration.Forms.PresentationObjects; using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; using Ringtoets.Integration.Forms.PropertyClasses; +using Ringtoets.Integration.Forms.PropertyClasses.StandAlone; using Ringtoets.Integration.Forms.Views; using Ringtoets.Integration.Forms.Views.SectionResultViews; using Ringtoets.Revetment.Data; @@ -222,7 +223,7 @@ PropertyInfo[] propertyInfos = plugin.GetPropertyInfos().ToArray(); // Assert - Assert.AreEqual(22, propertyInfos.Length); + Assert.AreEqual(23, propertyInfos.Length); PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, @@ -261,6 +262,11 @@ PluginTestHelper.AssertPropertyInfoDefined( propertyInfos, + typeof(PipingStructureFailureMechanismContext), + typeof(PipingStructureFailureMechanismProperties)); + + PluginTestHelper.AssertPropertyInfoDefined( + propertyInfos, typeof(ICalculationContext), typeof(CalculationGroupContextProperties)); @@ -475,12 +481,13 @@ TreeNodeInfo[] treeNodeInfos = plugin.GetTreeNodeInfos().ToArray(); // Assert - Assert.AreEqual(26, treeNodeInfos.Length); + Assert.AreEqual(27, treeNodeInfos.Length); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(AssessmentSection))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(BackgroundData))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(ReferenceLineContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(MacroStabilityOutwardsFailureMechanismContext))); + Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(PipingStructureFailureMechanismContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(CategoryTreeFolder))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismSectionsContext))); Assert.IsTrue(treeNodeInfos.Any(tni => tni.TagType == typeof(FailureMechanismContributionContext))); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs =================================================================== diff -u -r36d4b4090a4169cc8d25ede0029a3244df8fe74d -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 36d4b4090a4169cc8d25ede0029a3244df8fe74d) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/AssessmentSectionTreeNodeInfoTest.cs (.../AssessmentSectionTreeNodeInfoTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -251,7 +251,7 @@ Assert.AreSame(assessmentSection.ClosingStructures, closingStructuresFailureMechanismContext.WrappedData); Assert.AreSame(assessmentSection, closingStructuresFailureMechanismContext.Parent); - var pipingStructureFailureMechanismContext = (FailureMechanismContext) objects[18]; + var pipingStructureFailureMechanismContext = (PipingStructureFailureMechanismContext) objects[18]; Assert.AreSame(assessmentSection.PipingStructure, pipingStructureFailureMechanismContext.WrappedData); Assert.AreSame(assessmentSection, pipingStructureFailureMechanismContext.Parent); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u -r8820d80a97281c96db5f89d5af6c74d26e0f5bca -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 8820d80a97281c96db5f89d5af6c74d26e0f5bca) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs (.../MacroStabilityOutwardsFailureMechanismContextTreeNodeInfoTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -36,7 +36,6 @@ using Ringtoets.Common.Data; using Ringtoets.Common.Data.AssessmentSection; using Ringtoets.Common.Data.FailureMechanism; -using Ringtoets.Common.Data.TestUtil; using Ringtoets.Common.Forms.PresentationObjects; using Ringtoets.Integration.Data.StandAlone; using Ringtoets.Integration.Data.StandAlone.SectionResults; Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismContextTreeNodeInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismContextTreeNodeInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/TreeNodeInfos/PipingStructureFailureMechanismContextTreeNodeInfoTest.cs (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -0,0 +1,434 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Forms; +using Core.Common.Base; +using Core.Common.Base.Geometry; +using Core.Common.Controls.TreeView; +using Core.Common.Gui; +using Core.Common.Gui.Commands; +using Core.Common.Gui.ContextMenu; +using Core.Common.Gui.TestUtil.ContextMenu; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.FailureMechanism; +using Ringtoets.Common.Forms.PresentationObjects; +using Ringtoets.Integration.Data.StandAlone; +using Ringtoets.Integration.Data.StandAlone.SectionResults; +using Ringtoets.Integration.Forms.PresentationObjects.StandAlone; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.TreeNodeInfos +{ + [TestFixture] + public class PipingStructureFailureMechanismContextTreeNodeInfoTest + { + private const int contextMenuRelevancyIndexWhenNotRelevant = 0; + private const int contextMenuRelevancyIndexWhenRelevant = 2; + private MockRepository mocks; + private TreeNodeInfo info; + private RingtoetsPlugin plugin; + + [SetUp] + public void SetUp() + { + mocks = new MockRepository(); + plugin = new RingtoetsPlugin(); + info = plugin.GetTreeNodeInfos().First(tni => tni.TagType == typeof(PipingStructureFailureMechanismContext)); + } + + [TearDown] + public void TearDown() + { + plugin.Dispose(); + mocks.VerifyAll(); + } + + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + mocks.ReplayAll(); + + // Assert + Assert.IsNotNull(info.Text); + Assert.IsNotNull(info.ForeColor); + Assert.IsNotNull(info.Image); + Assert.IsNotNull(info.ContextMenuStrip); + Assert.IsNull(info.EnsureVisibleOnCreate); + Assert.IsNull(info.ExpandOnCreate); + Assert.IsNotNull(info.ChildNodeObjects); + Assert.IsNull(info.CanRename); + Assert.IsNull(info.OnNodeRenamed); + Assert.IsNull(info.CanRemove); + Assert.IsNull(info.OnNodeRemoved); + Assert.IsNull(info.CanCheck); + Assert.IsNull(info.IsChecked); + Assert.IsNull(info.OnNodeChecked); + Assert.IsNull(info.CanDrag); + Assert.IsNull(info.CanDrop); + Assert.IsNull(info.CanInsert); + Assert.IsNull(info.OnDrop); + } + + [Test] + public void Text_Always_ReturnsName() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + var failureMechanismContext = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Call + string text = info.Text(failureMechanismContext); + + // Assert + Assert.AreEqual(failureMechanism.Name, text); + } + + [Test] + public void Image_Always_ReturnsSetImage() + { + // Setup + mocks.ReplayAll(); + + // Call + Image image = info.Image(null); + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.FailureMechanismIcon, image); + } + + [Test] + public void ForeColor_Always_ReturnsControlText() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Call + Color textColor = info.ForeColor(context); + + // Assert + Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), textColor); + } + + [Test] + public void ChildNodeObjects_FailureMechanismIsRelevant_ReturnChildDataNodes() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism(); + + var failureMechanismContext = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Call + object[] children = info.ChildNodeObjects(failureMechanismContext).ToArray(); + + // Assert + Assert.AreEqual(2, children.Length); + var inputFolder = (CategoryTreeFolder) children[0]; + Assert.AreEqual("Invoer", inputFolder.Name); + Assert.AreEqual(TreeFolderCategory.Input, inputFolder.Category); + + var failureMechanismSectionsContext = (FailureMechanismSectionsContext) inputFolder.Contents.ElementAt(0); + Assert.AreSame(failureMechanism, failureMechanismSectionsContext.WrappedData); + Assert.AreSame(assessmentSection, failureMechanismSectionsContext.AssessmentSection); + + var inputComment = (Comment) inputFolder.Contents.ElementAt(1); + Assert.AreSame(failureMechanism.InputComments, inputComment); + + var outputFolder = (CategoryTreeFolder) children[1]; + Assert.AreEqual("Oordeel", outputFolder.Name); + Assert.AreEqual(TreeFolderCategory.Output, outputFolder.Category); + var failureMechanismResultsContext = (FailureMechanismSectionResultContext) + outputFolder.Contents.ElementAt(0); + Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); + + var outputComment = (Comment) outputFolder.Contents.ElementAt(1); + Assert.AreSame(failureMechanism.OutputComments, outputComment); + } + + [Test] + public void ChildNodeObjects_FailureMechanismIsNotRelevant_ReturnOnlyFailureMechanismNotRelevantComments() + { + // Setup + var assessmentSection = mocks.Stub(); + mocks.ReplayAll(); + + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = false + }; + failureMechanism.AddSection(new FailureMechanismSection("A", new[] + { + new Point2D(1, 2), + new Point2D(5, 6) + })); + var failureMechanismContext = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + // Call + object[] children = info.ChildNodeObjects(failureMechanismContext).ToArray(); + + // Assert + Assert.AreEqual(1, children.Length); + var comment = (Comment) children[0]; + Assert.AreSame(failureMechanism.NotRelevantComments, comment); + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsRelevant_CallsContextMenuBuilderMethods() + { + // Setup + using (var treeView = new TreeViewControl()) + { + var failureMechanism = new PipingStructureFailureMechanism(); + var assessmentSection = mocks.Stub(); + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + var menuBuilder = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilder.Expect(mb => mb.AddOpenItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddPropertiesItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, assessmentSection, treeView); + + // Assert + } + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsNotRelevant_CallsContextMenuBuilderMethods() + { + // Setup + using (var treeView = new TreeViewControl()) + { + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = false + }; + var assessmentSection = mocks.Stub(); + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + var menuBuilder = mocks.StrictMock(); + using (mocks.Ordered()) + { + menuBuilder.Expect(mb => mb.AddCustomItem(null)).IgnoreArguments().Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddSeparator()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddCollapseAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.AddExpandAllItem()).Return(menuBuilder); + menuBuilder.Expect(mb => mb.Build()).Return(null); + } + + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + info.ContextMenuStrip(context, assessmentSection, treeView); + + // Assert + } + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsRelevant_IsRelevantEnabled() + { + // Setup + using (var treeView = new TreeViewControl()) + { + var assessmentSection = mocks.Stub(); + var failureMechanism = new PipingStructureFailureMechanism(); + var context = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + + var gui = mocks.Stub(); + gui.Stub(cmp => cmp.Get(context, treeView)).Return(menuBuilder); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + mocks.ReplayAll(); + + plugin.Gui = gui; + + // Call + using (ContextMenuStrip menu = info.ContextMenuStrip(context, assessmentSection, treeView)) + { + TestHelper.AssertContextMenuStripContainsItem(menu, contextMenuRelevancyIndexWhenRelevant, + "I&s relevant", + "Geeft aan of dit toetsspoor relevant is of niet.", + RingtoetsCommonFormsResources.Checkbox_ticked); + } + + // Assert + } + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsRelevantAndClickOnIsRelevantItem_MakeFailureMechanismNotRelevant() + { + // Setup + var failureMechanismObserver = mocks.Stub(); + failureMechanismObserver.Expect(o => o.UpdateObserver()); + + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = true + }; + failureMechanism.Attach(failureMechanismObserver); + + var assessmentSection = mocks.Stub(); + var failureMechanismContext = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + var viewCommands = mocks.StrictMock(); + viewCommands.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); + + using (var treeViewControl = new TreeViewControl()) + { + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + + var gui = mocks.Stub(); + gui.Stub(g => g.ViewCommands).Return(viewCommands); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + gui.Stub(g => g.Get(failureMechanismContext, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(failureMechanismContext, null, treeViewControl)) + { + // Call + contextMenu.Items[contextMenuRelevancyIndexWhenRelevant].PerformClick(); + + // Assert + Assert.IsFalse(failureMechanism.IsRelevant); + } + } + } + + [Test] + public void ContextMenuStrip_FailureMechanismIsNotRelevantAndClickOnIsRelevantItem_MakeFailureMechanismRelevant() + { + // Setup + var failureMechanismObserver = mocks.Stub(); + failureMechanismObserver.Expect(o => o.UpdateObserver()); + + var failureMechanism = new PipingStructureFailureMechanism + { + IsRelevant = false + }; + failureMechanism.Attach(failureMechanismObserver); + + var assessmentSection = mocks.Stub(); + var failureMechanismContext = new PipingStructureFailureMechanismContext(failureMechanism, assessmentSection); + + var viewCommands = mocks.StrictMock(); + viewCommands.Expect(vs => vs.RemoveAllViewsForItem(failureMechanismContext)); + + var menuBuilder = new CustomItemsOnlyContextMenuBuilder(); + + using (var treeViewControl = new TreeViewControl()) + { + var gui = mocks.Stub(); + gui.Stub(g => g.ViewCommands).Return(viewCommands); + gui.Stub(g => g.ProjectOpened += null).IgnoreArguments(); + gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments(); + gui.Stub(g => g.Get(failureMechanismContext, treeViewControl)).Return(menuBuilder); + mocks.ReplayAll(); + + plugin.Gui = gui; + + using (ContextMenuStrip contextMenu = info.ContextMenuStrip(failureMechanismContext, null, treeViewControl)) + { + // Call + contextMenu.Items[contextMenuRelevancyIndexWhenNotRelevant].PerformClick(); + + // Assert + Assert.IsTrue(failureMechanism.IsRelevant); + } + } + } + + /// + /// Used in ChildNodeObjects_FailureMechanismIsRelevant_OutputNodeAddedForResult(Type) + /// + private void ChildNodeObjects_FailureMechanismIsRelevantWithSectionResults_OutputNodeAdded() where T : FailureMechanismSectionResult + { + // Setup + var assessmentSection = mocks.Stub(); + var failureMechanism = mocks.StrictMultiMock>(typeof(IFailureMechanism)); + failureMechanism.Expect(fm => ((IFailureMechanism) fm).IsRelevant).Return(true); + failureMechanism.Expect(fm => fm.SectionResults).Return(new List()).Repeat.Any(); + failureMechanism.Expect(fm => ((IFailureMechanism) fm).InputComments).Return(new Comment()); + failureMechanism.Expect(fm => ((IFailureMechanism) fm).OutputComments).Return(new Comment()); + var failureMechanismContext = mocks.Stub(failureMechanism, assessmentSection); + + mocks.ReplayAll(); + + // Call + object[] children = info.ChildNodeObjects(failureMechanismContext).ToArray(); + + // Assert + var outputFolder = (CategoryTreeFolder) children[1]; + + var failureMechanismResultsContext = (FailureMechanismSectionResultContext) outputFolder.Contents.ElementAt(0); + Assert.AreSame(failureMechanism, failureMechanismResultsContext.FailureMechanism); + Assert.AreSame(failureMechanism.SectionResults, failureMechanismResultsContext.WrappedData); + } + } +} \ No newline at end of file Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Forms.Test/PropertyClasses/MacroStabilityInwardsFailureMechanismPropertiesTest.cs (.../MacroStabilityInwardsFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -259,8 +259,8 @@ TestDelegate call = () => properties.A = value; // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("De waarde moet in het bereik [0,0, 1,0] liggen.", exception.Message); + const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); mocks.VerifyAll(); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismPropertiesTest.cs (.../PipingFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingFailureMechanismPropertiesTest.cs (.../PipingFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -357,8 +357,8 @@ TestDelegate call = () => properties.A = value; // Assert - var exception = Assert.Throws(call); - Assert.AreEqual("De waarde moet in het bereik [0,0, 1,0] liggen.", exception.Message); + const string expectedMessage = "De waarde voor 'a' moet in het bereik [0,0, 1,0] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage); mocks.VerifyAll(); } @@ -424,7 +424,9 @@ TestDelegate test = () => properties.WaterVolumetricWeight = roundedValue; // Assert - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, "De waarde moet binnen het bereik [0,00, 20,00] liggen."); + + const string expectedMessage = "De waarde moet binnen het bereik [0,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mocks.VerifyAll(); // Does not expect notify observers. } Index: Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -r6ac1d016e76120e778964de3ad7e2c0d6c837669 -r65ce8c5ab171b234e33e2291998c9d89276db896 --- Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision 6ac1d016e76120e778964de3ad7e2c0d6c837669) +++ Ringtoets/StabilityPointStructures/test/Ringtoets.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision 65ce8c5ab171b234e33e2291998c9d89276db896) @@ -256,6 +256,7 @@ } [Test] + [SetCulture("nl-NL")] [TestCase(0.0)] [TestCase(-1.0)] [TestCase(-20.0)] @@ -282,7 +283,8 @@ TestDelegate test = () => properties.N = (RoundedDouble) value; // Assert - Assert.Throws(test); + const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; + TestHelper.AssertThrowsArgumentExceptionAndTestMessage(test, expectedMessage); Assert.IsTrue(changeHandler.Called); mockRepository.VerifyAll(); }