コード例 #1
0
        public void BindProperty不同类型wrap()
        {
            TestView    view    = new TestView();
            BindFactory factory = new BindFactory(view);
            ObservableProperty <int> property = Substitute.For <ObservableProperty <int> >(1);

            factory.Bind(view, property, (field) => field + "wrap");
            Assert.IsTrue(view.Name == "1wrap");
            property.Value = 2;
            Assert.IsTrue(view.Name == "2wrap");
        }
コード例 #2
0
        public void BindProperty()
        {
            TestView    view    = new TestView();
            BindFactory factory = new BindFactory(view);
            ObservableProperty <string> property = Substitute.For <ObservableProperty <string> >("哈哈");

            factory.Bind(view, property);
            Assert.IsTrue(view.Name == "哈哈");
            property.Value = "修改";
            Assert.IsTrue(view.Name == "修改");
        }
コード例 #3
0
ファイル: UITest.cs プロジェクト: ltz0836/Framework
        public void BindProperty测试()
        {
            TestView  view = new TestView();
            ViewModel vm   = Substitute.For <ViewModel>();
            BindFactory <TestView, ViewModel> factory  = new BindFactory <TestView, ViewModel>(view, vm);
            ObservableProperty <string>       property = Substitute.For <ObservableProperty <string> >("哈哈");

            factory.Bind(view, property);
            Assert.IsTrue(view.Name == "哈哈");
            property.Value = "修改";
            Assert.IsTrue(view.Name == "修改");
        }
コード例 #4
0
        public void BindProperty多个字段wrap()
        {
            TestView    view    = new TestView();
            BindFactory factory = new BindFactory(view);
            ObservableProperty <int> property1 = Substitute.For <ObservableProperty <int> >(1);
            ObservableProperty <int> property2 = Substitute.For <ObservableProperty <int> >(2);

            //factory.Bind(view, property, (field) => field + "wrap");
            factory.Bind(view, property1, property2, (i1, i2) => (i1 + i2) + "wrap");
            Assert.IsTrue(view.Name == "3wrap");
            property1.Value = 2;
            Assert.IsTrue(view.Name == "4wrap");
            property2.Value = 3;
            Assert.IsTrue(view.Name == "5wrap");
        }
コード例 #5
0
        public void BindProperty多个字段()
        {
            TestView    view    = new TestView();
            BindFactory factory = new BindFactory(view);
            ObservableProperty <string> property1 = Substitute.For <ObservableProperty <string> >("p1");
            ObservableProperty <string> property2 = Substitute.For <ObservableProperty <string> >("p2");

            //factory.Bind(view, property, (field) => field + "wrap");
            factory.Bind(view, property1, property2, (i1, i2) => i1 + i2);
            Assert.IsTrue(view.Name == "p1p2");
            property1.Value = "p3";
            Assert.IsTrue(view.Name == "p3p2");
            property2.Value = "p4";
            Assert.IsTrue(view.Name == "p3p4");
        }