public async Task GivenHttpClientReturns200ResponseThenGatewayReturnsConfirmationMessage() { var httpClient = CreateHttpClient(); _googleAPIGateway = new GoogleAPIGateway(httpClient); var result = await _googleAPIGateway.PostMessageToGoogleRoom("message"); result.Should().Be("Message sent successfully"); }
public async Task GivenHttpClientReturnsNon200ResponseThenGatewayThrowsGoogleApiExceptionWithStatusCode(HttpStatusCode code) { var httpClient = CreateHttpClient(code); _googleAPIGateway = new GoogleAPIGateway(httpClient); Func <Task> f = async() => await _googleAPIGateway.PostMessageToGoogleRoom("message"); await f.Should().ThrowAsync <GoogleApiException>().WithMessage(((int)code).ToString()); }