Exemplo n.º 1
0
        public void Bind带参Command()
        {
            IComponentEvent <int> view = new TestView();
            int         result         = -1;
            BindFactory factory        = new BindFactory(view);

            void Func(int a)
            {
                result = a;
            }

            factory.BindCommand <IComponentEvent <int>, int>(view, Func);
            view.GetComponentEvent().Invoke(2);
            Assert.IsTrue(result == 2);
        }
Exemplo n.º 2
0
        public void BindCommand测试()
        {
            IComponentEvent view      = new TestView();
            ViewModel       vm        = Substitute.For <ViewModel>();
            bool            isTrigger = false;
            BindFactory <IComponentEvent, ViewModel> factory = new BindFactory <IComponentEvent, ViewModel>(view, vm);

            void Func()
            {
                isTrigger = true;
            }

            factory.BindCommand(view, Func);
            view.GetComponentEvent().Invoke();
            Assert.IsTrue(isTrigger);
        }
Exemplo n.º 3
0
        public void BindCommand()
        {
            IComponentEvent view      = new TestView();
            bool            isTrigger = false;
            BindFactory     factory   = new BindFactory(view);

            void Func()
            {
                isTrigger = !isTrigger;
            }

            factory.BindCommand(view, Func);
            factory.Reset();
            view.GetComponentEvent().Invoke();
            Assert.IsTrue(isTrigger);
        }
Exemplo n.º 4
0
        public void Bind带参Command测试()
        {
            IComponentEvent <int> view = new TestView();
            ViewModel             vm   = Substitute.For <ViewModel>();
            int result = -1;
            BindFactory <IComponentEvent <int>, ViewModel> factory =
                new BindFactory <IComponentEvent <int>, ViewModel>(view, vm);

            void Func(int a)
            {
                result = a;
            }

            factory.BindCommand <IComponentEvent <int>, int>(view, Func);
            view.GetComponentEvent().Invoke(2);
            Assert.IsTrue(result == 2);
        }