public async Task Move_RequestForMoveFile_SetNewPossOfFile() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFile file = new FileStorageFile(new FileBuilder() { Name = "ForTestMove2.docx", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; FileStorageFolder folderTo = new FileStorageFolder(new FolderBuilder() { Name = "ForTestMove", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; string expectedPath = "/drive/root:/ForTestMove"; await file.Move(folderTo); Assert.AreEqual(expectedPath, file.Path); }
public async Task LoadPublicUrl_RequestForGetPublicUrlOfFolder_GetPublicUrl() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new FolderBuilder() { Name = "ForTestLoadPublicUrl", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; await folder.CreatePublicUrl(); folder = new FileStorageFolder(new FolderBuilder() { Name = "ForTestLoadPublicUrl", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; await folder.LoadPublicUrl(); Assert.IsFalse(String.IsNullOrEmpty(folder.PublicUrl)); Assert.IsFalse(String.IsNullOrEmpty(folder.PublicUrlId)); }
public async Task Copy_RequestForCopyFile_CopyFileByPath() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFile file = new FileStorageFile(new FileBuilder() { Name = "ForTestCopy1.exe", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; FileStorageFolder folderTo = new FileStorageFolder(new FolderBuilder() { Name = "ForTestCopy2", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; UnityDisk.FileStorages.IFileStorageFolder result = await file.Copy(folderTo) as UnityDisk.FileStorages.IFileStorageFolder; Assert.IsNull(result); }
public async Task Copy_RequestForCopyFolder_CopyFolder() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new FolderBuilder() { Name = "ForTestCopy1", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; FileStorageFolder folderTo = new FileStorageFolder(new FolderBuilder() { Name = "ForTestCopy2", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; UnityDisk.FileStorages.IFileStorageFolder result = await folder.Copy(folderTo) as UnityDisk.FileStorages.IFileStorageFolder; string expectedPath = "/drive/root:/ForTestCopy2"; Assert.IsNotNull(result); Assert.AreEqual(expectedPath, result.Path); Assert.AreEqual(folder.Name, result.Name); }
public async Task LoadDirectory_RequestForLoadDirectiry_GetDirectory() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new AccountProjection( new UnityDisk.Accounts.Account(account))); var list = await folder.LoadDirectory(); Assert.IsNotNull(list); Assert.IsTrue(list.Count > 0); }
public async Task Delete_RequestForDeleteFolder_DeleteFolder() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new FolderBuilder() { Name = "ForTestDeleteFolder", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; await folder.Delete(); }
public async Task CreateFolder_RequestForCreatePublicUrlOfFolder_GetNewPublicUrl() { UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new FolderBuilder() { Name = "", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; string expectedName = "ForTestCreateFolder"; var newFolder = await folder.CreateFolder(expectedName); Assert.IsNotNull(newFolder); Assert.AreEqual(expectedName, newFolder.Name); }
public async Task Rename_RequestForRenameFolder_SetNewName() { string expectedName = "ForTestRename_DONE"; UnityDisk.FileStorages.OneDrive.Account account = new UnityDisk.FileStorages.OneDrive.Account(); await account.SignIn(_login); FileStorageFolder folder = new FileStorageFolder(new FolderBuilder() { Name = "ForTestRename", Path = "/drive/root:" }) { Account = new AccountProjection( new UnityDisk.Accounts.Account(account)) }; await folder.Rename(expectedName); Assert.AreEqual(folder.Name, expectedName); }