public void Events_Are_Registered() { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //new IndexPresenter(panel, form); form.AssertWasCalled(f => f.DatatypeChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.DescriptionChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.IndexNameChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.SelectedColumnChanged += null, c => c.IgnoreArguments()); form.AssertWasCalled(f => f.DeleteColumn += null, c => c.IgnoreArguments()); }
public void The_Form_Is_Filled() { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); IIndex obj = MockRepository.GenerateMock <IIndex>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //IndexPresenter presenter = new IndexPresenter(panel, form); //presenter.AttachToModel(obj); form.AssertWasCalled(f => f.Datatype = obj.Datatype); form.AssertWasCalled(f => f.Description = obj.Description); form.AssertWasCalled(f => f.IndexName = obj.Name); form.AssertWasCalled(f => f.Columns = obj.Columns); form.AssertWasCalled(f => f.SetVirtualProperties(obj.Ex)); }
public void Clear_Called() { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); IIndex obj = MockRepository.GenerateMock <IIndex>(); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new IndexPresenter(panel, form); //presenter.AttachToModel(obj); form.AssertWasCalled(f => f.Clear()); }
private void Test_Property_Called(Action <Index> setPropertyAction, Action <IIndexForm> action) { IIndexForm form = MockRepository.GenerateMock <IIndexForm>(); Index obj = new Index("Index1"); IMainPanel panel = MockRepository.GenerateMock <IMainPanel>(); //var presenter = new IndexPresenter(panel, form); //presenter.AttachToModel(obj); setPropertyAction(obj); form.AssertWasCalled(action); }
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 Columns_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); List <IColumn> columns = new List <IColumn>(); obj.Stub(o => o.Columns).Return(columns); // Raise the PropertyChanged event for the Columns collection on the Index IEventRaiser raiser = obj.GetEventRaiser(e => e.PropertyChanged += null); raiser.Raise(obj, new PropertyChangedEventArgs("Columns")); form.AssertWasCalled(f => f.Columns = columns); }