コード例 #1
0
 public void PropertyChangedShouldFireWhenClassFiresIt()
 {
     var testSubject = new _ObjWithPropertyChangeNotification();
     testSubject.MonitorEvents();
     testSubject.FireDescriptionChangedBecauseTestSaidTo();
     testSubject.ShouldRaisePropertyChangeFor(s => s.Description);
 }
 public void ShouldFirePropertyChangedWhenDependencyChanges()
 {
     var source = new _ObjWithPropertyChangeNotification();
     var listener = new _ObjWithPropagation(source);
     listener.MonitorEvents();
     source.FireDescriptionChangedBecauseTestSaidTo();
     listener.ShouldRaisePropertyChangeFor(l => l.DependsOnDescription);
 }
 public void ForPropertyShouldWrapAnActionAndCallItOnlyIfCalledWithPropertyChangeForTheRightProperty()
 {
     var source = new _ObjWithPropertyChangeNotification();
     bool wasCalled = false;
     var testSubject = source.ForProperty(() => source.Description, () => wasCalled = true);
     testSubject(null, new PropertyChangedEventArgs("NotDescription"));
     wasCalled.Should().BeFalse();
     testSubject(null, new PropertyChangedEventArgs("Description"));
     wasCalled.Should().BeTrue();
 }
 public _ObjWithPropagation([NotNull] _ObjWithPropertyChangeNotification source)
 {
     _source = source;
     this.Propagate(() => DependsOnDescription).From(source, src => src.Description);
 }