// failure path public async Task WhenCalledOnPerson_Returns404() { GetPersonImagesResult response = await _client.GetPersonImages(_invalidActor, retryCount : 0, delayMilliseconds : 1000); _output.WriteLine($"Server responded: {response.HttpStatusCode}"); Assert.True(response.HttpStatusCode == System.Net.HttpStatusCode.NotFound); }
// happy path public async Task WhenCalledOnPerson_ReturnImageCollection() { GetPersonImagesResult response = await _client.GetPersonImages(_actor, retryCount : 0, delayMilliseconds : 1000); _output.WriteLine($"Server responded: {response.Json}"); var images = JsonConvert.DeserializeObject <ImageDetailCollection>(response.Json).Profiles; PrintImageDetail(images); Assert.True(images.Length > 0); }
public async Task <GetPersonImagesResult> GetPersonImages(int id, int retryCount = 0, int delayMilliseconds = 1000) { string baseUrl = BASE_Address + BASE_Path + PERSON_Path + "/" + id + IMAGE_DETAIL_Path; var query = new Dictionary <string, string>(); query.Add(API_KEY_Key, ApiKey); string requestUri = QueryHelpers.AddQueryString(baseUrl, query); GetPersonImagesResult result = await GetResponse <GetPersonImagesResult>(retryCount, delayMilliseconds, requestUri); return(result); }