public void Should_get_command_type()
        {
            var resolver = new DefaultContentTypeMapper("cedar.tests", new[] {typeof (CommandTypeResolverTests)});

            Type commandType = resolver.GetFromContentType(@"application/vnd.cedar.tests.commandtyperesolvertests+json");

            commandType.Should().NotBeNull();
        }
        public CommandHandlingFixture()
        {
            const string vendor = "vendor";

            var handlerModule = new TestHandlerModule();
           
            var commandTypeFromContentTypeResolver = new DefaultContentTypeMapper(
                vendor,
                new[]
                {
                    typeof (TestCommand),
                    typeof (TestCommandWithoutHandler),
                    typeof (TestCommandWhoseHandlerThrows)
                });
            var options = new DefaultHandlerSettings(handlerModule, commandTypeFromContentTypeResolver);
            _midFunc = CommandHandlingMiddleware.HandleCommands(options);
            _messageExecutionSettings = new CommandExecutionSettings(vendor);
        }
        public QueryHandlingFixture()
        {
            const string vendor = "vendor";

            var handlerModule = new TestHandlerModule();
           
            var queryTypeFromContentTypeResolver = new DefaultContentTypeMapper(
                vendor,
                new[]
                {
                    typeof (TestQuery),
                    typeof (TestQueryWithoutHandler),
                    typeof (TestQueryWhoseHandlerThrows),
                    typeof(TestQueryResponse)
                });
            var options = new DefaultHandlerSettings(handlerModule, queryTypeFromContentTypeResolver);
            _midFunc = QueryHandlingMiddleware.HandleQueries(options);
            _messageExecutionSettings = new QueryExecutionSettings(vendor);
        }
        public void When_command_is_unknown_then_should_return_null()
        {
            var sut = new DefaultContentTypeMapper("vendor", Enumerable.Empty<Type>());

            sut.GetFromContentType("unknown").Should().BeNull();
        }