示例#1
0
        public void RestoreNotificationExpression()
        {
            var counter = 0;
            var vm      = new TestVM();

            vm.PropertyChanged += (s, a) => counter++;

            vm.SuppressNotifications(() => vm.MyProperty);

            // initial value
            vm.MyProperty = 0;
            counter       = 0;

            vm.MyProperty = 42;
            Assert.AreEqual(0, counter, "PropertyChanged was raised after SuppressNotifications.");

            vm.RestoreNotifications(() => vm.MyProperty);
            Assert.AreEqual(1, counter, "PropertyChanged was not raised after RestoreNotifications");
        }
示例#2
0
        public void RestoreNotificationExpression_Fail()
        {
            var vm = new TestVM();

            vm.RestoreNotifications(() => 42);
        }