public void TestBasicFilterDoesNotRaiseRemove() { BindingListExt <Customer> sut = CreateBindingListOnBasicCustomersList(); IBindingListEventSink mock = mockRepository.CreateMock <IBindingListEventSink>(); sut.RemovingItem += mock.HandleRemoved; Expect.Call(() => mock.HandleRemoved(null, null)).Repeat.Never(); mockRepository.ReplayAll(); sut.Filter = "Name == 'Alkampfer'"; }
public void TestThatAddedElementAlwaysRaiseEvent() { BindingListExt <Customer> sut = CreateBindingListOnBasicCustomersList(); IBindingListEventSink mock = mockRepository.CreateMock <IBindingListEventSink>(); sut.AddingNew += mock.HandleAdded; Customer cust = new Customer() { Name = "Mark Fields", Age = 28 }; Expect.Call(() => mock.HandleAdded(sut, null)) .Constraints(RhinoIs.Equal(sut), RhinoIs.Matching <AddingNewEventArgs>(args => args.NewObject == cust)) .Repeat.Once(); mockRepository.ReplayAll(); sut.Filter = "Name == 'Alkampfer'"; sut.Add(cust); }