Example #1
0
        public void TestEmpty()
        {
            Regex expression = new Regex("^[a-z]+$");

            string line = string.Empty;

            LineMatcher matcher = new LineMatcher(expression);

            IList<ColumnMatch> results = matcher.Match(line).ToList();

            Assert.AreEqual(0, results.Count());
        }
Example #2
0
        public void TestDoesNotMatchLine()
        {
            Regex expression = new Regex("^[a-z]+$");

            const string line = "abc1";

            LineMatcher matcher = new LineMatcher(expression);

            IList<ColumnMatch> results = matcher.Match(line).ToList();

            Assert.AreEqual(0, results.Count());
        }
Example #3
0
        public void TestMatchesEntireLine()
        {
            Regex expression = new Regex("^[a-z]+$");

            const string line = "abc";

            LineMatcher matcher = new LineMatcher(expression);

            IList<ColumnMatch> results = matcher.Match(line).ToList();

            Assert.AreEqual(1, results.Count());

            Assert.AreEqual(0, results[0].Column);
            Assert.AreEqual(3, results[0].Length);
        }
Example #4
0
        public void TestNull()
        {
            Regex expression = new Regex("^[a-z]+$");

            LineMatcher matcher = new LineMatcher(expression);

            Assert.Throws<ArgumentNullException>(() => matcher.Match(null));
        }