public async Task FetchChallengeMatches( string playerId, DateTime startedAt, DateTime endedAt, int count ) { // 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(); var client = new GameService.GameServiceClient(TestHost.CreateChannel()); var matches = new List <GameMatchDto>(); await foreach (var fetchChallengeMatchesResponse in client.FetchChallengeMatches( new FetchChallengeMatchesRequest { Game = EnumGame.LeagueOfLegends, StartedAt = startedAt.ToTimestamp(), EndedAt = endedAt.ToTimestamp(), Participants = { new ChallengeParticipantDto { Id = new ParticipantId(), GamePlayerId = playerId } } }) .ResponseStream.ReadAllAsync()) { matches.AddRange(fetchChallengeMatchesResponse.Matches); } matches.Should().HaveCount(count); }