public void Do3Classic() { var mockRepository = new MockRepository(); var view = mockRepository.StrictMock<IButtonView>(); var model = mockRepository.StrictMock<IToggleModel>(); model.VisibilityStateChanged += null; IEventRaiser visibilityChanged = LastCall.GetEventRaiser(); view.Clicked += null; IEventRaiser clicked = LastCall.GetEventRaiser(); var presenter = new ButtonPresenter(model); presenter.ConnectView(view); mockRepository.BackToRecordAll(); //mockRepository.Playback(); Expect.Call(model.ToggleVisibility); Expect.Call(() => model.VisibilityStateChanged += null).IgnoreArguments(); Expect.Call(() => view.SetCheckedState(CheckedState.Checked)); mockRepository.ReplayAll(); clicked.Raise(); visibilityChanged.Raise(VisibilityState.Visible); mockRepository.VerifyAll(); }
public void SetUp() { mocks = new MockRepository(); factory = (IPoolableObjectFactory) mocks.DynamicMock(typeof(IPoolableObjectFactory)); Expect.Call(factory.MakeObject()).Return(new object()).Repeat.Any(); mocks.ReplayAll(); pool = new SimplePool(factory, 1); mocks.BackToRecordAll(); }