private Team createTestTeam(int w, int l)
        {
            Team Team = new Team(RecordIndex.getNextId(RecordIndex.INDEX.TestTeamId), "XXX", Program.LEAGUES[0].Length);

            Team.Wins  = w;
            Team.Loses = l;
            return(Team);
        }
        public void testPythagoreanTheorem()
        {
            Team team = new Team(RecordIndex.getNextId(RecordIndex.INDEX.TestTeamId), "AL TEST", Program.LEAGUES[0].Length);

            team.RunsScored  = 533;
            team.RunsAllowed = 788;

            Assert.AreEqual(0.314, team.PythagoreanTheorem);
        }
        public void Initialize()
        {
            Config.PRT_FILE_LOCATION = "testData";
            Config.LEAGUE_NAME       = "";
            Report.DATABASE.reset();
            RecordIndex.resetIndex(RecordIndex.INDEX.TestTeamId);

            SOMReportFile file = new SOMReportFile(Config.getConfigurationFile("ALL_REPORTS.PRT"));

            file.parseLeagueFile();
            leagueStandingsReport = (LeagueStandingsReport)file.FindReport("LEAGUE STANDINGS FOR");
            leagueStandingsReport.processReport(Program.LEAGUES[0].Length);

            leaguePrimaryStatReport = (LeagueGrandTotalsReport)file.FindReport("LEAGUE GRAND TOTALS (primary report) FOR");
            leaguePrimaryStatReport.processReport(Program.LEAGUES[0].Length);
        }
예제 #4
0
        public void collectData(string line)
        {
            String headerRegEx = header_contains_League ? REGEX_HEADER : REGEX_HEADER_NO_LEAGUE;
            Regex  regex       = new Regex(headerRegEx);
            Match  headerMatch = regex.Match(line);

            if (headerMatch.Success && isThisADivisionName(line))
            {
                m_CurrentDivision = headerMatch.Groups[1].Value.Trim();
            }
            else
            {
                regex = new Regex(REGEX_TEAM_RECORD);
                Match teamMatch = regex.Match(line);
                if (teamMatch.Success)
                {
                    String name = teamMatch.Groups[1].Value.Trim();
                    name = name.Substring(0, name.Length - 1).Trim();
                    if (name.Length > 7)
                    {
                        String abv = name.Substring(name.Length - 3).Trim();
                        if (abv.Length == 3)
                        {
                            name = name.Substring(0, name.Length - 3);

                            Team team = new Team(RecordIndex.getNextId(RecordIndex.INDEX.TeamId), m_CurrentDivision, Program.LEAGUES[0].Length);
                            team.Name  = name.Trim();
                            team.Abrv  = abv;
                            team.Wins  = Convert.ToInt32(teamMatch.Groups[2].Value.Trim());
                            team.Loses = Convert.ToInt32(teamMatch.Groups[3].Value.Trim());
                            //        team.Wpct = Convert.ToDouble(teamMatch.Groups[4].Value.Trim());
                            String gamesBehind = teamMatch.Groups[5].Value.Trim();
                            if (gamesBehind.StartsWith("-"))
                            {
                                team.Gb = 0;
                            }
                            else
                            {
                                team.Gb = Convert.ToDouble(gamesBehind);
                            }
                            DATABASE.addTeam(team);
                        }
                    }
                }
            }
        }