Example #1
0
        public void TestEndRule()
        {
            var rule = new StringRule("test") + new EndRule();

            Assert.IsTrue(rule.Match("test"));
            Assert.IsFalse(rule.Match("tes"));
        }
Example #2
0
        public void TestOrUsingOperatorRule()
        {
            var rule = new StringRule("cat") | new StringRule("dog");

            Assert.IsFalse(rule.Match("something"));
            Assert.IsFalse(rule.Match("fishcatdog"));
            Assert.IsTrue(rule.Match("catfish"));
            Assert.IsTrue(rule.Match("dogfish"));
        }
Example #3
0
        public void TestStringCaseInsensitiveRule()
        {
            var rule = new StringRule("Test", true);

            Assert.IsTrue(rule.Match("Test"));
            Assert.IsTrue(rule.Match("Test123"));
            Assert.IsTrue(rule.Match("test123"));
            Assert.IsFalse(rule.Match("Failing Test"));
        }
Example #4
0
        public void TestStringRule()
        {
            var rule = new StringRule("Test");

            Assert.IsTrue(rule.Match("Test"));
            Assert.IsTrue(rule.Match("Test123"));
            Assert.IsFalse(rule.Match("test123"));
            Assert.IsFalse(rule.Match("Failing Test"));
        }
Example #5
0
        public void TestSequenceUsingOperatorRule()
        {
            var rule = new StringRule("cat") + new StringRule("fish");

            Assert.IsFalse(rule.Match("catsomething"));
            Assert.IsFalse(rule.Match("fishcat"));
            Assert.IsTrue(rule.Match("catfish"));
            Assert.IsTrue(rule.Match("catfish something"));
        }