Exemplo n.º 1
0
        public void TestUpload()
        {
            var test_storage = new TestStorage();
            var model = new GuiModel(test_storage);

            model.Connect();

            List<string> h_file_1 = new List<string>{ "hierarchy file one" };
            List<string> h_file_2 = new List<string>{ "hierarchy file two" };
            const string path_file_1 = "path file one";
            const string path_file_2 = "path file two";

            model.AddFileToUpload( h_file_1, path_file_1 );
            model.AddFileToUpload( h_file_2, path_file_2 );

            Assert.IsNull(test_storage.files_to_upload);

            model.Upload();

            Assert.AreEqual(2, test_storage.files_to_upload.Count );

            var test_so_1 = new StorageObject(h_file_1, path_file_1);
            var test_so_2 = new StorageObject(h_file_2, path_file_2);

            Assert.IsTrue(test_storage.files_to_upload.Exists( e => e.Equals(test_so_1) ) );
            Assert.IsTrue(test_storage.files_to_upload.Exists( e => e.Equals(test_so_2) ) );

            model.Upload();
            Assert.AreEqual(0, test_storage.files_to_upload.Count);
        }
Exemplo n.º 2
0
        public void TestDirectoryOrFile()
        {
            var test_storage = new TestStorage();
            var model = new GuiModel(test_storage);

            model.Connect();

            Assert.IsTrue(model.IsDirectory(test_storage.GetRootDir().GetName()));
            Assert.IsFalse(model.IsDirectory("second") );
        }
Exemplo n.º 3
0
        public void TestDownloadFile()
        {
            var test_storage = new TestStorage();
            var model = new GuiModel(test_storage);

            model.Connect();

            List<string> file_to_download = new List<string> { "/one/two/three" };
            model.DownloadFile( file_to_download, "" );
            Assert.AreEqual( file_to_download, test_storage.download_file );
        }
Exemplo n.º 4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var config = new Configuration();
            var storage = new DropBoxStorage( config );
            var model = new GuiModel(storage);
            MainWindow main_window = new MainWindow();
            GuiPresenter presenter = new GuiPresenter( main_window, model );
            main_window.SetPresenter(presenter);
            Application.Run( main_window );
        }
Exemplo n.º 5
0
        public void TestConnect()
        {
            var test_storage = new TestStorage();
            var model = new GuiModel(test_storage);

            Dictionary<string, List<string>> root = model.Connect();

            Assert.IsTrue(test_storage.connected);

            Assert.AreEqual(2, root.Count);
            Assert.IsTrue(root.Keys.ToList().Exists( e => TestStorageDir.root_element.GetName().Equals( e ) ) );
            Assert.IsTrue(root.Keys.ToList().Exists( e => TestStorageDir.second_element.GetName().Equals( e ) ) );

            Assert.IsTrue( root.Values.ToList().TrueForAll( e => e == null ) );
        }