Exemple #1
0
        public void TestUpload()
        {
            storage.ClearDir("/Test");
            storage.CreateDir("/Test/SubTest");

            List<string> storage_dir = new []{"Test"}.ToList();
            var f1 = new StorageObject(storage_dir, @"..\..\test.txt");
            storage_dir = new List<string>{ "Test", "SubTest" };
            var f2 = new StorageObject(storage_dir, @"..\..\test.exe");

            var files_to_upload = new List<IStorageObject>(){f1,f2};

            storage.UploadFiles(files_to_upload);

            // TODO: this test case creates temp files which should not be created at all.
            // Currently they are just ignored with .gitignore.
            Assert.IsTrue(storage.GetDirListing("/Test").Exists( e => e.getStoragePath().Equals( f1.getEncryptedFilePath().Replace(@"..\..\", "/") ) ) );
            Assert.IsTrue(storage.GetDirListing("/Test/SubTest").Exists( e => e.getStoragePath().Equals( f2.getEncryptedFilePath().Replace(@"..\..\", "/") ) ) );
        }
Exemple #2
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);
        }