Пример #1
0
        public void ReactsOnEventDerived()
        {
            var fake = new DerivedFake {
                Value = 1
            };

            fake.ObservePropertyChanged()
            .Subscribe(_changes.Add);
            Assert.AreEqual(0, _changes.Count);
            fake.OnPropertyChanged("SomeProp");
            Assert.AreEqual(1, _changes.Count);
            AssertRx.AreEqual(fake, "SomeProp", _changes.Last());
        }
Пример #2
0
            public void ReactsOnEventDerived()
            {
                var changes = new List <EventPattern <PropertyChangedEventArgs> >();
                var fake    = new DerivedFake {
                    Value = 1
                };

                using (fake.ObservePropertyChanged()
                       .Subscribe(changes.Add))
                {
                    Assert.AreEqual(0, changes.Count);
                    fake.OnPropertyChanged("SomeProp");
                    Assert.AreEqual(1, changes.Count);
                    EventPatternAssert.AreEqual(fake, "SomeProp", changes.Last());
                }
            }
        public static void ReactsOnEventDerived()
        {
            var changes = new List <EventPattern <PropertyChangedEventArgs> >();
            var source  = new DerivedFake {
                Value = 1
            };

            using (source.ObservePropertyChanged()
                   .Subscribe(changes.Add))
            {
                Assert.AreEqual(0, changes.Count);
                source.OnPropertyChanged(nameof(source.Name));
                Assert.AreEqual(1, changes.Count);
                EventPatternAssert.AreEqual(source, nameof(source.Name), changes.Last());
            }
        }