public void ShouldThrowExceptionWhenPreRequisiteCheckContainsError() { _prerequisitesChecker .Stub(x => x.Check(Arg <TestViewModelProviderArgument> .Is.Anything)) .Return(new CheckResult { ContainsError = true, Message = "Error" }); Assert.Throws <ArgumentException>(() => _viewModelFactory.GetViewModel()); }
private CommandResult ExecuteArrangeAndAct( ICommandHandler <BlankSimpleTestCommand> getCommandHandlerRetVal = null, string commandPreHandleResult = "") { _commandHandlerProvider .Stub(x => x.GetCommandHandler <BlankSimpleTestCommand>()) .Return(getCommandHandlerRetVal); _prerequisitesChecker .Stub(x => x.Check(Arg <BlankSimpleTestCommand> .Is.Anything)) .Return(String.IsNullOrEmpty(commandPreHandleResult) ? new CheckResult() : new CheckResult() { ContainsError = true, Message = commandPreHandleResult }); return(_bus.Execute(new BlankSimpleTestCommand())); }