Exemple #1
0
        public void TextIsWrittenRevert()
        {
            var many = new Many(new Text("ab"), 1);

            Assert.False(many.Match("baba").IsSuccesful());
            Assert.Equal("baba", many.Match("baba").RemainingText());
        }
Exemple #2
0
        public void CheckForAnCorrectInput()
        {
            var many = new Many(new Range('0', '9'));

            Assert.True(many.Match("123abc").IsSuccesful());
            Assert.Equal("abc", many.Match("123abc").RemainingText());
        }
Exemple #3
0
        public void CheckIfLastCharIsDouble()
        {
            var many = new Many(new Text("ab"), 1);

            Assert.True(many.Match("abba").IsSuccesful());
            Assert.Equal("ba", many.Match("abba").RemainingText());
        }
Exemple #4
0
        public void CheckMinAppearances()
        {
            var many = new Many(new Text("12"), 3);

            Assert.True(many.Match("12121212").IsSuccesful());
            Assert.Equal("", many.Match("12121212").RemainingText());
        }
Exemple #5
0
        public void FailForMinAppareance()
        {
            var many = new Many(new Any("012"), 3);

            Assert.False(many.Match("1234").IsSuccesful());
            Assert.Equal("1234", many.Match("1234").RemainingText());
        }
Exemple #6
0
        public void CheckMaxAppearances()
        {
            var many = new Many(new Any("abc"), 0, 4);

            Assert.True(many.Match("aabcc").IsSuccesful());
            Assert.Equal("c", many.Match("aabcc").RemainingText());
        }
Exemple #7
0
        public void CheckForAnEmptyString()
        {
            var many = new Many(new Character('a'));

            Assert.True(many.Match("").IsSuccesful());
            Assert.Equal("", many.Match("").RemainingText());
        }
Exemple #8
0
        public void CheckForClassAnyIfHaveAllCharInInput()
        {
            var many = new Many(new Any("abc"));

            Assert.Equal("", many.Match("abc").RemainingText());
            Assert.Equal("12ab", many.Match("abc12ab").RemainingText());
        }
Exemple #9
0
        public void CheckForIfPassForMoreTextClass()
        {
            var many = new Many(new Text("ab"));

            Assert.Equal("xy", many.Match("ababxy").RemainingText());
            Assert.Equal("12ab", many.Match("abab12ab").RemainingText());
        }
Exemple #10
0
        public void CheckForEqualTextIfIsCorect()
        {
            var many = new Many(new Range('0', '9'));

            Assert.Equal("abc", many.Match("12345abc").RemainingText());
            Assert.Equal("xyz123abc", many.Match("xyz123abc").RemainingText());
        }