Example #1
0
        public static void ParseRoundTable(TableRow row, out ContestTypeEnum roundType, out string name, out int advancingCount, out int playersPerGroupCount)
        {
            roundType            = ContestTypeEnum.None;
            name                 = "";
            advancingCount       = 1;
            playersPerGroupCount = 2;

            if (row.ContainsKey("Round type"))
            {
                roundType = ParseContestTypeString(row["Round type"]);
            }

            if (row.ContainsKey("Round name"))
            {
                name = row["Round name"];
            }

            if (row.ContainsKey("Advancing per group count"))
            {
                int.TryParse(row["Advancing per group count"], out advancingCount);
            }

            if (row.ContainsKey("Players per group count"))
            {
                int.TryParse(row["Players per group count"], out playersPerGroupCount);
            }
        }
Example #2
0
        public void ThenGroupsWithinRoundInFetchedTournamentIsOfType(int roundIndex, string tournamentName, string groupType)
        {
            Tournament tournament;

            using (TournamentRepository tournamentRepository = CreateTournamentRepository())
            {
                tournament = tournamentRepository.GetTournamentByName(tournamentName);
            }

            RoundBase       round       = tournament.Rounds[roundIndex];
            ContestTypeEnum contestType = TestUtilities.ParseContestTypeString(groupType);

            if (contestType == ContestTypeEnum.Bracket)
            {
                foreach (GroupBase group in round.Groups)
                {
                    group.ContestType.Should().Be(ContestTypeEnum.Bracket);

                    (group is BracketGroup).Should().BeTrue();
                    (group is DualTournamentGroup).Should().BeFalse();
                    (group is RoundRobinGroup).Should().BeFalse();
                }
            }
            else if (contestType == ContestTypeEnum.DualTournament)
            {
                foreach (GroupBase group in round.Groups)
                {
                    group.ContestType.Should().Be(ContestTypeEnum.DualTournament);

                    (group is BracketGroup).Should().BeFalse();
                    (group is DualTournamentGroup).Should().BeTrue();
                    (group is RoundRobinGroup).Should().BeFalse();
                }
            }
            else if (contestType == ContestTypeEnum.RoundRobin)
            {
                foreach (GroupBase group in round.Groups)
                {
                    group.ContestType.Should().Be(ContestTypeEnum.RoundRobin);

                    (group is BracketGroup).Should().BeFalse();
                    (group is DualTournamentGroup).Should().BeFalse();
                    (group is RoundRobinGroup).Should().BeTrue();
                }
            }
        }
Example #3
0
        public void ThenGroupShouldBeValidOfType(int groupIndex, string roundType)
        {
            ContestTypeEnum contestType = TestUtilities.ParseContestTypeString(roundType);

            GroupBase group = createdGroups[groupIndex];

            if (contestType == ContestTypeEnum.Bracket)
            {
                CheckGroupValidity <BracketGroup>(group);
            }
            else if (contestType == ContestTypeEnum.DualTournament)
            {
                CheckGroupValidity <DualTournamentGroup>(group);
            }
            else if (contestType == ContestTypeEnum.RoundRobin)
            {
                CheckGroupValidity <RoundRobinGroup>(group);
            }
        }