public async Task CollectingGameService_WhenCollectingValidToken_ThenOperationIsSuccessful()
        {
            var setup = await SetupTwoPlayersWithOneFursuitTokenAsync();

            var result = await _collectingGameService.CollectTokenForPlayerAsync(
                setup.player2WithoutFursuit.Uid,
                setup.player1Token.Value
                );

            var player1FursuitParticipation = await _fursuitParticipationRepository.FindOneAsync(a => a.OwnerUid == setup.player1WithFursuit.Uid);

            var player2PlayerParticipation = await _playerParticipationRepository.FindOneAsync(a => a.PlayerUid == setup.player2WithoutFursuit.Uid);

            Assert.True(result.IsSuccessful);
            Assert.Equal(1, player1FursuitParticipation.CollectionCount);
            Assert.Equal(1, player2PlayerParticipation.CollectionCount);
            Assert.Contains(player1FursuitParticipation.CollectionEntries, a => a.PlayerParticipationUid == setup.player2WithoutFursuit.Uid);
            Assert.Contains(player2PlayerParticipation.CollectionEntries, a => a.FursuitParticipationUid == player1FursuitParticipation.Id);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> CollectTokenForPlayerAsync([FromBody] string TokenValue)
        {
            var result = await _collectingGameService.CollectTokenForPlayerAsync(_apiPrincipal.Uid, TokenValue.Trim().ToUpper());

            return(result.AsActionResult());
        }