public void GetLocations_IfApiResponseFailed_ThrowsApiException( string responseContent, HttpStatusCode code) { mockers.SetupFailedExecution <ApiResponse <List <Location> > >(responseContent, code); var exception = Assert.Catch <ApiException>(() => { var actual = GetLocations(); }); Assert.AreEqual(code, exception.ResponseCode); }
public void Checkout_IfApiResponseFailed_ThrowsApiException( string responseContent, HttpStatusCode code, string expectedMessage) { mockers.SetupFailedExecution <ApiResponse <PaymentInfo> >(responseContent, code); var exception = Assert.Catch <ApiException>(() => { var actual = Checkout(TestValidBookingParameters); }); Assert.AreEqual(code, exception.ResponseCode); Assert.AreEqual(expectedMessage, exception.Message); }
public void Authenticate_IfApiResponseFailed_ThrowsApiException( string responseContent, HttpStatusCode code, string expectedMessage) { mockers.SetupFailedExecution <AccessToken>(responseContent, code); var exception = Assert.Catch <ApiException>(() => { var actual = Authenticate(); }); Assert.AreEqual(code, exception.ResponseCode); Assert.AreEqual(expectedMessage, exception.Message); }