public void TestThatRaisePropertyChangedCallEventHandler() { var fixture = new Fixture(); var sender = fixture.CreateAnonymous <object>(); var propertyName = fixture.CreateAnonymous <string>(); var domainObject = new MyDomainObject(); Assert.That(domainObject, Is.Not.Null); var eventHandlerCalled = false; domainObject.PropertyChanged += ((s, e) => { Assert.That(s, Is.Not.Null); Assert.That(s, Is.EqualTo(sender)); Assert.That(e, Is.Not.Null); Assert.That(e.PropertyName, Is.Not.Null); Assert.That(e.PropertyName, Is.Not.Empty); Assert.That(e.PropertyName, Is.EqualTo(propertyName)); eventHandlerCalled = true; }); domainObject.RaisePropertyChanged(sender, propertyName); Assert.That(eventHandlerCalled, Is.True); }
public void TestThatRaisePropertyChangedThrowsAnArgumentNullExceptionIfPropertyNameIsEmpty() { var fixture = new Fixture(); var domainObject = new MyDomainObject(); Assert.That(domainObject, Is.Not.Null); Assert.Throws <ArgumentNullException>(() => domainObject.RaisePropertyChanged(fixture.CreateAnonymous <object>(), string.Empty)); }
public void TestThatRaisePropertyChangedThrowsAnArgumentNullExceptionIfSenderIsNull() { var fixture = new Fixture(); var domainObject = new MyDomainObject(); Assert.That(domainObject, Is.Not.Null); Assert.Throws <ArgumentNullException>(() => domainObject.RaisePropertyChanged(null, fixture.CreateAnonymous <string>())); }
public void TestThatRaisePropertyChangedReturnsIfEventHandlerNotSet() { var fixture = new Fixture(); var sender = fixture.CreateAnonymous <object>(); var propertyName = fixture.CreateAnonymous <string>(); var domainObject = new MyDomainObject(); Assert.That(domainObject, Is.Not.Null); domainObject.RaisePropertyChanged(sender, propertyName); }