private void Property_Changed_Called_After_Form_Updates(Action <IIndexForm> setFormPropertyReturnValue, Action <IIndexForm> @event, Action <IIndexForm> expectedCall, object newPropertyValue, Func <Index, object> getParameter) { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); Index obj = new Index("Index1"); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new IndexPresenter(panel, form); //presenter.AttachToModel(obj); IEventRaiser raiser = form.GetEventRaiser(@event); setFormPropertyReturnValue(form); raiser.Raise(form, null); form.AssertWasCalled(expectedCall); Assert.That(getParameter(obj), Is.EqualTo(newPropertyValue)); }
public void Column_Selection_Changed_Called() { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); IIndex obj = MockRepository.GenerateStub <IIndex>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new IndexPresenter(panel, form); //presenter.AttachToModel(obj); Column toReturn = new Column("Column1"); form.Stub(o => o.SelectedColumn).Return(toReturn); // Raise the PropertyChanged event for the Columns collection on the Key IEventRaiser raiser = form.GetEventRaiser(e => e.SelectedColumnChanged += null); raiser.Raise(obj, null); panel.AssertWasCalled(p => p.ShowObjectPropertyGrid(toReturn)); }