Example #1
0
        public void TestRemoveSynchronization()
        {
            List<string> files = new List<string>() { "file1.txt", "file2.txt", "file3.txt" };
            var storage1 = new SimpleStorage("Storage 1", files);
            var storage2 = new SimpleStorage("Storage 2", files);
            var synchronizer = new Synchronizer(storage1, storage2);

            storage2.Remove("file2.txt");

            Assert.IsTrue(storage1.Equals(storage2));
        }
Example #2
0
        public void TestAddSynchronization()
        {
            var storage1 = new SimpleStorage("Storage 1");
            var storage2 = new SimpleStorage("Storage 2");
            var synchronizer = new Synchronizer(storage1, storage2);

            storage1.Add("file1.txt");
            storage2.Add("file2.txt");

            Assert.IsTrue(storage1.Equals(storage2));
        }
Example #3
0
        public void TestMultiThreadAddSynchronization()
        {
            var storage1 = new MultiThreadStorage("Storage 1");
            var storage2 = new MultiThreadStorage("Storage 2");
            var synchronizer = new Synchronizer(storage1, storage2);

            storage1.Add("file1.txt");
            Thread.Sleep(10000);

            Assert.IsTrue(storage1.Equals(storage2));
        }
Example #4
0
        static void Main(string[] args)
        {
            Trace.Listeners.Add(new ConsoleTraceListener());

            var login = "******";
            var password = "******";
            var directory = "Your directory";
            var localStorage = new LocalStorage(directory);
            var vkStorage = new VkStorage(login, password);
            var synchronizer = new Synchronizer(localStorage, vkStorage);

            Console.ReadLine();
        }