Ejemplo n.º 1
0
        public void UseDefaultCanExecuteFunction_Test()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation2", source);
            Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
        }
Ejemplo n.º 2
0
        public void ExecuteCommand_Test00()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation2", source);
            ClickButton();
            Assert.AreEqual("Operation2", source.ExecuteResult);
        }
Ejemplo n.º 3
0
        public void UseDataContextIfSourceNotSpecified_Test01()
        {
            var source = new FCBObject();

            Window.DataContext = source;
            PrepareBehavior("Command", "Operation2");
            Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
        }
 public void UseDataContextIfSourceNotSpecified_Test02() {
     var source = new FCBObject();
     Window.DataContext = source;
     FCBButton wce = new FCBButton();
     Window.Content = wce;
     PrepareBehavior("Command", "Operation2", null, null, null, false);
     Interaction.GetBehaviors(wce).Add(Behavior);
     Assert.IsNotNull(wce.Command);
 }
Ejemplo n.º 5
0
        public void UseDataContextIfSourceNotSpecified_Test03()
        {
            var       source = new FCBObject();
            FCBButton wce    = new FCBButton();

            wce.DataContext = source;
            Window.Content  = wce;
            PrepareBehavior("Command", "Operation2", null, null, null, false);
            Interaction.GetBehaviors(wce).Add(Behavior);
            Assert.IsNotNull(wce.Command);
        }
Ejemplo n.º 6
0
        public void UseMethodDefaultParamsIfCommandParameterEmpty_Test00()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation5", source, null, null);
            Assert.IsNull(source.CanExecuteResult);
            Assert.IsTrue(Button.IsEnabled);
            Assert.IsNull(Button.CommandParameter);
            ClickButton();
            Assert.AreEqual("7", source.ExecuteResult);
        }
Ejemplo n.º 7
0
        public void SetTargetProperty_Test01()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation4", source);
            Assert.IsNotNull(Button.Command);
            Assert.IsNotNull(Button.CommandParameter);
            Interaction.GetBehaviors(Button).Remove(Behavior);
            Assert.IsNull(Button.Command);
            Assert.IsNull(Button.CommandParameter);
        }
Ejemplo n.º 8
0
        public void UseCustomCanExecuteFunction_Test()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation2", source, "CanExecutePublic");
            Behavior.Arg1 = false;
            Assert.AreEqual("CanExecutePublic", source.CanExecuteResult);
            Assert.IsFalse(Button.IsEnabled);
            Behavior.Arg1 = true;
            Assert.AreEqual("CanExecutePublic", source.CanExecuteResult);
            Assert.IsTrue(Button.IsEnabled);
        }
Ejemplo n.º 9
0
        public void ExecuteCommand_Test01()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation3", source);
            ClickButton();
            Assert.AreEqual(null, source.ExecuteResult);
            Behavior.Arg1 = "Test";
            Assert.AreEqual(null, source.ExecuteResult);
            ClickButton();
            Assert.AreEqual("Test", source.ExecuteResult);
        }
Ejemplo n.º 10
0
        public void DataContextShouldNotAffectBehaviorResultIfSourceSet_Test()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation2", source);
            Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
            source.ClearResult();
            Assert.IsNull(source.CanExecuteResult);
            Button.DataContext = new FCBObject();
            Assert.IsNull(source.CanExecuteResult);
            Behavior.Source = null;
            Assert.AreEqual("CanExecuteOperation2", (Button.DataContext as FCBObject).CanExecuteResult);
        }
Ejemplo n.º 11
0
        public void SetTargetProperty_Test00()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation4", source, attachToView: false);
            var target = new Button();

            Behavior.Target = target;
            Interaction.GetBehaviors(Button).Add(Behavior);
            Assert.IsNotNull(target.Command);
            Assert.IsNotNull(target.CommandParameter);
            Assert.IsNull(Button.Command);
            Assert.IsNull(Button.CommandParameter);
        }
Ejemplo n.º 12
0
        public void UseMethodDefaultParamsIfCommandParameterEmpty_Test01()
        {
            var       source = new FCBObject();
            FCBButton wce    = new FCBButton();

            wce.DataContext = source;
            Window.Content  = wce;
            PrepareBehavior("Command", "Operation5", null, null, null, false);
            Interaction.GetBehaviors(wce).Add(Behavior);
            Assert.IsNull(source.CanExecuteResult);
            Assert.IsTrue(Button.IsEnabled);
            Assert.IsNull(Button.CommandParameter);
            wce.Command.Execute(null);
            Assert.AreEqual("7", source.ExecuteResult);
        }
