示例#1
0
文件: UnitTest.cs 项目: tustran/KTPMM
 public void BeforeMatch()
 {
     for (int i = 0; i < 1; i++)
     {
         TeamMatch team = new TeamMatch(i, 3);
         team.registerTeam(1, 1, 1, 5);
         bool x = team.Regis_beforeMatch();
         Assert.AreEqual(false, x);
     }
 }
示例#2
0
 public void BeforeMatch()
 {
     for (int i = 0; i < 1; i++)
     {
         Team team = new Team(3, 3);
         team.registerTeam(1, 1, 1, 11);
         TeamMatch winner = new TeamMatch(team);
         bool      x      = winner.Regis_beforeMatch(team);
         Assert.AreEqual(true, x);
     }
 }
示例#3
0
        static void Main(string[] args)
        {
            Database db = new Database();

            db.exeSQL("DELETE dbo.Nguoi DELETE dbo.DoiBong DELETE dbo.TranDau");

            int    j         = 1;
            Random rnd       = new Random();
            int    TranDauID = 1;

            for (int i = 0; i < 6; i++)//Châu Á
            {
                Team x = new Team(j, 1);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 5; i++)//Châu Phi
            {
                Team x = new Team(j, 2);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 4; i++)// Châu Bắc Mỹ
            {
                Team x = new Team(j, 3);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 4; i++)// Châu Nam Mỹ
            {
                Team x = new Team(j, 4);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 1; i++)// Châu Đại dương
            {
                Team x = new Team(j, 5);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 13; i++)// Châu Âu
            {
                Team x = new Team(j, 6);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }

            for (int i = 0; i < 1; i++)// Chủ nhà
            {
                Team x = new Team(j, 7);
                j++;
                x.registerTeam(1, rnd.Next(0, 3), 1, rnd.Next(11, 22));
                Team32.Add(x);
            }


            ////////////////////////////////////////////// PLAY_OFF ROUND////////////////////////////////////////
            TeamMatch play1 = new TeamMatch(6);//play-off chấu á, caribe..
            TeamMatch play2 = new TeamMatch(15);

            play1.Regis_beforeMatch(Team32[5]);
            play2.Regis_beforeMatch(Team32[14]);
            for (int i = 1; i <= 2; i++)
            {
                TranDau play_off = new TranDau(play1, play2, 0, TranDauID, 0);
                TranDauID++;
                play_off.LayTiso(rnd.Next(0, 1), rnd.Next(2, 5), i);
            }
            xuliPlayoff(1, 2, play1.TeamID, play2.TeamID);

            play1 = new TeamMatch(19);
            play2 = new TeamMatch(20);
            play1.Regis_beforeMatch(Team32[18]);
            play2.Regis_beforeMatch(Team32[19]);
            for (int i = 3; i <= 4; i++)
            {
                TranDau play_off = new TranDau(play1, play2, 0, TranDauID, 0);
                TranDauID++;
                play_off.LayTiso(rnd.Next(0, 1), rnd.Next(2, 5), i);
            }
            xuliPlayoff(3, 4, play1.TeamID, play2.TeamID);
            //////////////////////////////////////////////////////////////////////////////////////////////////////
        }