Adding unit test

This commit is contained in:
Eugenio Chiodo
2021-04-26 19:33:07 +02:00
parent f537d097ec
commit fc1ced2d61
5 changed files with 210 additions and 0 deletions

View File

@ -11,6 +11,13 @@ namespace drinkMe.Server.Services
{
public async Task<bool> Pay(PurchaseCart purchaseCart)
{
if (!purchaseCart.IsPayedWithCash &&
(purchaseCart.CreditCardNumber is { Length: 0 } || purchaseCart.CreditCardExpirationYear is { Length: 0 } ||
purchaseCart.CreditCardExpirationMonth is { Length: 0 } || purchaseCart.CreditCardCVVCode is { Length: 0 }))
return false;
if (purchaseCart.PurchasingItems.Count == 0)
return false;
//completing the purchase
return true;
}