public async Task Read_total_matches_supports_no_filter() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(null).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count, result); }
public async Task Read_total_matches_supports_only_tournaments_filter() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { IncludeMatches = false, IncludeTournaments = true }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count(x => x.MatchRoute.StartsWith("/tournaments/", StringComparison.OrdinalIgnoreCase)), result); }
public async Task Read_total_matches_supports_filter_by_tournament() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { TournamentId = _databaseFixture.TournamentInThePastWithFullDetails.TournamentId }).ConfigureAwait(false); Assert.Equal(1, result); }
public async Task Read_total_matches_supports_including_tournament_matches() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { IncludeTournamentMatches = true }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count + _databaseFixture.TournamentMatchListings.Count, result); }
public async Task Read_total_matches_supports_filter_before_date() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { UntilDate = DateTimeOffset.UtcNow }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count(x => x.StartTime <= DateTimeOffset.UtcNow), result); }
public async Task Read_total_matches_supports_filter_by_null_result_type() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { MatchResultTypes = new List <MatchResultType?> { null } }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count(x => !x.MatchResultType.HasValue), result); }
public async Task Read_total_matches_supports_filter_by_player_type() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { PlayerTypes = new List <PlayerType> { PlayerType.Mixed } }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count(x => x.PlayerType == PlayerType.Mixed), result); }
public async Task Read_total_matches_supports_filter_by_match_type() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { MatchTypes = new List <MatchType> { MatchType.LeagueMatch } }).ConfigureAwait(false); Assert.Equal(_databaseFixture.MatchListings.Count(x => x.MatchRoute.StartsWith("/tournaments/", StringComparison.OrdinalIgnoreCase) || x.MatchType == MatchType.LeagueMatch), result); }
public async Task Read_total_matches_supports_filter_tournaments_by_match_location() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { MatchLocationIds = new List <Guid> { _databaseFixture.TournamentInThePastWithFullDetails.TournamentLocation.MatchLocationId.Value } }).ConfigureAwait(false); Assert.Equal(1, result); }
public async Task Read_total_matches_supports_filter_matches_by_team() { var matchDataSource = new SqlServerMatchListingDataSource(_databaseFixture.ConnectionFactory); var result = await matchDataSource.ReadTotalMatches(new MatchFilter { TeamIds = new List <Guid> { _databaseFixture.MatchInThePastWithFullDetails.Teams.First().Team.TeamId.Value } }).ConfigureAwait(false); Assert.Equal(1, result); }