private async Task DeleteFoldersBatch(BatchSession batch)
        {
            var service      = new DLAppService(batch);
            var repositoryId = GroupId;

            await service.DeleteFolderAsync(repositoryId, ParentFolderId, FolderName);

            await service.DeleteFolderAsync(repositoryId, ParentFolderId, FolderName2);

            var array = await batch.InvokeAsync();

            Assert.AreEqual(2, array.Count());
        }
        public async Task TestAddFileEntryBytes()
        {
            var service      = new DLAppService(this.Session);
            var repositoryId = GroupId;

            var bytes = Encoding.UTF8.GetBytes("Hello");

            var fileEntry = await service.AddFileEntryAsync(repositoryId, ParentFolderId, SourceFileName, MimeType, SourceFileName, string.Empty, string.Empty, bytes, null);

            Assert.AreEqual(SourceFileName, fileEntry.title);

            await service.DeleteFileEntryAsync(fileEntry.fileEntryId);
        }
        public async Task TestAddFolder()
        {
            var service      = new DLAppService(this.Session);
            var repositoryId = GroupId;

            var folder = await service.AddFolderAsync(repositoryId, ParentFolderId, FolderName, string.Empty, null);

            Assert.AreEqual(FolderName, folder.name);

            var count = await service.GetFoldersCountAsync(repositoryId, ParentFolderId, 0, false);

            Assert.AreEqual(1, count);

            await this.DeleteFolder();
        }
        public async Task TestAddFoldersBatch()
        {
            var batch = new BatchSession(this.Session);

            var service      = new DLAppService(batch);
            var repositoryId = GroupId;

            await service.AddFolderAsync(repositoryId, ParentFolderId, FolderName, string.Empty, null);

            await service.AddFolderAsync(repositoryId, ParentFolderId, FolderName2, string.Empty, null);

            var array = await batch.InvokeAsync();

            Assert.AreEqual(FolderName, array.ElementAt(0).name);
            Assert.AreEqual(FolderName2, array.ElementAt(1).name);

            await this.DeleteFoldersBatch(batch);
        }
        private async Task DeleteFolder()
        {
            var service      = new DLAppService(this.Session);
            var repositoryId = GroupId;

            await service.DeleteFolderAsync(repositoryId, ParentFolderId, FolderName);

            try
            {
                await service.GetFolderAsync(repositoryId, ParentFolderId, FolderName);

                Assert.Fail();
            }
            catch (ServerException se)
            {
                Assert.IsTrue(se.Message.StartsWith("No DLFolder exists with the key"));
            }
        }