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)); }
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 StoredDataIsCorrect() { var paymentRequest = PaymentRequestBuilder.ValidPaymentRequest(); var paymentId = await SubmitPayment(paymentRequest); var getResponse = await TestFixture.Client.GetAsync($"/payment/{paymentId}"); var responseContent = await getResponse.Content.ReadAsStringAsync(); var bankResponse = JsonConvert.DeserializeObject <PaymentData>(responseContent); Assert.That(bankResponse.Id, Is.EqualTo(paymentId)); Assert.That(bankResponse.Amount, Is.EqualTo(paymentRequest.Amount)); Assert.That(bankResponse.NameOnCard, Is.EqualTo(paymentRequest.NameOnCard)); Assert.That(bankResponse.CardNumber, Is.EqualTo("4111")); }
private static async Task <Guid> GetValidPaymentId() { var payment = PaymentRequestBuilder.ValidPaymentRequest(); return(await SubmitPayment(payment)); }