Exemple #1
0
        public async Task <IActionResult> DrawCard(Guid deckId)
        {
            var result = await _gameControlService.DrawCardAsync(deckId);

            return(Ok(new CardResults(
                          color: result.Color,
                          suit: result.Suit,
                          value: result.Value,
                          displayName: result.DisplayName)));
        }
        public async Task DrawCardAsync_ShouldReturnValidCard()
        {
            // Arrange
            var deckId = _fixture.Create <Guid>();
            var deck   = _fixture.Create <DeckEntity>();

            _deckRepository
            .Setup(a => a.GetByDeckByIdWithCardsAsync(It.IsAny <Guid>()))
            .Returns(Task.FromResult(deck.ToModel()));

            // Act
            var result = await _deckService.DrawCardAsync(deckId);

            // Assert
            result
            .Should()
            .NotBeNull();

            result
            .Should()
            .BeEquivalentTo(deck.Cards.ToList()[0].ToModel());
        }