Inheritance: ModelBase
コード例 #1
0
        public void TestInitialize()
        {
            sourceModel = new BindingModel();
            targetModel = new BindingModel();

            sourceProp = sourceModel.GetPropertyRef(PropText);
            targetProp = targetModel.GetPropertyRef(PropText);
        }
コード例 #2
0
        public void ShouldChangeBinding()
        {
            targetProp.BindTo(sourceProp, BindingMode.OneWay);
            sourceModel.Text = "Foo";
            Assert.That(targetModel.Text).Is("Foo");

            // --

            WriteModels("Before");

            // Change binding.
            Log.Info("Bind to another source");

            BindingModel source2 = new BindingModel();
            targetProp.BindTo(source2.GetPropertyRef(PropText));

            source2.Text = "Zana";
            sourceModel.Text = "Another value";
            WriteModels("After change to second bound source ('Zana')");
            Assert.That(targetModel.Text).Is("Zana");
        }