[Test] public void SetEventRaiserAttributeAllowsChangingRaiser() { Factory.Reset(true); NotifyPropertyChangeFactory.SetBaseType <GoodBase>(); NotifyPropertyChangeFactory.SetEventRaiserAttribute <RaiserAttribute>(a => a.OnPropertyChanged); var handler = MockRepository.GenerateStub <PropertyChangedEventHandler>(); var bar = MockRepository.GenerateStub <IBar>(); var barProxy = NotifyPropertyChangeFactory.GetProxy(bar); Assert.That(barProxy, Is.InstanceOf <GoodBase>()); ((INotifyPropertyChanged)barProxy).PropertyChanged += handler; barProxy.LongProperty = 100; handler.AssertWasCalled(x => x(Arg <object> .Is.Same(barProxy), Arg <PropertyChangedEventArgs> .Matches(e => e.PropertyName == "LongProperty Raised"))); }
[Test] public void SetEventRaiserAttributeChokesOnNullConverter() { Assert.Throws <ArgumentNullException>( () => NotifyPropertyChangeFactory.SetEventRaiserAttribute <RaiserAttribute>(null)); }