Пример #1
0
        public static void Main(string[] args)
        {
            Parser p = new Parser(args);
            p.parseArgs();

            if(p.Log.HasError){
                Console.WriteLine(p.Log.Message.ToString());
                return;
            }

            Core coreAppli = new Core(p.Line);
            coreAppli.executeCommand();

            if(coreAppli.Log.HasError)
                Console.WriteLine(coreAppli.Log.Message.ToString());
        }
Пример #2
0
        public void Should_Create_File_And_Fill()
        {
            string[] args = new string[] {"get","-url","http://horloge.parlante.online.fr/","-save","C:/bonjour.txt"};
            Parser p = new Parser(args);
            p.parseArgs();

            Core c = new Core(p.Line);
            c.executeCommand();

            Assert.AreEqual(File.Exists(args[4]),true);

            string content;

            using(FileStream fs = new FileStream(args[4],FileMode.Open)){
                using(StreamReader sr = new StreamReader(fs)){
                    content = sr.ReadToEnd();
                }
            }

            Assert.IsNotNullOrEmpty(content);
        }