public async Task ErrorContentOnErrorJson() { var message = FakeHttpClient.MessageResponse(HttpStatusCode.InsufficientStorage, "Throttled"); var exception = await Assert.ThrowsAsync <MeetupException>(() => message.AsObject <object>(MeetupClient.SetupOptions(null, null))); Assert.Single(exception.Errors); }
public async Task ErrorContentOnClientReturningError() { var message = FakeHttpClient.MessageResponse(HttpStatusCode.InsufficientStorage, "Throttled"); var client = new HttpClient(new ActionMessageHandler(req => message)); var response = await client.GetAsync("https://test.com"); var exception = await Assert.ThrowsAsync <MeetupException>(() => response.AsObject <object>(MeetupClient.SetupOptions(null, null))); Assert.Single(exception.Errors); }