public void ViewModelBase_GetCommandA_Test8() { var vm = new MockViewModel(); var commandInvoked = false; var cmd1 = vm.InvokeGetCommandA <int>("Test", x => commandInvoked = true); var cmd2 = vm.InvokeGetCommandA <int>("Test", x => commandInvoked = true); var cmd3 = vm.Test; Assert.AreSame(cmd1, cmd2); Assert.AreSame(cmd1, cmd3); Assert.IsFalse(commandInvoked); }
public void ViewModelBase_GetCommandA_Test7() { var vm = new MockViewModel(); var commandInvoked = false; var cmd = vm.InvokeGetCommandA <int>("Test", x => commandInvoked = true); var commandAssert = new CommandEventAssert(cmd); cmd.OnCanExecuteChanged(); commandAssert.ExpectNothing(); Assert.IsFalse(commandInvoked); }
public void ViewModelBase_GetCommandA_Test4() { var vm = new MockViewModel(); try { vm.InvokeGetCommandA <int>("Test", null); Assert.Fail("Expected an exception"); } catch (ArgumentNullException ex) { Assert.AreEqual("command", ex.ParamName); } }
public void ViewModelBase_GetCommandA_Test3() { var vm = new MockViewModel(); try { vm.InvokeGetCommandA <int>(null, x => { }); Assert.Fail("Expected an exception"); } catch (ArgumentNullException ex) { Assert.AreEqual("propertyName", ex.ParamName); } }
public void ViewModelBase_GetCommandA_Test1() { var vm = new MockViewModel(); var commandInvoked = false; var cmd = vm.InvokeGetCommandA <int>("Test", x => commandInvoked = true); Assert.IsFalse(commandInvoked); Assert.IsTrue(cmd.CanExecute(0)); Assert.IsFalse(commandInvoked); cmd.Execute(0); Assert.IsTrue(commandInvoked); }
public void ViewModelBase_GetCommandA_Test6() { var vm = new MockViewModel(); var commandInvoked = false; ICommand cmd = vm.InvokeGetCommandA <int>("Test", x => commandInvoked = true); Assert.IsFalse(commandInvoked); try { cmd.Execute("X"); Assert.Fail("Expected an exception"); } catch (ArgumentException) { //OK } }