public void ApplyLengthEffectInSection_SetNewValue_NotifyObservers() { // Setup var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); failureMechanism.Attach(observer); var properties = new GrassCoverErosionOutwardsFailureMechanismProperties(failureMechanism); // Call properties.ApplyLengthEffectInSection = true; // Assert Assert.IsTrue(failureMechanism.GeneralInput.ApplyLengthEffectInSection); mocks.VerifyAll(); }
public void N_SetValidValue_UpdateDataAndNotifyObservers(double newN) { // Setup var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); observer.Expect(o => o.UpdateObserver()); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); failureMechanism.Attach(observer); var properties = new GrassCoverErosionOutwardsFailureMechanismProperties(failureMechanism); // Call properties.N = (RoundedDouble)newN; // Assert Assert.AreEqual(newN, failureMechanism.GeneralInput.N, failureMechanism.GeneralInput.N.GetAccuracy()); mocks.VerifyAll(); }
public void N_SetInvalidValue_ThrowsArgumentOutOfRangeExceptionNoNotifications(double newN) { // Setup var mocks = new MockRepository(); var observer = mocks.StrictMock <IObserver>(); mocks.ReplayAll(); var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); failureMechanism.Attach(observer); var properties = new GrassCoverErosionOutwardsFailureMechanismProperties(failureMechanism); // Call void Call() => properties.N = (RoundedDouble)newN; // Assert const string expectedMessage = "De waarde voor 'N' moet in het bereik [1,00, 20,00] liggen."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(Call, expectedMessage); mocks.VerifyAll(); }