Exemplo n.º 1
0
        public void EliminateLosingPlayerTest()
        {
            FakeObjects.FakeSingleElimination singleElimination = new FakeObjects.FakeSingleElimination(new TournamentLog());
            singleElimination.EliminateLosingPlayers(singleElimination.losers);

            Assert.IsTrue(singleElimination.Players.Count == 2);
            Assert.IsTrue(singleElimination.Players.Contains(singleElimination.playerB));
            Assert.IsTrue(singleElimination.Players.Contains(singleElimination.playerD));
            Assert.IsTrue(!singleElimination.Players.Contains(singleElimination.playerA));
            Assert.IsTrue(!singleElimination.Players.Contains(singleElimination.playerC));
        }
Exemplo n.º 2
0
        public void TestShufflePlayers()
        {
            FakeObjects.FakeSingleElimination tournamentTree = new FakeObjects.FakeSingleElimination(new TournamentLog());
            tournamentTree.ShufflePlayers(tournamentTree.EightPlayers);

            bool isShuffled = false;

            for (int i = 0; i < tournamentTree.EightPlayers.Count; i++)
            {
                if (tournamentTree.EightPlayers[i].PlayerID != tournamentTree.OriginalPlayerOrder[i].PlayerID)
                {
                    isShuffled = true;
                    break;
                }
            }
            Assert.IsTrue(isShuffled);
        }
Exemplo n.º 3
0
        public void CreateTreeTest()
        {
            FakeObjects.FakeSingleElimination singleElimination = new FakeObjects.FakeSingleElimination(new TournamentLog());
            singleElimination.FirstTree = false;

            string showTree = "Bracket";

            showTree += "\n------------------------------------------------------\n\n";
            showTree += singleElimination.Players[0].ToString() + "\n";
            showTree += "VERSUS\n";
            showTree += singleElimination.Players[1].ToString() + "\n";
            showTree += "\n";
            showTree += singleElimination.Players[2].ToString() + "\n";
            showTree += "VERSUS\n";
            showTree += singleElimination.Players[3].ToString() + "\n";
            showTree += "\n";
            showTree += "------------------------------------------------------\n";

            Assert.AreEqual(showTree, singleElimination.CreateTree(singleElimination.Players));
        }