public async Task DeleteAlbumAsync_WithImage_IsTrue(IAlbum actualAlbum) { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token); var endpoint = new AlbumEndpoint(client); var deleted = await endpoint.DeleteAlbumAsync(actualAlbum.Id); Assert.IsTrue(deleted); }
public async Task DeleteImageAsync_WithImage_IsTrue(IAlbum actualAlbum) { var client = new ImgurClient(ClientId, ClientSecret); var endpoint = new AlbumEndpoint(client); var deleted = await endpoint.DeleteAlbumAsync(actualAlbum.DeleteHash); Assert.IsTrue(deleted); }
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); }
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); }
public async Task DeleteAlbumAsync_IsTrue() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AlbumEndpointResponses.Imgur.DeleteAlbumResponse) }; fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/album/12x5454"), fakeResponse); var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client, new HttpClient(fakeHttpMessageHandler)); var deleted = await endpoint.DeleteAlbumAsync("12x5454"); Assert.IsTrue(deleted); }
public async Task TestDeleteAlbum() { var imgurClient = await AuthenticationHelpers.CreateOAuth2AuthenticatedImgurClient(); var albumEndpoint = new AlbumEndpoint(imgurClient); var createdAlbum = await albumEndpoint.CreateAlbumAsync(); var deletedAlbum = await albumEndpoint.DeleteAlbumAsync(createdAlbum.Data.DeleteHash); // Assert the Reponse Assert.IsNotNull(deletedAlbum.Data); Assert.AreEqual(deletedAlbum.Success, true); Assert.AreEqual(deletedAlbum.Status, HttpStatusCode.OK); // Assert the data Assert.AreEqual(deletedAlbum.Data, true); }
public async Task DeleteAlbumAsync_WithAlbumNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client); await endpoint.DeleteAlbumAsync(null); }