public void ViewModelBase_GetCommandC_Test8() { var vm = new MockViewModel(); var commandInvoked = false; var cmd1 = vm.InvokeGetCommandC("Test", () => commandInvoked = true); var cmd2 = vm.InvokeGetCommandC("Test", () => commandInvoked = true); var cmd3 = vm.Test; Assert.AreSame(cmd1, cmd2); Assert.AreSame(cmd1, cmd3); Assert.IsFalse(commandInvoked); }
public void ViewModelBase_GetCommandC_Test7() { var vm = new MockViewModel(); var commandInvoked = false; var cmd = vm.InvokeGetCommandC("Test", () => commandInvoked = true); var commandAssert = new CommandEventAssert(cmd); cmd.OnCanExecuteChanged(); commandAssert.ExpectNothing(); Assert.IsFalse(commandInvoked); }
public void ViewModelBase_GetCommandC_Test5() { var vm = new MockViewModel(); var commandInvoked = false; ICommand cmd = vm.InvokeGetCommandC("Test", () => commandInvoked = true); Assert.IsFalse(commandInvoked); Assert.IsTrue(cmd.CanExecute("X")); //No type-case exception because this always returns true }
public void ViewModelBase_GetCommandC_Test4() { var vm = new MockViewModel(); try { vm.InvokeGetCommandC("Test", null); Assert.Fail("Expected an exception"); } catch (ArgumentNullException ex) { Assert.AreEqual("command", ex.ParamName); } }
public void ViewModelBase_GetCommandC_Test3() { var vm = new MockViewModel(); try { vm.InvokeGetCommandC(null, () => { }); Assert.Fail("Expected an exception"); } catch (ArgumentNullException ex) { Assert.AreEqual("propertyName", ex.ParamName); } }
public void ViewModelBase_GetCommandC_Test1() { var vm = new MockViewModel(); var commandInvoked = false; var cmd = vm.InvokeGetCommandC("Test", () => commandInvoked = true); Assert.IsFalse(commandInvoked); Assert.IsTrue(cmd.CanExecute()); Assert.IsFalse(commandInvoked); cmd.Execute(); Assert.IsTrue(commandInvoked); }