/// <summary>
        /// Program Starting Point.
        /// </summary>
        /// <param name="args">System starting Inputs.</param>
        public static void Main(string[] args)
        {
            var filePath = string.Empty;

            Console.WriteLine(Constants.WelComeMessage);

            if (args.Length == 0)
            {
                Console.WriteLine(Constants.RequestFilePath);
                filePath = Console.ReadLine();
            }
            else
            {
                filePath = args[0];
            }

            try
            {
                GeneratePreRecs(filePath);

                var answers = _communicationProcessor.ProcessInputs();

                foreach (var answer in answers)
                {
                    Console.WriteLine(answer);
                }
            }
            catch (InvalidFileNameInputException ex)
            {
                Console.WriteLine(Constants.InvalidFilePath, ex.Message);
            }
            catch (ArgumentNullException ex)
            {
                Console.WriteLine(Constants.ArgumentNullException, ex.ParamName);
            }
            catch (EmptyInputException ex)
            {
                Console.WriteLine(ex.Message);
            }
            catch (Exception ex)
            {
                Console.WriteLine(Constants.Error, ex.Message);
            }

            Console.ReadLine();
        }
Beispiel #2
0
        public void ProcessInputsTests()
        {
            var expected = new List <string>
            {
                " mtt mtt mtt ctt mtt dtt dtt dtt ctt dtt ctt ctt ctt xtt ctt ltt ltt ltt xtt ltt xtt xtt xtt itt xtt vtt vtt vtt itt vtt itt itt itt  is 6441",
                " xtt ltt vtt itt Metal  is 460 Credits",
                " ctt ctt ctt xtt ctt xtt ltt TestMetal  is 4300 Credits",
                " AnotherTestMetal  is 20 Credits"
            };

            var actual = _communicationProcessor.ProcessInputs();

            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Count, actual.Count);

            foreach (var ans in expected)
            {
                Assert.IsTrue(actual.Contains(ans));
            }
        }