示例#1
0
        private void TestSumIDs(string jsonInput, int expectedSum)
        {
            var menuLoader    = new JsonMenuLoaderFactory().GetJsonMenuLoader(jsonInput);
            var menuContainer = menuLoader.LoadJsonMenu(jsonInput);
            var actualSum     = new MenuCalculationSumIDs().Calculate(menuContainer.FirstOrDefault()?.menu);

            Assert.AreEqual(actualSum, expectedSum);
        }
        static void Main(string[] args)
        {
            //read input
            var fileURI       = args[0];
            var jsonLoader    = new JsonMenuLoaderFactory().GetJsonMenuLoader(fileURI);
            var menuContainer = jsonLoader.LoadJsonMenu(fileURI);

            //define action
            var menuIDCalculator = new MenuCalculationSumIDs();

            //act
            foreach (var parentMenu in menuContainer)
            {
                Console.WriteLine(menuIDCalculator.Calculate(parentMenu.menu));
            }

            Console.ReadKey();
        }