Exemple #1
0
        public void TestFinalsRound2()
        {
            var bracket = new Bracket();

            bracket.AddTeam("UCLA", 1, "North");
            bracket.AddTeam("USC", 2, "North");
            bracket.AddTeam("California", 3, "West");
            bracket.AddTeam("UNLV", 4, "West");
            bracket.AddTeam("Missouri", 5, "South");
            bracket.AddTeam("Florida", 6, "South");
            bracket.AddTeam("Houston", 7, "East");
            bracket.AddTeam("Tennessee", 8, "East");

            bracket.CreateNextRound();
            bracket.Rounds[0].Games[0].Resolve(bracket.Teams["UCLA"]);
            bracket.Rounds[0].Games[1].Resolve(bracket.Teams["California"]);
            bracket.Rounds[0].Games[2].Resolve(bracket.Teams["Missouri"]);
            bracket.Rounds[0].Games[3].Resolve(bracket.Teams["Houston"]);

            bracket.CreateNextRound();
            bracket.Rounds[1].Games[0].Resolve(bracket.Teams["UCLA"]);
            bracket.Rounds[1].Games[1].Resolve(bracket.Teams["Missouri"]);

            bracket.CreateNextRound();

            Assert.AreEqual(3, bracket.RoundNumber);
            Assert.AreEqual(8, bracket.Teams.Count);
            Assert.AreEqual(3, bracket.Rounds.Count);
            Assert.AreEqual(false, bracket.IsComplete());
            Assert.AreEqual(null, bracket.FindChampion());

            var round = bracket.Rounds[2];

            Assert.AreEqual(1, round.Games.Count);

            Assert.AreEqual("UCLA", round.Games[0].HomeTeam.Name);
            Assert.AreEqual("Missouri", round.Games[0].AwayTeam.Name);
            Assert.AreEqual(null, round.Games[0].Winner);
        }