Ejemplo n.º 13
0
        public void ExecuteCommand_Test02()
        {
            var source = new FCBObject();

            PrepareBehavior("Command", "Operation4", source);
            ClickButton();
            Assert.AreEqual(null, source.ExecuteResult);
            Behavior.Arg5 = "1";
            ClickButton();
            Assert.AreEqual(null, source.ExecuteResult);
            Behavior.Arg1 = "{0},{1},{2},{3}";
            ClickButton();
            Assert.AreEqual(",,,1", source.ExecuteResult);
            Behavior.Arg3 = "4";
            ClickButton();
            Assert.AreEqual(",4,,1", source.ExecuteResult);
        }
 public void ExecuteCommand_Test00() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation2", source);
     ClickButton();
     Assert.AreEqual("Operation2", source.ExecuteResult);
 }
 public void UseMethodDefaultParamsIfCommandParameterEmpty_Test01() {
     var source = new FCBObject();
     FCBButton wce = new FCBButton();
     wce.DataContext = source;
     Window.Content = wce;
     PrepareBehavior("Command", "Operation5", null, null, null, false);
     Interaction.GetBehaviors(wce).Add(Behavior);
     Assert.IsNull(source.CanExecuteResult);
     Assert.IsTrue(Button.IsEnabled);
     Assert.IsNull(Button.CommandParameter);
     wce.Command.Execute(null);
     Assert.AreEqual("7", source.ExecuteResult);
 }
 public void UseCustomCanExecuteFunction_Test() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation2", source, "CanExecutePublic");
     Behavior.Arg1 = false;
     Assert.AreEqual("CanExecutePublic", source.CanExecuteResult);
     Assert.IsFalse(Button.IsEnabled);
     Behavior.Arg1 = true;
     Assert.AreEqual("CanExecutePublic", source.CanExecuteResult);
     Assert.IsTrue(Button.IsEnabled);
 }
 public void UseMethodDefaultParamsIfCommandParameterEmpty_Test00() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation5", source, null, null);
     Assert.IsNull(source.CanExecuteResult);
     Assert.IsTrue(Button.IsEnabled);
     Assert.IsNull(Button.CommandParameter);
     ClickButton();
     Assert.AreEqual("7", source.ExecuteResult);
 }
 public void SetTargetProperty_Test02() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation4", source, attachToView: false);
     var target = new Button();
     Behavior.Target = target;
     Interaction.GetBehaviors(Button).Add(Behavior);
     Assert.IsNotNull(target.Command);
     Assert.IsNotNull(target.CommandParameter);
     Assert.IsNull(Button.Command);
     Assert.IsNull(Button.CommandParameter);
     Interaction.GetBehaviors(Button).Remove(Behavior);
     Assert.IsNull(target.Command);
     Assert.IsNull(target.CommandParameter);
 }
 public void ExecuteCommand_Test01() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation3", source);
     ClickButton();
     Assert.AreEqual(null, source.ExecuteResult);
     Behavior.Arg1 = "Test";
     Assert.AreEqual(null, source.ExecuteResult);
     ClickButton();
     Assert.AreEqual("Test", source.ExecuteResult);
 }
 public void UseDataContextIfSourceNotSpecified_Test01() {
     var source = new FCBObject();
     Window.DataContext = source;
     PrepareBehavior("Command", "Operation2");
     Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
 }
 public void UseDefaultCanExecuteFunction_Test() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation2", source);
     Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
 }
 public void DataContextShouldNotAffectBehaviorResultIfSourceSet_Test() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation2", source);
     Assert.AreEqual("CanExecuteOperation2", source.CanExecuteResult);
     source.ClearResult();
     Assert.IsNull(source.CanExecuteResult);
     Button.DataContext = new FCBObject();
     Assert.IsNull(source.CanExecuteResult);
     Behavior.Source = null;
     Assert.AreEqual("CanExecuteOperation2", (Button.DataContext as FCBObject).CanExecuteResult);
 }
 public void SetTargetProperty_Test01() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation4", source);
     Assert.IsNotNull(Button.Command);
     Assert.IsNotNull(Button.CommandParameter);
     Interaction.GetBehaviors(Button).Remove(Behavior);
     Assert.IsNull(Button.Command);
     Assert.IsNull(Button.CommandParameter);
 }
 public void ExecuteCommand_Test02() {
     var source = new FCBObject();
     PrepareBehavior("Command", "Operation4", source);
     ClickButton();
     Assert.AreEqual(null, source.ExecuteResult);
     Behavior.Arg5 = "1";
     ClickButton();
     Assert.AreEqual(null, source.ExecuteResult);
     Behavior.Arg1 = "{0},{1},{2},{3}";
     ClickButton();
     Assert.AreEqual(",,,1", source.ExecuteResult);
     Behavior.Arg3 = "4";
     ClickButton();
     Assert.AreEqual(",4,,1", source.ExecuteResult);
 }