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); }
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") ); }
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 ); }
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 ) ); }