public GetStatisticModule( ServerStatisticHandler serverStatisticHandler, PlayerStatisticHandler playerStatisticHandler, ReportsHandler reportsHandler ) { this.serverStatisticHandler = serverStatisticHandler; this.playerStatisticHandler = playerStatisticHandler; this.reportsHandler = reportsHandler; Get["/servers/{endpoint:url}/stats", true] = async(x, _) => await GetServerStatisticAsync(x.endpoint); Get["/players/{name}/stats", true] = async(x, _) => await GetPlayerStatisticAsync(x.name); Get["/reports/recent-matches/", true] = async(x, _) => await GetRecentMatchesReportAsync(Constants.DefaultCount); Get["/reports/recent-matches/{count:int}", true] = async(x, _) => { var count = NormalizeCount(x.count); return(await GetRecentMatchesReportAsync(count)); }; Get["/reports/best-players/", true] = async(x, _) => await GetBestPlayersReportAsync(Constants.DefaultCount); Get["/reports/best-players/{count:int}", true] = async(x, _) => { var count = NormalizeCount(x.count); return(await GetBestPlayersReportAsync(count)); }; Get["/reports/popular-servers/", true] = async(x, _) => await GetPopularServersReportAsync(Constants.DefaultCount); Get["/reports/popular-servers/{count:int}", true] = async(x, _) => { var count = NormalizeCount(x.count); return(await GetPopularServersReportAsync(count)); }; }
public void SetUp() { database = A.Fake <IDatabaseAdapter>(); A.CallTo(() => database.GetMatches()).Returns(TestData.Matches); handler = new PlayerStatisticHandler(database); }