AppHarbor.Tests.CommandDispatcherTest.ShouldThrowDispatcherExceptionOnApiException C# (CSharp) Method

ShouldThrowDispatcherExceptionOnApiException() private method

private ShouldThrowDispatcherExceptionOnApiException ( string commandArgument, [ typeNameMatcher, [ kernel, Mock command, CommandDispatcher commandDispatcher ) : void
commandArgument string
typeNameMatcher [
kernel [
command Mock
commandDispatcher CommandDispatcher
return void
        public void ShouldThrowDispatcherExceptionOnApiException(
			string commandArgument,
			[Frozen]Mock<ITypeNameMatcher> typeNameMatcher,
			[Frozen]Mock<IKernel> kernel,
			Mock<FooCommand> command,
			CommandDispatcher commandDispatcher)
        {
            typeNameMatcher.Setup(x => x.IsSatisfiedBy(commandArgument)).Returns(true);
            typeNameMatcher.Setup(x => x.GetMatchedType(It.IsAny<string>())).Returns(FooCommandType);
            kernel.Setup(x => x.Resolve(FooCommandType)).Returns(command.Object);

            command.Setup(x => x.Execute(new string[0])).Throws<ApiException>();

            Assert.Throws<DispatchException>(() => commandDispatcher.Dispatch(new string[] { commandArgument }));
        }