public void NoParameter() { var control = new Control(); var command = CommandBinding.CreateCommand(control, "Do()"); command.Execute(null); Assert.AreEqual("<NULL>", control.Do_Argument); }
public void InvalidParameter() { var control = new Control(); var command = CommandBinding.CreateCommand(control, "Do(Blabla)"); command.Execute(null); Assert.AreEqual("Blabla", control.Do_Argument); }
public void OverloadsWithDifferentTypesButObjectArgument() { var control = new Control { DirectObject = new OverloadType2(), }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(DirectObject)"); command.Execute(null); Assert.AreEqual(new OverloadType2().ToString(), control.Do_Argument); }
public void IndirectPropertySecondDegreeOfNullOfControlAsParameter() { var control = new Control { DataContext = null }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(DataContext.Nested.AmbiguousProperty1)"); command.Execute(null); Assert.AreEqual("<NULL1>", control.Do_Argument); }
public void IndirectPropertyOfNullOfControlAsParameter() { var control = new Control { DataContext = null }; var command = CommandBinding.CreateCommand(control, "Do(DataContext.Input)"); command.Execute(null); Assert.AreEqual("<NULL>", control.Do_Argument); }
public void DirectPropertyOfControlAsObjectParameter() { var control = new Control { AmbiguousProperty2 = new OverloadType2(), }; var command = CommandBinding.CreateCommand(control, "DoObject(AmbiguousProperty2)"); command.Execute(null); Assert.AreEqual(new OverloadType2().ToString(), control.Do_Argument); }
public void DirectPropertyOfControlAsParameter() { var control = new Control { DirectProperty1 = "direct", }; var command = CommandBinding.CreateCommand(control, "Do(DirectProperty1)"); command.Execute(null); Assert.AreEqual("direct", control.Do_Argument); }
public void ContextParameter() { var control = new Control(); var command = CommandBinding.CreateCommand(control, "DoObjects(sender,sender.Input)", new Dictionary <string, object> { { "sender", new ViewModel { Input = "blabla" } } }); command.Execute(null); Assert.AreEqual(new ViewModel().ToString(), control.Do_Argument); Assert.AreEqual("blabla", control.Do_Argument2); }
public void IndirectPropertyOfControlAsParameter() { var control = new Control { DataContext = new ViewModel { Input = "nested" } }; var command = CommandBinding.CreateCommand(control, "Do(DataContext.Input)"); command.Execute(null); Assert.AreEqual("nested", control.Do_Argument); }
public void OverloadsWithIndirectParameterOfDifferentTypesButNull() { var control = new Control { Nested = null }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(Nested.AmbiguousProperty2)"); command.Execute(null); Assert.AreEqual("<NULL2>", control.Do_Argument); command = CommandBinding.CreateCommand(control, "DoAmbiguous(Nested.AmbiguousProperty1)"); command.Execute(null); Assert.AreEqual("<NULL1>".ToString(), control.Do_Argument); }
public void OverloadsWithDifferentTypesButNullAndInteger() { var control = new Control { AmbiguousProperty1 = null, AmbiguousProperty2 = null, }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty2, 123)"); command.Execute(null); Assert.AreEqual("<NULL2>_123", control.Do_Argument); command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty1, 321)"); command.Execute(null); Assert.AreEqual("<NULL1>_321", control.Do_Argument); }
public void OverloadsWithDifferentTypesAndInteger() { var control = new Control { AmbiguousProperty1 = new OverloadType1(), AmbiguousProperty2 = new OverloadType2(), }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty2, 123)"); command.Execute(null); Assert.AreEqual(new OverloadType2().ToString() + "_123", control.Do_Argument); command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty1, 321)"); command.Execute(null); Assert.AreEqual(new OverloadType1().ToString() + "_321", control.Do_Argument); }
public void OverloadsWithDifferentTypesButNull() { var control = new Control { AmbiguousProperty1 = null, AmbiguousProperty2 = null, }; var command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty2)"); command.Execute(null); Assert.AreEqual("<NULL2>", control.Do_Argument); command = CommandBinding.CreateCommand(control, "DoAmbiguous(AmbiguousProperty1)"); command.Execute(null); Assert.AreEqual("<NULL1>".ToString(), control.Do_Argument); }