static void Main(string[] args)
        {
            //Show error message if all arguments are not passed.
            if (args.Length < 2)
            {
                Console.WriteLine(Constants.Messages.INVALID_ARGS);
                return;
            }
            //Try to obtain source instance based on input source type.
            IProductSource source = ProductSourceFactory.GetProductSource(args[0].ToLower());

            if (source != null)
            {
                //Try to parse the input file, and display contents or error if parsing fails.
                try
                {
                    source.ParseFile(args[1]);
                }
                catch (Exception ex)
                {
                    Console.WriteLine(Constants.Messages.PARSE_FAILED + ex.Message);
                }
            }
            //Specified source not found/implemented.
            else
            {
                Console.WriteLine(Constants.Messages.INVALID_SOURCE);
            }
        }
Exemple #2
0
 public void IsAbleToParseSoftwareAdviceFile()
 {
     softwareAdvice.ReadFile(Arg.Any <string>()).ReturnsForAnyArgs(softwareAdviceContent);
     softwareAdvice.ParseFile(null);
     Assert.IsTrue(true);
 }
Exemple #3
0
 public void IsAbleToParseCapterraFile()
 {
     capterra.ReadFile(Arg.Any <string>()).ReturnsForAnyArgs(capterraContent);
     capterra.ParseFile(null);
     Assert.IsTrue(true);
 }