public void CreditCardSuccessful() { var paymentController = new PaymentController(_repository, _ccProcessor); var response = paymentController.CreditWithCard("2121212121212121", 20); Assert.Equal(20, _repository.Payment.Amount); }
public void CreditCardInvalidNumber() { var paymentController = new PaymentController(_repository, _ccProcessor); var response = paymentController.CreditWithCard("2121212b21212121", 20); Assert.Equal(0, _repository.Payment.Amount); var contentResult = response as NegotiatedContentResult <string>; Assert.NotNull(contentResult); Assert.NotNull(contentResult.Content); Assert.Equal("Invalid credit card format.", contentResult.Content); }