Ejemplo n.º 1
0
 private void ValidateBracketNodeMatch(BracketNode bracketNode, Match correctMatch)
 {
     if (correctMatch == null)
     {
         bracketNode.Should().BeNull();
     }
     else
     {
         bracketNode.Match.Should().Be(correctMatch);
     }
 }
Ejemplo n.º 2
0
        public void CanConstructBracketNodeSystemWithUnevenPlayers()
        {
            List <string> playerNames = new List <string>()
            {
                "Maru", "Stork", "Taeja", "Rain", "Bomber", "FanTaSy", "Stephano"
            };

            bracketRound.SetPlayersPerGroupCount(playerNames.Count);

            foreach (string playerName in playerNames)
            {
                tournament.RegisterPlayerReference(playerName);
            }

            bracketGroup = bracketRound.Groups.First() as BracketGroup;

            BracketNode finalNode = bracketGroup.BracketNodeSystem.FinalNode;

            ValidateBracketNodeConnections(finalNode, null, bracketGroup.Matches[4], bracketGroup.Matches[3]);

            BracketNode semifinalNode1 = finalNode.Children[0];
            BracketNode semifinalNode2 = finalNode.Children[1];

            ValidateBracketNodeConnections(semifinalNode1, bracketGroup.Matches[5], bracketGroup.Matches[2], bracketGroup.Matches[1]);
            ValidateBracketNodeConnections(semifinalNode2, bracketGroup.Matches[5], bracketGroup.Matches[0], null);

            BracketNode quarterfinalNode1 = semifinalNode1.Children[0];
            BracketNode quarterfinalNode2 = semifinalNode1.Children[1];

            BracketNode quarterfinalNode3 = semifinalNode2.Children[0];
            BracketNode quarterfinalNode4 = semifinalNode2.Children[1];

            ValidateBracketNodeConnections(quarterfinalNode1, bracketGroup.Matches[4], null, null);
            ValidateBracketNodeConnections(quarterfinalNode2, bracketGroup.Matches[4], null, null);

            ValidateBracketNodeConnections(quarterfinalNode3, bracketGroup.Matches[3], null, null);
            quarterfinalNode4.Should().BeNull();
        }