예제 #1
0
 public RoundRobinStartDateTimeTests()
 {
     tournament = Tournament.Create("GSL 2019");
     tournamentIssueReporter = tournament.TournamentIssueReporter;
     roundRobinRound         = tournament.AddRoundRobinRound() as RoundRobinRound;
     tournament.AddBracketRound();
 }
        public RoundRobinGroupLayoutAssemblerTests()
        {
            tournament      = Tournament.Create("GSL 2019");
            roundRobinRound = tournament.AddRoundRobinRound() as RoundRobinRound;
            roundRobinGroup = RoundRobinGroup.Create(roundRobinRound);

            playerReferences = new List <PlayerReference>();
            playerReferences.Add(PlayerReference.Create("Maru", tournament));
            playerReferences.Add(PlayerReference.Create("Stork", tournament));
            playerReferences.Add(PlayerReference.Create("Taeja", tournament));
            playerReferences.Add(PlayerReference.Create("Rain", tournament));
            playerReferences.Add(PlayerReference.Create("Bomber", tournament));
            playerReferences.Add(PlayerReference.Create("FanTaSy", tournament));
            playerReferences.Add(PlayerReference.Create("Stephano", tournament));
            playerReferences.Add(PlayerReference.Create("Thorzain", tournament));

            maruId     = playerReferences[0].Id;
            storkId    = playerReferences[1].Id;
            taejaId    = playerReferences[2].Id;
            rainId     = playerReferences[3].Id;
            bomberId   = playerReferences[4].Id;
            fantasyId  = playerReferences[5].Id;
            stephanoId = playerReferences[6].Id;
            thorzainId = playerReferences[7].Id;
        }
예제 #3
0
        public void CanChangeAdvancingPerGroupCount()
        {
            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.AdvancingPerGroupCount.Should().Be(1);
            round.SetAdvancingPerGroupCount(4);
            round.AdvancingPerGroupCount.Should().Be(4);
        }
예제 #4
0
        public void CannotRenameRoundToEmptyname()
        {
            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.RenameTo("");

            round.Name.Should().Be("Round A");
        }
예제 #5
0
        public void CanFetchLastRound()
        {
            tournament.AddBracketRound();
            tournament.AddDualTournamentRound();
            RoundRobinRound lastRound = tournament.AddRoundRobinRound();

            tournament.GetLastRound().Should().Be(lastRound);
        }
예제 #6
0
        public void CanRenameRound()
        {
            string newName = "New Round Name";

            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.RenameTo(newName);

            round.Name.Should().Be(newName);
        }
예제 #7
0
        public void CanExcludePlayerReferencesFromTournament()
        {
            string playerName = "Maru";

            RoundRobinRound round = tournament.AddRoundRobinRound();

            tournament.RegisterPlayerReference(playerName);
            bool exclusionResult = tournament.ExcludePlayerReference(playerName);

            exclusionResult.Should().BeTrue();
            tournament.PlayerReferences.Should().BeEmpty();
        }
예제 #8
0
        public void CannotSetAdvancingPerGroupCountToAnythingLessThanOne()
        {
            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.AdvancingPerGroupCount.Should().Be(1);

            round.SetPlayersPerGroupCount(0);
            round.SetPlayersPerGroupCount(-1);
            round.SetPlayersPerGroupCount(-2);

            round.AdvancingPerGroupCount.Should().Be(1);
        }
예제 #9
0
        public void CanChangePlayersPerGroupSize()
        {
            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.Groups.First().Matches.Should().HaveCount(1);
            round.PlayersPerGroupCount.Should().Be(2);

            round.SetPlayersPerGroupCount(4);

            round.Groups.First().Matches.Should().HaveCount(6);
            round.PlayersPerGroupCount.Should().Be(4);
        }
예제 #10
0
        public void CannotRenameRoundToTheSameAsOtherRoundNoMatterLetterCasing()
        {
            RoundRobinRound firstRound  = tournament.AddRoundRobinRound();
            RoundRobinRound secondRound = tournament.AddRoundRobinRound();

            string newName          = "New Round Name";
            string initialRoundName = secondRound.Name;

            firstRound.RenameTo(newName);
            secondRound.RenameTo(newName.ToLower());

            firstRound.Name.Should().Be(newName);
            secondRound.Name.Should().Be(initialRoundName);
        }
