Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            GoogleDrive gd = new GoogleDrive();
            Mega        m  = new Mega();
            Dropbox     db = new Dropbox();

            IClouds[] clouds = { gd, m, db };

            foreach (var cloud in clouds)
            {
                cloud.StartService();
            }

            TestOne(clouds);
            TestTwo(clouds);
            TestThree(gd, m);
            TestFour(gd, m, db);
            Console.ReadLine();
        }
Ejemplo n.º 2
0
        // Test Four: 24-hour consecutive upload test of 1 MB file
        private static void TestFour(GoogleDrive gd, Mega m, Dropbox db)
        {
            File.Delete("four_GoogleDrive.txt");
            File.Delete("four_Mega.txt");
            File.Delete("four_Dropbox.txt");

            var tasks = new Task[3];

            while (true)
            {
                tasks[0] = new Task(() => Upload("four_GoogleDrive.txt", gd, 1, 1, Type.MB, 0));
                tasks[1] = new Task(() => Upload("four_Mega.txt", m, 1, 1, Type.MB, 0));
                tasks[2] = new Task(() => Upload("four_Dropbox.txt", db, 1, 1, Type.MB, 0));

                foreach (var task in tasks)
                {
                    task.Start();
                }

                Task.WaitAll(tasks);
            }
        }