public async Task SetAlbumImagesAsync_WithAlbum_AreEqual(IAlbum actualAlbum) { var client = new MashapeClient(ClientId, ClientSecret, MashapeKey, OAuth2Token); var endpoint = new AlbumEndpoint(client); var updated = await endpoint.SetAlbumImagesAsync(actualAlbum.Id, new List <string> { "uH3kfZP", "OkFyVOe", "Y8BbQuU" }); Assert.IsTrue(updated); }
public async Task SetAlbumImagesAsync_WithIdNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client); var exception = await Record.ExceptionAsync( async() => await endpoint.SetAlbumImagesAsync("12x5454", null).ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType <ArgumentNullException>(exception); }
public async Task SetAlbumImagesAsync_WithAlbum_AreEqual(IAlbum actualAlbum) { var client = new ImgurClient(ClientId, ClientSecret); var endpoint = new AlbumEndpoint(client); var updated = await endpoint.SetAlbumImagesAsync(actualAlbum.DeleteHash, new List <string> { "uH3kfZP", "OkFyVOe", "Y8BbQuU" }); Assert.IsTrue(updated); }
public async Task SetAlbumImagesAsync_IsTrue() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AlbumEndpointResponses.Imgur.SetAlbumImagesResponse) }; 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 updated = await endpoint.SetAlbumImagesAsync("12x5454", new List <string> { "AbcDef", "IrcDef" }); Assert.IsTrue(updated); }
public async Task SetAlbumImagesAsync_True() { var mockUrl = "https://api.imgur.com/3/album/12x5454"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockAlbumEndpointResponses.Imgur.SetAlbumImages) }; var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var updated = await endpoint.SetAlbumImagesAsync("12x5454", new List <string> { "AbcDef", "IrcDef" }).ConfigureAwait(false); Assert.True(updated); }
public async Task SetAlbumImagesAsync_WithIdNulls_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AlbumEndpoint(client); await endpoint.SetAlbumImagesAsync("12x5454", null); }