Ejemplo n.º 1
0
        public void ShouldDeleteFolderAsync()
        {
            // Arrange
            IFilesApi filesApi = CreateFilesApi();

            // Act & Assert
            filesApi.DeleteFolderAsync("calendar").Wait();

            Should.Throw <ArgumentNullException>(() => filesApi.DeleteFolderAsync(null));
        }
Ejemplo n.º 2
0
        public void ShouldDeleteFolderAsync()
        {
            // Arrange
            IFilesApi filesApi = CreateFilesApi();

            // Act & Assert
            filesApi.DeleteFolderAsync("applications", "calendar").Wait();
        }
Ejemplo n.º 3
0
        public async Task RunAsync(IRestContext context)
        {
            IFilesApi filesApi = context.Factory.CreateFilesApi("files");

            // Display resources
            IEnumerable <string> names = await filesApi.GetResourceNamesAsync();

            Console.WriteLine("GetResourcesAsync():");
            foreach (string name in names)
            {
                Console.WriteLine("\t{0}", name);
            }

            // Creating a folder
            await filesApi.CreateFolderAsync("test", true);

            Console.WriteLine("Folder 'test' created.");

            // Creating a file
            FileResponse response = await filesApi.CreateFileAsync("test/test.txt", "test", true);

            Console.WriteLine("Created file: {0}", response.Path);

            // Reading the file
            string content = await filesApi.GetTextFileAsync("test/test.txt");

            Console.WriteLine("GetFile content: {0}", content);

            // Deleting the file
            response = await filesApi.DeleteFileAsync("test/test.txt");

            Console.WriteLine("Deleted file: {0}", response.Path);

            // Deleting the folder
            await filesApi.DeleteFolderAsync("test", true);

            Console.WriteLine("Folder 'test' deleted.");
        }