public virtual void TwoExecute()
        {
            var vm = CommandTests_a.Create();
            var bt = BindingTestHelper.BindAssert <Button>("Button", "Command", "{b:DXCommand Execute='Do1(); Do2()'}", null, vm);

            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(1, vm.Do1Counter);
            Assert.AreEqual(1, vm.Do2Counter);
            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(2, vm.Do1Counter);
            Assert.AreEqual(2, vm.Do2Counter);

            vm = CommandTests_a.Create();
            bt = BindingTestHelper.BindAssert <Button>("Button", "Command", "{b:DXCommand Execute='Do1(); Do2()', CanExecute='CanDo1() &amp;&amp; CanDo2()'}", null, vm);
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(2, vm.CanDo1Counter);
            Assert.AreEqual(0, vm.CanDo2Counter);
            vm.CanDo1Value = true;
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(3, vm.CanDo1Counter);
            Assert.AreEqual(1, vm.CanDo2Counter);
            vm.CanDo2Value = true;
            Assert.AreEqual(true, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(4, vm.CanDo1Counter);
            Assert.AreEqual(2, vm.CanDo2Counter);
            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(1, vm.Do1Counter);
            Assert.AreEqual(1, vm.Do2Counter);
        }
        public void OneExecute()
        {
            var vm = CommandTests_a.Create();
            var bt = BindingTestHelper.BindAssert <Button>("Button", "Command", "{b:DXCommand Do1()}", null, vm);

            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(1, vm.Do1Counter);
            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(2, vm.Do1Counter);

            vm             = CommandTests_a.Create();
            vm.CanDo1Value = true;
            bt             = BindingTestHelper.BindAssert <Button>("Button", "Command", "{b:DXCommand Do1(), CanExecute='CanDo1()'}", null, vm);
            Assert.AreEqual(1, vm.CanDo1Counter);

            vm = CommandTests_a.Create();
            bt = BindingTestHelper.BindAssert <Button>("Button", "Command", "{b:DXCommand Do1(), CanExecute='CanDo1()'}", null, vm);
            Assert.AreEqual(1, vm.CanDo1Counter);
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(2, vm.CanDo1Counter);
            Assert.AreEqual(0, vm.Do1Counter);
            vm.CanDo1Value = true;
            Assert.AreEqual(true, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(3, vm.CanDo1Counter);
            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(1, vm.Do1Counter);
        }
        public virtual void Arguments()
        {
            var vm = CommandTests_a.Create();
            var bt = BindingTestHelper.BindAssert <Button>("Button", "Command",
                                                           "{b:DXCommand Execute='Do3(@s.Tag.Parameter, @parameter);', CanExecute='CanDo3(@s.Tag.CanDo)'}", null, vm);

            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            bt.Tag = new { CanDo = true }; BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            bt.Tag = new { CanDo = true, Parameter = 1 }; BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            bt.CommandParameter = 1; BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(true, BindingTestHelper.CanDoCommand(bt));
            BindingTestHelper.DoCommand(bt);
            Assert.AreEqual(2, vm.Do3Value);
        }
        public void NewOperator()
        {
            var vm = new CommandTests_b();
            var bt = BindingTestHelper.BindAssert <Button>(
                "Button", "Command",
                @"{b:DXCommand 
                    Execute='Do(@s.Margin);', 
                    CanExecute='new $Thickness(@s.Margin.Bottom).Left == 1'}",
                null, vm);

            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(0, vm.DoubleProp);

            bt.Margin = new Thickness(1, 0, 0, 0); BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(false, BindingTestHelper.CanDoCommand(bt));
            Assert.AreEqual(0, vm.DoubleProp);

            bt.Margin = new Thickness(1, 0, 0, 1); BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(true, BindingTestHelper.CanDoCommand(bt));
            BindingTestHelper.DoCommand(bt); BindingTestHelper.DoEvents(bt);
            Assert.AreEqual(1, vm.DoubleProp);
        }