public UpdateDailyLeaderboardAsyncMethod() { leaderboard = new DailyLeaderboard(); leaderboardEntriesCallback = new LeaderboardEntriesCallback(); mockSteamClientApiClient .Setup(c => c.GetLeaderboardEntriesAsync(appId, leaderboard.LeaderboardId, cancellationToken)) .ReturnsAsync(leaderboardEntriesCallback); }
public async Task UpdatesLeaderboardsWithFreshEntries() { // Arrange var leaderboard1 = new DailyLeaderboard { LeaderboardId = 1 }; var leaderboard2 = new DailyLeaderboard { LeaderboardId = 2 }; var leaderboards = new[] { leaderboard1, leaderboard2 }; var leaderboardEntriesCallback1 = new LeaderboardEntriesCallback(); leaderboardEntriesCallback1.Entries.AddRange(new[] { new LeaderboardEntry(), new LeaderboardEntry(), new LeaderboardEntry(), }); mockSteamClientApiClient .Setup(c => c.GetLeaderboardEntriesAsync(appId, leaderboard1.LeaderboardId, cancellationToken)) .ReturnsAsync(leaderboardEntriesCallback1); var leaderboardEntriesCallback2 = new LeaderboardEntriesCallback(); leaderboardEntriesCallback2.Entries.AddRange(new[] { new LeaderboardEntry(), new LeaderboardEntry(), }); mockSteamClientApiClient .Setup(c => c.GetLeaderboardEntriesAsync(appId, leaderboard2.LeaderboardId, cancellationToken)) .ReturnsAsync(leaderboardEntriesCallback2); // Act await worker.UpdateDailyLeaderboardsAsync(leaderboards, cancellationToken); // Assert Assert.Equal(3, leaderboard1.Entries.Count); Assert.Equal(2, leaderboard2.Entries.Count); }