Пример #1
0
        static void Main(string[] args)
        {
            IWarehouseStateParser parser = WarehouseStateParserFactory.Create(WarehouseStateParserType.SplitBased);
            string line;

            while ((line = Console.ReadLine()) != null)
            {
                parser.ParseLine(line);
            }

            var parsingResult = parser.GetResult();

            var    raportGenerator = new TextRaportGenerator();
            string raport          = raportGenerator.Generate(parsingResult);

            Console.WriteLine(raport);
        }
Пример #2
0
        private void TestParsingAndReporting(string testCaseName, WarehouseStateParserType parserType)
        {
            IWarehouseStateParser parser = WarehouseStateParserFactory.Create(parserType);
            string input          = LoadResource(testCaseName + ".in");
            string expectedOutput = LoadResource(testCaseName + ".out");

            string[] inputLines = input.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);

            foreach (var line in inputLines)
            {
                parser.ParseLine(line);
            }

            var parsingResult = parser.GetResult();

            var    raportGenerator = new TextRaportGenerator();
            string output          = raportGenerator.Generate(parsingResult);

            AssertExt.AreEquivalent(expectedOutput, output);
        }