Example #1
0
        public void FailsOnUnexpectedItem()
        {
            var parser = new UnorderedParser <string>(UnorderedParsingMode.FullSet, a, b, c);

            parser
            .FailsToParse(Tokenize("abX"))
            .FailureMessages
            .ToString()
            .ShouldBe("c expected");

            parser
            .FailsToParse(Tokenize("abX"))
            .FailureMessages
            .ToString()
            .ShouldBe("c expected");

            parser
            .FailsToParse(Tokenize("aXb"))
            .FailureMessages
            .ToString()
            .ShouldBe("b or c expected");

            parser
            .FailsToParse(Tokenize("Xab"))
            .FailureMessages
            .ToString()
            .ShouldBe("a, b or c expected");
        }
Example #2
0
        public void FailsOnMissingItemSeparated()
        {
            var parser = new UnorderedParser <string>(separator, UnorderedParsingMode.FullSet, a, b, c, d);

            foreach (var input in GetPermutationsSeparated("abc"))
            {
                parser.FailsToParse(Tokenize(input))
                .FailureMessages
                .ToString()
                .ShouldBe(", expected");
            }
        }