예제 #11
0
        public void AddingSeveralRoundsYieldsRoundsWithExpectedNames()
        {
            RoundRobinRound firstRound  = tournament.AddRoundRobinRound();
            RoundRobinRound secondRound = tournament.AddRoundRobinRound();
            RoundRobinRound thirdRound  = tournament.AddRoundRobinRound();
            RoundRobinRound fourthRound = tournament.AddRoundRobinRound();
            RoundRobinRound fifthRound  = tournament.AddRoundRobinRound();

            firstRound.Name.Should().Be("Round A");
            secondRound.Name.Should().Be("Round B");
            thirdRound.Name.Should().Be("Round C");
            fourthRound.Name.Should().Be("Round D");
            fifthRound.Name.Should().Be("Round E");
        }
예제 #12
0
        public void CannotSetPlayersPerGroupSizeToAnythingLessThanTwo()
        {
            RoundRobinRound round = tournament.AddRoundRobinRound();

            round.Groups.First().Matches.Should().HaveCount(1);
            round.PlayersPerGroupCount.Should().Be(2);

            round.SetPlayersPerGroupCount(1);
            round.SetPlayersPerGroupCount(0);
            round.SetPlayersPerGroupCount(-1);

            round.Groups.First().Matches.Should().HaveCount(1);
            round.PlayersPerGroupCount.Should().Be(2);
        }
예제 #13
0
        public void CanRegisterPlayerReferencesToTournament()
        {
            string playerName = "Maru";

            RoundRobinRound round = tournament.AddRoundRobinRound();

            PlayerReference playerReference = tournament.RegisterPlayerReference(playerName);

            playerReference.Id.Should().NotBeEmpty();
            playerReference.Name.Should().Be(playerName);
            playerReference.TournamentId.Should().Be(round.TournamentId);
            playerReference.Tournament.Should().Be(round.Tournament);

            tournament.PlayerReferences.First().Should().Be(playerReference);
        }
예제 #14
0
        protected void InitializeRoundGroupAndPlayers()
        {
            using (TournamentRepository tournamentRepository = CreateTournamentRepository())
            {
                Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName);

                RoundRobinRound round = tournamentRepository.AddRoundRobinRoundToTournament(tournament);
                tournamentRepository.SetPlayersPerGroupCountInRound(round, playerNames.Count);

                foreach (string playerName in playerNames)
                {
                    tournamentRepository.AddPlayerReference(tournament, playerName);
                }

                tournamentRepository.Save();
            }
        }
예제 #15
0
        public static RoundRobinGroup Create(RoundRobinRound round)
        {
            if (round == null)
            {
                return(null);
            }

            RoundRobinGroup group = new RoundRobinGroup()
            {
                RoundId = round.Id,
                Round   = round
            };

            group.AssignDefaultName();

            return(group);
        }
예제 #16
0
파일: Tournament.cs 프로젝트: Gherks/slask
        public RoundRobinRound AddRoundRobinRound()
        {
            RoundRobinRound round = RoundRobinRound.Create(this);

            if (round == null)
            {
                return(null);
            }

            bool roundWasIntegrated = IntegrateRoundToTournament(round);

            if (roundWasIntegrated)
            {
                return(round);
            }

            return(null);
        }
예제 #17
0
        public PlayerInRoundRobinGroupTests()
        {
            tournament = Tournament.Create("GSL 2019");
            round      = tournament.AddRoundRobinRound();
            round.SetAdvancingPerGroupCount(1);
            round.SetPlayersPerGroupCount(4);

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

            group = round.Groups.First() as RoundRobinGroup;
            match = group.Matches.First();
            match.SetBestOf(5);

            player = match.Player1;
        }
예제 #18
0
 public RoundRobinGroupTests()
 {
     tournament = Tournament.Create("GSL 2019");
     round      = tournament.AddRoundRobinRound() as RoundRobinRound;
 }