Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs =================================================================== diff -u -r3d113e20211791ee77497b915bf4f32ad8d4cedd -rd9a677f9a0d3da55efaba59f08983893bf86c572 --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs (.../StabilityPointStructuresCalculationsPropertiesTest.cs) (revision 3d113e20211791ee77497b915bf4f32ad8d4cedd) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresCalculationsPropertiesTest.cs (.../StabilityPointStructuresCalculationsPropertiesTest.cs) (revision d9a677f9a0d3da55efaba59f08983893bf86c572) @@ -185,15 +185,10 @@ [TestCase(0.0)] [TestCase(-1.0)] [TestCase(-20.0)] - public void N_InvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double value) + public void N_InvalidValue_ThrowsArgumentOutOfRangeException(double value) { // Setup - var mockRepository = new MockRepository(); - var observer = mockRepository.StrictMock(); - mockRepository.ReplayAll(); - var failureMechanism = new StabilityPointStructuresFailureMechanism(); - failureMechanism.Attach(observer); var properties = new StabilityPointStructuresCalculationsProperties(failureMechanism); @@ -203,7 +198,6 @@ // Assert const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(Call, expectedMessage); - mockRepository.VerifyAll(); } [Test] @@ -228,6 +222,7 @@ // Assert Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); + mockRepository.VerifyAll(); } } Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs =================================================================== diff -u -r68c1056ae1d2b721cd39bcb60f3fdf3213645293 -rd9a677f9a0d3da55efaba59f08983893bf86c572 --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision 68c1056ae1d2b721cd39bcb60f3fdf3213645293) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailureMechanismPropertiesTest.cs (.../StabilityPointStructuresFailureMechanismPropertiesTest.cs) (revision d9a677f9a0d3da55efaba59f08983893bf86c572) @@ -21,9 +21,13 @@ using System; using System.ComponentModel; +using Core.Common.Base; +using Core.Common.Base.Data; +using Core.Common.TestUtil; using Core.Gui.PropertyBag; using Core.Gui.TestUtil; using NUnit.Framework; +using Rhino.Mocks; using Riskeer.Common.Data.TestUtil; using Riskeer.StabilityPointStructures.Data; using Riskeer.StabilityPointStructures.Forms.PropertyClasses; @@ -139,5 +143,51 @@ "N [-]", "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling."); } + + [Test] + [SetCulture("nl-NL")] + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void N_InvalidValue_ThrowsArgumentOutOfRangeException(double value) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var properties = new StabilityPointStructuresFailureMechanismProperties(failureMechanism, new StabilityPointStructuresFailureMechanismProperties.ConstructionProperties()); + + // Call + void 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); + } + + [Test] + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void N_SetValidValue_UpdateDataAndNotifyObservers(double value) + { + // Setup + var mockRepository = new MockRepository(); + var observer = mockRepository.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mockRepository.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.Attach(observer); + + var properties = new StabilityPointStructuresFailureMechanismProperties(failureMechanism, new StabilityPointStructuresFailureMechanismProperties.ConstructionProperties()); + + // Call + properties.N = (RoundedDouble) value; + + // Assert + Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); + + mockRepository.VerifyAll(); + } } } \ No newline at end of file Index: Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs =================================================================== diff -u -r68c1056ae1d2b721cd39bcb60f3fdf3213645293 -rd9a677f9a0d3da55efaba59f08983893bf86c572 --- Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs (.../StabilityPointStructuresFailurePathPropertiesTest.cs) (revision 68c1056ae1d2b721cd39bcb60f3fdf3213645293) +++ Riskeer/StabilityPointStructures/test/Riskeer.StabilityPointStructures.Forms.Test/PropertyClasses/StabilityPointStructuresFailurePathPropertiesTest.cs (.../StabilityPointStructuresFailurePathPropertiesTest.cs) (revision d9a677f9a0d3da55efaba59f08983893bf86c572) @@ -19,9 +19,14 @@ // 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.TestUtil; using Core.Gui.TestUtil; using NUnit.Framework; +using Rhino.Mocks; using Riskeer.Common.Data.TestUtil; using Riskeer.StabilityPointStructures.Data; using Riskeer.StabilityPointStructures.Forms.PropertyClasses; @@ -109,5 +114,51 @@ "N [-]", "De parameter 'N' die gebruikt wordt om het lengte-effect mee te nemen in de beoordeling."); } + + [Test] + [SetCulture("nl-NL")] + [TestCase(0.0)] + [TestCase(-1.0)] + [TestCase(-20.0)] + public void N_InvalidValue_ThrowsArgumentOutOfRangeException(double value) + { + // Setup + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + + var properties = new StabilityPointStructuresFailurePathProperties(failureMechanism); + + // Call + void 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); + } + + [Test] + [TestCase(1.0)] + [TestCase(10.0)] + [TestCase(20.0)] + public void N_SetValidValue_UpdateDataAndNotifyObservers(double value) + { + // Setup + var mockRepository = new MockRepository(); + var observer = mockRepository.StrictMock(); + observer.Expect(o => o.UpdateObserver()); + mockRepository.ReplayAll(); + + var failureMechanism = new StabilityPointStructuresFailureMechanism(); + failureMechanism.Attach(observer); + + var properties = new StabilityPointStructuresFailurePathProperties(failureMechanism); + + // Call + properties.N = (RoundedDouble) value; + + // Assert + Assert.AreEqual(value, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); + + mockRepository.VerifyAll(); + } } } \ No newline at end of file