public async Task FetchChallengePayouts_ShouldBeOfTypeFetchChallengePayoutsResponse()
        {
            // Arrange
            var          userId = new UserId();
            const string email  = "*****@*****.**";

            var claims = new[] { new Claim(JwtClaimTypes.Subject, userId.ToString()), new Claim(JwtClaimTypes.Email, email) };

            var host = TestHost.WithClaimsFromBearerAuthentication(claims);

            host.Server.CleanupDbContext();

            await host.Server.UsingScopeAsync(
                async scope =>
            {
                var accountService = scope.GetRequiredService <IAccountService>();

                await accountService.CreateAccountAsync(userId);
            });

            var request = new FetchChallengePayoutsRequest();

            var client = new CashierService.CashierServiceClient(host.CreateChannel());

            // Act
            var response = await client.FetchChallengePayoutsAsync(request);

            //Assert
            response.Should().BeOfType <FetchChallengePayoutsResponse>();
        }
        public async Task <IActionResult> FetchChallengesAsync(
            EnumGame game            = EnumGame.None,
            EnumChallengeState state = EnumChallengeState.None,
            bool includeMatches      = false
            )
        {
            var fetchDoxatagsRequest = new FetchDoxatagsRequest();

            var fetchDoxatagsResponse = await _identityServiceClient.FetchDoxatagsAsync(fetchDoxatagsRequest);

            var fetchChallengePayoutsRequest = new FetchChallengePayoutsRequest();

            var fetchChallengePayoutsResponse = await _cashierServiceClient.FetchChallengePayoutsAsync(fetchChallengePayoutsRequest);

            var fetchChallengesRequest = new FetchChallengesRequest
            {
                Game           = game,
                State          = state,
                IncludeMatches = includeMatches
            };

            var fetchChallengesResponse = await _challengesServiceClient.FetchChallengesAsync(fetchChallengesRequest);

            return(this.Ok(ChallengeMapper.Map(fetchChallengesResponse.Challenges, fetchChallengePayoutsResponse.Payouts, fetchDoxatagsResponse.Doxatags)));
        }
Beispiel #3
0
        public override async Task <FetchChallengePayoutsResponse> FetchChallengePayouts(FetchChallengePayoutsRequest request, ServerCallContext context)
        {
            var challenges = await _challengeQuery.FetchChallengesAsync();

            var response = new FetchChallengePayoutsResponse
            {
                Payouts =
                {
                    _mapper.Map <IEnumerable <ChallengePayoutDto> >(challenges)
                }
            };

            return(context.Ok(response));
        }