Ejemplo n.º 1
0
        public void TestIfGoMissing(string input)
        {
            var source = new LinesSource(new[] { string.Empty });
            var reader = source.CreateReader();

            Assert.IsNotNull(reader);
            var tokenSearcher = new GoSearcher();
            var result        = tokenSearcher.Find(reader);

            Assert.IsNull(result);
        }
Ejemplo n.º 2
0
        public void TestIfGoMissingIfReaderNotAtBeginOfLine()
        {
            var source = new LinesSource(new[] { " GO" });
            var reader = source.CreateReader();

            Assert.IsNotNull(reader);
            reader = reader.Advance(1);
            Assert.IsNotNull(reader);
            var tokenSearcher = new GoSearcher();
            var result        = tokenSearcher.Find(reader);

            Assert.IsNull(result);
        }
Ejemplo n.º 3
0
        public void TestIfGoExists(string input, string expected, int expectedCount)
        {
            var source = new LinesSource(new[] { input });
            var reader = source.CreateReader();

            Assert.IsNotNull(reader);
            var tokenSearcher = new GoSearcher();
            var result        = tokenSearcher.Find(reader);

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Index);
            Assert.AreEqual(input.Length, result.Length);
            Assert.AreEqual(expected, result.Token);
            Assert.IsInstanceOf <GoSearcher.GoSearcherParameters>(result.Opaque);
            var goParams = (GoSearcher.GoSearcherParameters)result.Opaque;

            Assert.NotNull(goParams);
            Assert.AreEqual(expectedCount, goParams.Count);
        }