Пример #1
0
        public void Should_FromNoMatch_ReturnFalseMatchFlagAndResult()
        {
            // Given

            // When
            var result = ParsingResult.FromNoMatch();

            // Then
            result.Should().NotBeNull();
            result.IsMatched.Should().Be(false);
            result.SessionDefinition.Should().BeNull();
        }
Пример #2
0
        public void Should_ReadDefinition_ThrowProperException_WhenInputFileIsNotCorrect()
        {
            // Given
            var inputReader = Substitute.For <IFileInputReader>();

            inputReader.ReadContent(Arg.Any <string>()).Returns(new[] { "sample" });

            var inputOptionAccessor = Substitute.For <IOptions <InputOptions> >();

            inputOptionAccessor.Value.Returns(new InputOptions());

            var parser = Substitute.For <ISessionDefinitionParser>();

            parser.Parse(Arg.Any <string>()).Returns(ParsingResult.FromNoMatch());

            var reader = new SessionDefinitionReader(inputReader, inputOptionAccessor, new[] { parser });

            // When
            Action action = () => reader.ReadDefinition();

            // Then
            action.ShouldThrow <ParsingException>();
        }