Пример #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());
        }
Пример #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());
        }
Пример #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());
        }
Пример #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());
        }
Пример #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());
        }
Пример #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());
        }
Пример #7
0
        public void CheckForAnEmptyString()
        {
            var many = new Many(new Character('a'));

            Assert.True(many.Match("").IsSuccesful());
            Assert.Equal("", many.Match("").RemainingText());
        }
Пример #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());
        }
Пример #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());
        }
Пример #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());
        }