public void WhenInvalidApKey_ThenThrowExceptionForbidden() { var request = new StickerPackChildrenPacksRequest(ApiKeys.Invalid); var ex = Assert.ThrowsAsync <GiphyApiClientException>(() => _sut.GetStickPackChildrenPacksAsync(request)); Assert.That(ex.HttpStatusCode, Is.EqualTo(ApiStatusCodes.Forbidden)); }
public async Task WhenStickerPackExists_ThenReturnStickers() { var request = new StickerPackChildrenPacksRequest(ApiKeys.Valid) { PackId = ExistingStickerPackIdHasChildren }; var response = await _sut.GetStickPackChildrenPacksAsync(request); Assert.That(response.StickerPacks.Count(), Is.GreaterThan(0)); }
public Uri Create(StickerPackChildrenPacksRequest request) { return(request.AddUriParams(new Uri(_settings.BaseUrl).SetPath(@"v1/stickers/packs/" + request.PackId + "/children"))); }
/// <summary> /// Returns the children sticker packs within an individual sticker pack. /// </summary> /// <param name="request">Request object.</param> /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param> /// <returns>The task object representing the asynchronous operation.</returns> public async Task <StickerPackChildrenPacksResponse> GetStickPackChildrenPacksAsync(StickerPackChildrenPacksRequest request, CancellationToken cancellationToken = default) { var uri = _uriFactory.Create(request); return(await GetAsync <StickerPackChildrenPacksResponse>(uri, cancellationToken)); }