示例#1
0
        public void When_INPC_Raise_All_Updated()
        {
            var SUT = new Binder_INPC_Data();

            SUT.SetBinding(
                Binder_INPC_Data.MyValueProperty,
                new Binding
            {
                Path = new PropertyPath("Class1.Value")
            });

            SUT.SetBinding(
                Binder_INPC_Data.MyValue2Property,
                new Binding
            {
                Path      = new PropertyPath("Value"),
                Converter = new Binder_INPC_DummyConverter()
            });

            var master = new Binder_INPC_Base_Class();

            SUT.DataContext = master;

            master.RaiseAllUpdated();

            Assert.AreEqual(SUT.MyValue, master.Class1.Value);
            Assert.AreEqual(SUT.MyValue2, master.Value);
        }
示例#2
0
        public void When_INPC_Update_SameReference_Converter()
        {
            var SUT = new Binder_INPC_Data();

            SUT.SetBinding(
                Binder_INPC_Data.MyValueProperty,
                new Binding
            {
                Path      = new PropertyPath("Value"),
                Converter = new Binder_INPC_DummyConverter()
            });

            var master = new Binder_INPC_Base_Class();

            SUT.DataContext = master;

            Assert.AreEqual(2, master.ValueGetCount);
            Assert.AreEqual(0, master.ValueSetCount);

            master.RaiseUpdated();

            Assert.AreEqual(SUT.MyValue, master.Value);
            Assert.AreEqual(4, master.ValueGetCount);
            Assert.AreEqual(0, master.ValueSetCount);
        }