Exemple #1
0
        private async Task <GameModel> ValidateMoveInternalAsync(MoveModel move, CancellationToken cancellationToken = default)
        {
            var game = await _gameValidator.ValidateGameForMoveAsync(move.GameId, move.UserId, cancellationToken : cancellationToken);

            await _moveValidator.ValidateMoveAsync(move, game, cancellationToken : cancellationToken);

            return(game);
        }
Exemple #2
0
        private async Task <GameModel> ValidateMoveInternalAsync(MoveModel move, CancellationToken cancellationToken = default)
        {
            var game = await _gameValidator.ValidateGameForMoveAsync(move.GameId, move.UserId, cancellationToken : cancellationToken);

            var card = (await _gameDeckCardCollectionRepository.SearchAsync(
                            new GameDeckCardCollectionSearchFilter
            {
                Ids = new int[] { move.GameDeckCardCollectionId },
                UserId = move.UserId,
            }, cancellationToken: cancellationToken)).SingleOrDefault(x => x.Id == move.GameDeckCardCollectionId);

            if (card == null)
            {
                throw new InvalidCardException();
            }

            await _moveValidator.ValidateMoveAsync(move, game, cancellationToken : cancellationToken);

            return(game);
        }