예제 #1
0
 public void given_a_list_of_scores_when_printing_the_top_3_high_scores_for_women_then_only_the_top_3_high_scores_for_women_should_print()
 {
     Team team1 = CreateTeam("team1");
     Team team2 = CreateTeam("team2");
     Week week1 = CreateWeek(1, "week1");
     Player player1 = CreatePlayer("F", 1, "player1", team1, 150);
     Player player2 = CreatePlayer("M", 2, "player2", team1, 150);
     WeeklyScore score1 = CreateWeeklyScore(100, 101, 102, player1, team1, week1, false);
     WeeklyScore score2 = CreateWeeklyScore(103, 104, 105, player2, team1, week1, false);
     WeeklyScore score3 = CreateWeeklyScore(106, 107, 108, player1, team1, week1, false);
     WeeklyScore score4 = CreateWeeklyScore(109, 110, 111, player2, team1, week1, false);
     WeeklyScore score5 = CreateWeeklyScore(112, 113, 114, player1, team1, week1, false);
     WeeklyScore score6 = CreateWeeklyScore(115, 116, 117, player2, team1, week1, false);
     WeeklyScore score7 = CreateWeeklyScore(118, 119, 120, player1, team1, week1, true);
     WeeklyScore score8 = CreateWeeklyScore(121, 122, 123, player2, team1, week1, true);
     List<WeeklyScore> scores = new List<WeeklyScore>() { score1, score2, score3, score4, score5, score6, score7, score8 };
     PlayerStats playerStats = new PlayerStats();
     List<Point> top3Scores = playerStats.GetTop3HighGamePlayers(scores, "F");
     Assert.That(3, Is.EqualTo(top3Scores.Count));
     Assert.IsNotNull(top3Scores.Find(p => p.Points == 112));
     Assert.IsNotNull(top3Scores.Find(p => p.Points == 113));
     Assert.IsNotNull(top3Scores.Find(p => p.Points == 114));
 }
        public void PrintSummary()
        {
            PlayerStats playerStats = new PlayerStats();
            List<WeeklyScore> lastWeeksScores =
                _allScores.Where(s => s.Week.WeekNumber == SelectedWeek.WeekNumber - 1).ToList();
            List<Point> lastWeekMensHighSeries = playerStats.GetTop3HighSeriesPlayers(lastWeeksScores, "M");
            List<Point> overallMensHighSeries = playerStats.GetTop3HighSeriesPlayers(_allScores, "M");
            List<Point> lastWeekMensHighGames = playerStats.GetTop3HighGamePlayers(lastWeeksScores, "M");
            List<Point> overallMensHighGames = playerStats.GetTop3HighGamePlayers(_allScores, "M");
            List<Point> lastWeekWomensHighSeries = playerStats.GetTop3HighSeriesPlayers(lastWeeksScores, "F");
            List<Point> overallWomensHighSeries = playerStats.GetTop3HighSeriesPlayers(_allScores, "F");
            List<Point> lastWeekWomensHighGames = playerStats.GetTop3HighGamePlayers(lastWeeksScores, "F");
            List<Point> overallWomensHighGames = playerStats.GetTop3HighGamePlayers(_allScores, "F");
            SummaryReportData summaryReportData = new SummaryReportData(_teams, lastWeekMensHighSeries,
                                                                        overallMensHighSeries, lastWeekMensHighGames,
                                                                        overallMensHighGames, lastWeekWomensHighSeries,
                                                                        overallWomensHighSeries, lastWeekWomensHighGames,
                                                                        overallWomensHighGames);

            new PrintSummaryReport().Print(summaryReportData, SelectedWeek);
        }