예제 #1
0
        public void BaseVM_AcceptChangedProperties()
        {
            var vm = new TestVM();

            vm.String = "MyString";
            Assert.IsNotNull(vm.ChangedProperties);
            Assert.AreEqual(1, vm.ChangedProperties.Count);
            Assert.IsTrue(vm.ChangedProperties.ContainsKey("String"));
            Assert.AreEqual("MyString", vm.ChangedProperties["String"]);

            vm.AcceptChangedProperties();

            vm.Int    = 13;
            vm.Double = 3.1456;
            Assert.IsNotNull(vm.ChangedProperties);
            Assert.AreEqual(2, vm.ChangedProperties.Count);
            Assert.IsTrue(vm.ChangedProperties.ContainsKey("Int"));
            Assert.AreEqual(13, vm.ChangedProperties["Int"]);
            Assert.IsTrue(vm.ChangedProperties.ContainsKey("Double"));
            Assert.AreEqual(3.1456, vm.ChangedProperties["Double"]);

            vm.AcceptChangedProperties();

            Assert.IsNotNull(vm.ChangedProperties);
            Assert.AreEqual(0, vm.ChangedProperties.Count);
        }
예제 #2
0
        public void BaseVM_AcceptChangedProperties()
        {
            var vm = new TestVM();

             vm.String = "MyString";
             Assert.IsNotNull(vm.ChangedProperties);
             Assert.AreEqual(1, vm.ChangedProperties.Count);
             Assert.IsTrue(vm.ChangedProperties.ContainsKey("String"));
             Assert.AreEqual("MyString", vm.ChangedProperties["String"]);

             vm.AcceptChangedProperties();

             vm.Int = 13;
             vm.Double = 3.1456;
             Assert.IsNotNull(vm.ChangedProperties);
             Assert.AreEqual(2, vm.ChangedProperties.Count);
             Assert.IsTrue(vm.ChangedProperties.ContainsKey("Int"));
             Assert.AreEqual(13, vm.ChangedProperties["Int"]);
             Assert.IsTrue(vm.ChangedProperties.ContainsKey("Double"));
             Assert.AreEqual(3.1456, vm.ChangedProperties["Double"]);

             vm.AcceptChangedProperties();

             Assert.IsNotNull(vm.ChangedProperties);
             Assert.AreEqual(0, vm.ChangedProperties.Count);
        }