コード例 #1
0
        public void Should_ReadDefinition_ReturnTheRigthSetOfDefinitions_WhenInputFileIsCorrect()
        {
            // Given
            var sessionDefinition = new SessionDefinition("Title #1", 45);

            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.FromResult(sessionDefinition));

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

            // When
            var result = reader.ReadDefinition();

            // Then
            result.Should()
            .NotBeNull()
            .And.HaveCount(1)
            .And.Contain(sessionDefinition);
        }
コード例 #2
0
        public void Should_FromResult_ReturnTrueMatchFlagAndResult()
        {
            // Given
            var sessionDefinition = new SessionDefinition("Title", 15);

            // When
            var result = ParsingResult.FromResult(sessionDefinition);

            // Then
            result.Should().NotBeNull();
            result.IsMatched.Should().Be(true);
            result.SessionDefinition.ShouldBeEquivalentTo(sessionDefinition);
        }