public void UpdateForeshoreProfileDerivedCalculationInput_ForeshoreProfileNotSynchronized_NotifyObservers(bool hasOutput) { // Setup var mocks = new MockRepository(); var calculationInput = mocks.StrictMock <ICalculationInputWithForeshoreProfile>(); calculationInput.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(false); calculationInput.Expect(ci => ci.SynchronizeForeshoreProfileInput()); calculationInput.Expect(ci => ci.NotifyObservers()); var calculation = mocks.StrictMock <ICalculation <ICalculationInputWithForeshoreProfile> >(); calculation.Stub(c => c.InputParameters).Return(calculationInput); calculation.Expect(c => c.HasOutput).Return(hasOutput); if (hasOutput) { calculation.Expect(c => c.ClearOutput()); calculation.Expect(c => c.NotifyObservers()); } mocks.ReplayAll(); // Call SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculation); // Assert mocks.VerifyAll(); }
public void UpdateForeshoreProfileDerivedCalculationInput_ForeshoreProfileSynchronized_DoesNotNotifyObservers() { // Setup var mocks = new MockRepository(); var calculationInput = mocks.StrictMock <ICalculationInputWithForeshoreProfile>(); calculationInput.Expect(ci => ci.IsForeshoreProfileInputSynchronized).Return(true); var calculation = mocks.StrictMock <ICalculation <ICalculationInputWithForeshoreProfile> >(); calculation.Stub(c => c.InputParameters).Return(calculationInput); mocks.ReplayAll(); // Call SynchronizeCalculationWithForeshoreProfileHelper.UpdateForeshoreProfileDerivedCalculationInput(calculation); // Assert mocks.VerifyAll(); }