Exemplo n.º 1
0
        public void ParseFunctions_IgnoreCommentsAndBlankLines_ThrowsOnNullParseContext()
        {
            // Arrange
            ParseContext nullParseContext = null;

            Task next() => Task.CompletedTask;

            // Act
            ParseFunctions.IgnoreCommentsAndBlankLines(nullParseContext, next).Wait();
        }
Exemplo n.º 2
0
        public void ParseFunctions_IgnoreCommentsAndBlankLines_ThrowsOnNullNextFunction()
        {
            // Arrange
            var reader  = new StreamReader(new MemoryStream());
            var state   = new object();
            var context = new ParseContext(reader, state);

            Func <Task> nullNextFunction = null;

            // Act
            ParseFunctions.IgnoreCommentsAndBlankLines(context, nullNextFunction).Wait();
        }
Exemplo n.º 3
0
        public void ParseFunctions_IgnoreCommentsAndBlankLines_CallsNextForNonCommentNonWhiteSpaceValues()
        {
            // Arrange
            var reader  = new StreamReader(new MemoryStream());
            var state   = new object();
            var context = new ParseContext(reader, state)
            {
                Input = "Lorem ipsum"
            };

            var numCallsMadeToNextFunction = 0;

            Task next()
            {
                numCallsMadeToNextFunction++;
                return(Task.CompletedTask);
            }

            // Act
            ParseFunctions.IgnoreCommentsAndBlankLines(context, next).Wait();

            // Assert
            Assert.AreEqual(1, numCallsMadeToNextFunction);
        }
Exemplo n.º 4
0
        public void ParseFunctions_IgnoreCommentsAndBlankLines_DoesNotCallNextOnEmptyString()
        {
            // Arrange
            var reader  = new StreamReader(new MemoryStream());
            var state   = new object();
            var context = new ParseContext(reader, state)
            {
                Input = string.Empty
            };

            var numCallsMadeToNextFunction = 0;

            Task next()
            {
                numCallsMadeToNextFunction++;
                return(Task.CompletedTask);
            }

            // Act
            ParseFunctions.IgnoreCommentsAndBlankLines(context, next).Wait();

            // Assert
            Assert.AreEqual(0, numCallsMadeToNextFunction);
        }