Exemple #1
0
        public void TestDatabaseDivisionLoaderFullAL2001()
        {
            database = new Db(conn);
            TeamGroupTree americanLeague2001 = DatabaseGroupLoader.LoadRoot("AL", 2001, database);

            Assert.IsTrue(americanLeague2001.Count == 3);
            Assert.IsTrue(americanLeague2001.GetTotalItemCount <Team>() == 14);
        }
Exemple #2
0
        public void TestDatabaseDivisionLoaderFullNL2001()
        {
            database = new Db(conn);
            TeamGroupTree nationalLeague2001 = DatabaseGroupLoader.LoadRoot("NL", 2001, database);

            Assert.IsTrue(nationalLeague2001.Count == 3);
            Assert.IsTrue(nationalLeague2001.GetTotalItemCount <Team>() == 16);
        }
Exemple #3
0
        public void TestDatabaseDivisionLoaderFullNL1980()
        {
            database = new Db(conn);
            TeamGroupTree nationalLeague1980 = DatabaseGroupLoader.LoadRoot("NL", 1980, database);

            Assert.IsTrue(nationalLeague1980.Count == 2);
            Assert.IsTrue(nationalLeague1980.GetTotalItemCount <Team>() == 12);
        }
Exemple #4
0
        public void TestDatabaseDivisionLoaderFullAL1980()
        {
            database = new Db(conn);
            TeamGroupTree americanLeague1980 = DatabaseGroupLoader.LoadRoot("AL", 1980, database);

            Assert.IsTrue(americanLeague1980.Count == 2);
            Assert.IsTrue(americanLeague1980.GetTotalItemCount <Team>() == 14);
        }
        public void TestRoundRobinFullDivisions1969()
        {
            Db            database           = new Db(conn);
            TeamGroupTree americanLeague1969 = DatabaseGroupLoader.LoadRoot("AL", 1969, database, 1);

            americanLeague1969.ParentDirectoryPath = System.IO.Path.Combine($"{ConfigurationManager.GetConfigurationValue("GAME_FILE_DIRECTORY")}");
            Assert.IsTrue(americanLeague1969.Count == 2);
            Assert.IsTrue(americanLeague1969.GetTotalItemCount <Team>() == 12);

            TeamGroupTree nationalLeague1969 = DatabaseGroupLoader.LoadRoot("NL", 1969, database, 1);

            nationalLeague1969.ParentDirectoryPath = System.IO.Path.Combine($"{ConfigurationManager.GetConfigurationValue("GAME_FILE_DIRECTORY")}");
            Assert.IsTrue(nationalLeague1969.Count == 2);
            Assert.IsTrue(nationalLeague1969.GetTotalItemCount <Team>() == 12);

            bool finished = false;

            americanLeague1969.Execute();
            nationalLeague1969.Execute();
            finished = true;
            Assert.IsTrue(finished);
        }
        /// <summary>
        /// Display the specified r.
        /// </summary>
        /// <param name="r">Runnable</param>
        public static void Display(Runnable r)
        {
            int level = 0;

            Console.WriteLine($"Please enter a league and year [e.g, AL 2001]");
            string[]      choice   = Console.ReadLine().Split(' ');
            Db            database = new Db(MainClass.conn);
            TeamGroupTree league   = DatabaseGroupLoader.LoadRoot(choice[0], Convert.ToInt32(choice[1]), database);

            Console.WriteLine($"{league.Name} ({league.GetTotalItemCount<Team>()})");
            foreach (TeamGroup group in league)
            {
                if (league.Count > 1)
                {
                    DisplayLevel(level + 1, $"{group.Name} ({group.GetTotalItemCount<Team>()})");
                }
                foreach (Team team in group)
                {
                    DisplayLevel(level + 2, $"{team.Name} ({team.Roster.Players.Length})");
                }
                Console.WriteLine();
            }
        }
Exemple #7
0
        public void TestDatabaseDivisionLoaderParts()
        {
            database = new Db(conn);
            Team yankees2001      = DatabaseTeamLoader.LoadTeam("New York", "Yankees", "NYA", 2001, database);
            Team diamondbacks2001 = DatabaseTeamLoader.LoadTeam("Arizona", "Diamondbacks", "ARI", 2001, database);
            Team mariners2001     = DatabaseTeamLoader.LoadTeam("Seattle", "Mariners", "SEA", 2001, database);

            Team orioles2001 = DatabaseTeamLoader.LoadTeam("Baltimore", "Orioles", "BAL", 2001, database);
            Team redsox2001  = DatabaseTeamLoader.LoadTeam("Boston", "Red Sox", "BOS", 2001, database);
            Team astros2001  = DatabaseTeamLoader.LoadTeam("Houston", "Astros", "HOU", 2001, database);


            Team[] teams  = { yankees2001, diamondbacks2001, mariners2001 };
            Team[] teams2 = { orioles2001, redsox2001, astros2001 };

            TeamGroupTree nationalLeague2001 = new TeamGroupTree("NL2001", "National League 2001");

            nationalLeague2001.Add(new TeamGroup("NLW2001", "National League West 2001", teams));
            nationalLeague2001.Add(new TeamGroup("NLE2001", "National League East 2001", teams2));
            Assert.IsTrue(nationalLeague2001.GetTotalItemCount <Team>() == 6);
            Console.WriteLine(nationalLeague2001[0]);
            Console.WriteLine(nationalLeague2001[1]);
            Console.WriteLine(nationalLeague2001);
        }