public GetAccountFavoritesAsync ( ) : Task |
||
Résultat | Task |
public async Task GetAccountFavoritesAsync_Any_IsTrue() { var client = new ImgurClient(ClientId, ClientSecret, await GetOAuth2Token()); var endpoint = new AccountEndpoint(client); var favourites = await endpoint.GetAccountFavoritesAsync(); Assert.IsTrue(favourites.Any()); }
public async Task GetAccountFavoritesAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); var exception = await Record.ExceptionAsync( async () => await endpoint.GetAccountFavoritesAsync().ConfigureAwait(false)) .ConfigureAwait(false); Assert.NotNull(exception); Assert.IsType<ArgumentNullException>(exception); }
public async Task GetAccountFavoritesAsync_Any() { var mockUrl = "https://api.imgur.com/3/account/me/favorites"; var mockResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(MockAccountEndpointResponses.GetAccountFavorites) }; var client = new ImgurClient("123", "1234", MockOAuth2Token); var endpoint = new AccountEndpoint(client, new HttpClient(new MockHttpMessageHandler(mockUrl, mockResponse))); var favorites = await endpoint.GetAccountFavoritesAsync().ConfigureAwait(false); Assert.True(favorites.Any()); }
public async Task GetAccountFavoritesAsync_Any() { var fakeHttpMessageHandler = new FakeHttpMessageHandler(); var fakeResponse = new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(AccountEndpointResponses.GetAccountFavoritesResponse) }; fakeHttpMessageHandler.AddFakeResponse(new Uri("https://api.imgur.com/3/account/me/favorites"), fakeResponse); var fakeOAuth2Handler = new FakeOAuth2TokenHandler(); var client = new ImgurClient("123", "1234", fakeOAuth2Handler.GetOAuth2TokenCodeResponse()); var endpoint = new AccountEndpoint(client, new HttpClient(fakeHttpMessageHandler)); var favorites = await endpoint.GetAccountFavoritesAsync(); Assert.IsTrue(favorites.Any()); }
public async Task GetAccountFavoritesAsync_WithOAuth2TokenNull_ThrowsArgumentNullException() { var client = new ImgurClient("123", "1234"); var endpoint = new AccountEndpoint(client); await endpoint.GetAccountFavoritesAsync(); }