Esempio n. 1
0
        public void CheckForFailMatchRemainingText()
        {
            var sequance = new Sequance(new Any("abc"), new Text("12a"));

            Assert.False(sequance.Match("a12bc").IsSuccesful());
            Assert.Equal("a12bc", sequance.Match("a12bc").RemainingText());
        }
Esempio n. 2
0
        public void CheckAnCorrectInput()
        {
            var sequance = new Sequance(new Character('+'), new Range('0', '9'));

            Assert.True(sequance.Match("+0abc").IsSuccesful());
            Assert.False(sequance.Match("abc").IsSuccesful());
        }
Esempio n. 3
0
        public void CheckForClassText()
        {
            var sequance = new Sequance(new Text("abc"), new Range('0', '9'));

            Assert.True(sequance.Match("abc123").IsSuccesful());
            Assert.Equal("23", sequance.Match("abc123").RemainingText());
        }
Esempio n. 4
0
        public void CheckIfContainJustOneInstance()
        {
            var sequance = new Sequance(new Character('+'), new Range('0', '9'));

            Assert.False(sequance.Match("+abc").IsSuccesful());
            Assert.False(sequance.Match("1abc").IsSuccesful());
        }
Esempio n. 5
0
        public void CheckForAnEmptyString()
        {
            var sequance = new Sequance(new Character('+'), new Range('0', '9'));

            Assert.False(sequance.Match("").IsSuccesful());
            Assert.Equal("", sequance.Match("").RemainingText());
        }
Esempio n. 6
0
        public void CheckForAnEmptyPattern()
        {
            var sequance = new Sequance();

            Assert.True(sequance.Match("1234").IsSuccesful());
            Assert.True(sequance.Match("+abc").IsSuccesful());
            Assert.True(sequance.Match("abcd").IsSuccesful());
        }
Esempio n. 7
0
        public void CheckForASinglePattern()
        {
            var sequance = new Sequance(new Character('+'));

            Assert.True(sequance.Match("+123").IsSuccesful());
            Assert.False(sequance.Match("123").IsSuccesful());
            Assert.Equal("ab", sequance.Match("+ab").RemainingText());
        }