Esempio n. 1
0
        public void FireEventEvenNewIsSameAsOldValue()
        {
            var o          = new NotifiableTestClass();
            var observable = Post.Cast <NotifiableTestClass, INotifyPropertyChanged>(o);
            var count      = 0;

            observable.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
            {
                Assert.AreEqual("Name", e.PropertyName);
                count++;
            };

            o.Name = "Onno"; //event should fire
            o.Name = "Onno";
            Assert.AreEqual(2, count);
        }
Esempio n. 2
0
        public void TestChangingPrivateProperty()
        {
            NotifiableTestClass notifiableTestClass = new NotifiableTestClass();
            int changeCount = 0;

            Post.Cast <NotifiableTestClass, INotifyPropertyChanged>(notifiableTestClass).PropertyChanged +=
                delegate(object sender, System.ComponentModel.PropertyChangedEventArgs e)
            {
                Assert.AreEqual("Name", e.PropertyName);
                changeCount++;
            };
            notifiableTestClass.SetNameUsingPrivateMethod("My New Name");

            Assert.AreEqual("My New Name", notifiableTestClass.Name);
            Assert.AreEqual(1, changeCount);
        }