public async Task Can_dispatch() { var module = new TestCommandHandlerModule(); var resolver = new CommandHandlerResolver(module); await resolver.Dispatch(Guid.NewGuid(), new Command()); module.Counter.Should().Be(1); }
public void Can_resolve_handler() { var module = new TestCommandHandlerModule(); var resolver = new CommandHandlerResolver(module); Handler <CommandMessage <Command> > handler = resolver.Resolve <Command>(); handler.Should().NotBeNull(); }
public CommandHandlingFixture() { var module = CreateCommandHandlerModule(); var handlerResolver = new CommandHandlerResolver(module); var commandHandlingSettings = new CommandHandlingSettings(handlerResolver) { MapProblemDetailsFromException = CreateProblemDetails }; _midFunc = CommandHandlingMiddleware.HandleCommands(commandHandlingSettings); }
public CommandHandlingFixture() { var module = CreateCommandHandlerModule(); var handlerResolver = new CommandHandlerResolver(module); CommandMediaTypeMap = new CommandMediaTypeMap(new CommandMediaTypeWithQualifierVersionFormatter()) { { typeof(Command).Name.ToLowerInvariant(), typeof(Command) }, { typeof(CommandThatThrowsStandardException).Name.ToLowerInvariant(), typeof(CommandThatThrowsStandardException) }, { typeof(CommandThatThrowsProblemDetailsException).Name.ToLowerInvariant(), typeof(CommandThatThrowsProblemDetailsException) }, { typeof(CommandThatThrowsMappedException).Name.ToLowerInvariant(), typeof(CommandThatThrowsMappedException) }, { typeof(CommandThatThrowsCustomProblemDetailsException).Name.ToLowerInvariant(), typeof(CommandThatThrowsCustomProblemDetailsException) } }; var commandHandlingSettings = new CommandHandlingSettings(handlerResolver, CommandMediaTypeMap) { MapProblemDetailsFromException = CreateProblemDetails }; _midFunc = CommandHandlingMiddleware.HandleCommands(commandHandlingSettings); }