예제 #1
0
        public void SetPropertyValueTest_EqualReference()
        {
            var vm = new ViewModelMock().RegisterCounter();

            var obj = new object();

            vm.SetPropertyValue(ref obj, obj, "PropertyName");

            Assert.AreEqual(0, vm.PropertyChangedRaisedCount);
        }
예제 #2
0
        public void SetPropertyValueTest_Equal()
        {
            var vm = new ViewModelMock().RegisterCounter();

            string oldValue = "String";

            vm.SetPropertyValue(ref oldValue, "String", "PropertyName");

            Assert.AreEqual(0, vm.PropertyChangedRaisedCount);
        }
예제 #3
0
        public void SetPropertyValueTest_ClearNull()
        {
            var vm = new ViewModelMock().RegisterCounter();

            object?oldValue = null;

            vm.SetPropertyValue(ref oldValue, new object(), "PropertyName");

            Assert.AreEqual(1, vm.PropertyChangedRaisedCount);
        }
예제 #4
0
        public void SetPropertyValueTest()
        {
            var vm = new ViewModelMock().RegisterCounter();

            int value = 13;

            vm.SetPropertyValue(ref value, 0, "Test");

            Assert.AreEqual(1, vm.PropertyChangedRaisedCount);
            Assert.AreEqual(0, value);
        }