This helper method is designed to make stubbing ICommands simpler.
Do you see any problems with this implementation?
public static ICommand GenerateCommandStub( Action<object> executeAction = null, Func<object, bool> canExecuteFunc = null) { var commandStub = MockRepository.GenerateStub<ICommand>(); commandStub.Stub(command => command.Execute(Arg<object>.Is.Anything)) .Do(executeAction ?? (_ => { })); commandStub.Stub(command => command.CanExecute(Arg<object>.Is.Anything)) .Do(canExecuteFunc ?? (_ => true)); return commandStub; }