public void GivenSimpleCommandParams_WhenInvokingCommand3Times_ThenItExecute3Action() { TEST_OUTPUT = String.Empty; paramsCommandRelayerSubject = new RelayCommand <object>(s => TEST_OUTPUT += s as string); ; for (int i = 0; i < 3; i++) { ParamCommand.Execute("5"); } Assert.Equal("555", TEST_OUTPUT); }
public void GivenSimpleCommandParamsAndCanExec_WhenInvokingCommand_ThenItExecuteBasedOnOutsideState() { string expected = "MODIFIED"; TEST_OUTPUT = "NOT_MODIFIED"; bool canExecute = false; paramsCommandRelayerSubject = new RelayCommand <object>(s => TEST_OUTPUT = s as string, s => { return(canExecute); }); if (ParamCommand.CanExecute(null)) { ParamCommand.Execute(expected); } Assert.NotEqual(expected, TEST_OUTPUT); canExecute = true; if (ParamCommand.CanExecute(null)) { ParamCommand.Execute(expected); } Assert.Equal(expected, TEST_OUTPUT); }