public void When_using_e2e_parser_configuration_should_return_correct_parser(string message, Type expectedParserType)
        {
            ServiceProvider serviceProvider = new ServiceCollection()
                                              .AddLogging()
                                              .AddParsers()
                                              .BuildServiceProvider();

            _sut = (DefaultParserFactory)serviceProvider.GetRequiredService <IParserFactory>();

            // Act
            IMessageParser actual = _sut.GetParser(message);

            // Assert
            actual.Should().BeOfType(expectedParserType);
        }
        public void SetUp()
        {
            _dummyParserMock = new Mock <IMessageParser>();

            _serviceProvider = new ServiceCollection()
                               .AddSingleton(_dummyParserMock.Object.GetType(), _dummyParserMock.Object)
                               .BuildServiceProvider();

            _parserMatcherMock = new Mock <IParserMatcher>();
            _parserMatcherMock
            .Setup(m => m.Match(It.IsAny <string>()))
            .Returns(new ParserInfo
            {
                Type = _dummyParserMock.Object.GetType()
            });

            _parserMatcherMock
            .Setup(m => m.Match("message-with-no-matching-parser"))
            .Returns((ParserInfo)null);

            _sut = new DefaultParserFactory(_serviceProvider, _parserMatcherMock.Object);
        }