コード例 #1
0
        public void RuleParser_SeparateModuleRepresentations_ValidInputTest(string input,
                                                                            string[] expectedOutputContent)
        {
            //Prepare output to format used in method return value
            var expectedOutput = new List <Tuple <string, string> >();

            for (int i = 0; i < expectedOutputContent.Length; i += 2)
            {
                expectedOutput.Add(new Tuple <string, string>(expectedOutputContent[i], expectedOutputContent[i + 1]));
            }
            if (expectedOutputContent.Length % 2 == 1)
            {
                expectedOutput.Add(new Tuple <string, string>(expectedOutputContent[expectedOutputContent.Length - 1], null));
            }


            var parser = new ModuleParser <int>(new IntExpressionParserFactory());

            var output = parser.SeparateModulesRepresentations(input);


            Assert.That(output, Is.EqualTo(expectedOutput));
        }
コード例 #2
0
        public void RuleParser_SeparateModuleRepresentations_ExceptionTest(string input)
        {
            var parser = new ModuleParser <int>(new IntExpressionParserFactory());

            Assert.Throws <ParserException>(() => parser.SeparateModulesRepresentations(input));
        }