public void Test_BindingEngine_ClearBinding_Object_Property_Expression()
        {
            var viewModel   = new TestViewModel();
            var viewModel2  = new TestViewModel2();
            var viewModel22 = new TestViewModel2();

            BindingEngine.SetPropertyBinding(viewModel, "Age", viewModel2, "Age");
            BindingEngine.SetPropertyBinding(viewModel, "Age", viewModel22, "Age");

            viewModel2.Age = 2;
            Assert.AreEqual(viewModel.Age, 2);
            viewModel22.Age = 3;
            Assert.AreEqual(viewModel.Age, 3);

            BindingEngine.ClearBinding(viewModel, model => model.Age);

            viewModel2.Age = 4;
            Assert.AreNotEqual(viewModel.Age, 4);
            viewModel22.Age = 5;
            Assert.AreNotEqual(viewModel.Age, 5);

            BindingEngine.SetPropertyBinding(viewModel, "Age", viewModel2, "Age");
            Assert.AreEqual(viewModel.Age, 4);
            BindingEngine.SetPropertyBinding(viewModel, "Age", viewModel22, "Age");
            Assert.AreEqual(viewModel.Age, 5);
        }
        public void Test_BindingEngine_ClearBinding_Object()
        {
            var viewModel  = new TestViewModel();
            var viewModel2 = new TestViewModel2();

            BindingEngine.SetPropertyBinding(viewModel2, "Name", viewModel, "Name")
            .SetMode(BindMode.TwoWay);

            viewModel.Name = Name1;
            Assert.AreEqual(viewModel2.Name, Name1);

            BindingEngine.SetPropertyBinding(viewModel2, "Age", viewModel, "Age")
            .SetMode(BindMode.TwoWay);

            BindingEngine.ClearBinding(new TestViewModel());

            viewModel.Age = 2;
            Assert.AreEqual(viewModel2.Age, 2);

            BindingEngine.ClearBinding(viewModel2);

            viewModel.Name = Name2;
            Assert.AreNotEqual(viewModel2.Name, Name2);
            viewModel.Age = 3;
            Assert.AreNotEqual(viewModel2.Age, 3);
        }
        public void Test_BindingEngine_ClearBinding_Expression()
        {
            var viewModel = new TestViewModel();
            var view      = new TestViewModel2();

            BindingEngine.SetPropertyBinding(view, "Name", viewModel, "Name")
            .SetMode(BindMode.TwoWay);

            viewModel.Name = Name1;
            Assert.AreEqual(view.Name, Name1);

            BindingEngine.ClearBinding(view, i => i.Name, viewModel, o => o.Name);

            viewModel.Name = Name2;
            Assert.AreNotEqual(view.Name, Name2);
        }