public async Task PutVerbIsNotAccepted() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); var response = await TestFixture.Client.PutAsync("/payment", ContentHelpers.JsonString(payment)); Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.MethodNotAllowed)); }
public async Task PaymentDataWithInvalidCreditCardNumberIsNotAccepted() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); payment.CardNumber = "nosuch"; var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); await HttpAssert.IsBadRequestWithJsonContent(response); }
public async Task PaymentDataWithoutNameIsNotAccepted() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); payment.NameOnCard = string.Empty; var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); await HttpAssert.IsBadRequestWithJsonContent(response); }
public async Task BankRejectionHasCorrectStatus() { var payment = PaymentRequestBuilder.RequestToBeRejected(); var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); var paymentResponse = await ReadAsPaymentData(response); Assert.That(paymentResponse.Status, Is.EqualTo(PaymentStatus.Rejected)); }
public async Task ValidPaymentDataIsAccepted() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); var paymentResponse = await ReadAsPaymentData(response); Assert.That(paymentResponse.Status, Is.EqualTo(PaymentStatus.Accepted)); }
private static async Task <Guid> SubmitPayment(PaymentRequest payment) { var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK)); var responseContent = await response.Content.ReadAsStringAsync(); var paymentResponse = JsonConvert.DeserializeObject <PaymentData>(responseContent); Assert.That(paymentResponse, Is.Not.Null); return(paymentResponse.Id); }
public async Task AmexCardNumberIsAccepted() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); payment.CardNumber = "378282246310005"; payment.CardCvv = "1234"; var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString(payment)); var paymentResponse = await ReadAsPaymentData(response); Assert.That(paymentResponse.Status, Is.EqualTo(PaymentStatus.Accepted)); }
public async Task NoPaymentDataIsBadRequest() { var response = await TestFixture.Client.PostAsync("/payment", ContentHelpers.JsonString("{}")); await HttpAssert.IsBadRequestWithJsonContent(response); }