public async Task Given_A_Card_Id_Should_Invoke_CardExists_Method_Once()
        {
            // Arrange
            const long cardId = 4322;

            _cardRepository.CardExists(Arg.Any <long>()).Returns(true);

            // Act
            await _sut.CardExists(cardId);

            // Assert
            await _cardRepository.Received(1).CardExists(Arg.Is(cardId));
        }
Beispiel #2
0
 public Package CreatePackage(Card[] cards)
 {
     if (Utils.GetSession(_sessionService, HttpRequest, HttpResponse) == null)
     {
         return(null);
     }
     cards.ToList().ForEach(x => x.SetTypes());
     if (cards == null || cards.Length != Package.PackageSize)
     {
         HttpResponse.SetContent($"No cards or not the right amount of cards! The right amount: {Package.PackageSize}.");
         HttpResponse.SetStatus(HttpStatus.Bad_Request);
         return(null);
     }
     foreach (var card in cards)
     {
         if (_cardService.CardExists(card.Id))
         {
             HttpResponse.SetContent($"Card with Id: {card.Id} already exists");
             HttpResponse.SetStatus(HttpStatus.Bad_Request);
             return(null);
         }
     }
     return(_packageService.CreatePackage(cards.ToArray()));
 }