Example #1
0
        public void PropertyChangedShouldFireWhenClassFiresIt()
        {
            var testSubject = new _ObjWithPropertyChangeNotification();

            testSubject.MonitorEvents();
            testSubject.FireDescriptionChangedBecauseTestSaidTo();
            testSubject.ShouldRaisePropertyChangeFor(s => s.Description);
        }
Example #2
0
        public void ShouldFirePropertyChangedWhenDependencyChanges()
        {
            var source   = new _ObjWithPropertyChangeNotification();
            var listener = new _ObjWithPropagation(source);

            listener.MonitorEvents();
            source.FireDescriptionChangedBecauseTestSaidTo();
            listener.ShouldRaisePropertyChangeFor(l => l.DependsOnDescription);
        }
Example #3
0
        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.PropagateFrom(() => DependsOnDescription, source, src => src.Description);
 }
 public void Setup()
 {
     _testSubject = new _ObjWithPropertyChangeNotification();
     _propThatChanged = "was never called";
 }
Example #6
0
 public _ObjWithPropagation([NotNull] _ObjWithPropertyChangeNotification source)
 {
     _source = source;
     this.Propagate(() => DependsOnDescription).From(source, src => src.Description);
 }