DeleteAlbumAsync() public method

Delete an album with a given Id. You are required to be logged in as the user to delete the album. For anonymous albums, {albumId} should be the deletehash that is returned at creation.
/// Thrown when a null reference is passed to a method that does not accept it as a /// valid argument. /// Thrown when an error is found in a response from an Imgur endpoint. Thrown when an error is found in a response from a Mashape endpoint.
public DeleteAlbumAsync ( string albumId ) : Task
albumId string The id or deletehash of the album.
return Task
コード例 #1
0
        public async Task DeleteAlbumAsync_True()
        {
            var mockResponse = new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(MockAlbumEndpointResponses.Imgur.DeleteAlbum)
            };

            var mockUrl = "https://api.imgur.com/3/album/12x5454";
            var client = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse)));
            var deleted = await endpoint.DeleteAlbumAsync("12x5454").ConfigureAwait(false);

            Assert.True(deleted);
        }
コード例 #2
0
        public async Task DeleteAlbumAsync_WithAlbumNull_ThrowsArgumentNullException()
        {
            var client = new ImgurClient("123", "1234");
            var endpoint = new AlbumEndpoint(client);

            var exception =
                await
                    Record.ExceptionAsync(
                        async () => await endpoint.DeleteAlbumAsync(null).ConfigureAwait(false))
                        .ConfigureAwait(false);
            Assert.NotNull(exception);
            Assert.IsType<ArgumentNullException>(exception);
        }