public void CanRemoveBracketRoundFromTournamentById() { List <Guid> roundIds = new List <Guid>(); using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); RoundBase round = tournamentRepository.AddBracketRoundToTournament(tournament); roundIds.Add(round.Id); round = tournamentRepository.AddDualTournamentRoundToTournament(tournament); roundIds.Add(round.Id); round = tournamentRepository.AddRoundRobinRoundToTournament(tournament); roundIds.Add(round.Id); tournamentRepository.Save(); } using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); foreach (Guid roundId in roundIds) { bool removeResult = tournamentRepository.RemoveRoundFromTournament(tournament, roundId); tournamentRepository.Save(); removeResult.Should().BeTrue(); } tournament.Rounds.Should().BeEmpty(); } }
public void CannotChangeAdvancingPerGroupCountInBracketRound() { using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); RoundBase round = tournamentRepository.AddBracketRoundToTournament(tournament); const int newAdvancingCount = 3; const int expectedAdvancingCount = 1; bool changeResult = tournamentRepository.SetAdvancingPerGroupCountInRound(round, newAdvancingCount); changeResult.Should().BeFalse(); round.AdvancingPerGroupCount.Should().Be(expectedAdvancingCount); } }
public void CanRenameRoundsInTournament() { string newName = "Round No Spamerino In The Chatterino"; using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); RoundBase round = tournamentRepository.AddBracketRoundToTournament(tournament); round.Name.Should().Be("Round A"); bool renameResult = tournamentRepository.RenameRoundInTournament(round, newName); renameResult.Should().BeTrue(); round.Name.Should().Be(newName); } }
public void GivenTournamentAddsRounds(string tournamentName, Table table) { using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); foreach (TableRow row in table.Rows) { TestUtilities.ParseRoundTable(row, out ContestTypeEnum contestType, out string name, out int advancingCount, out int playersPerGroupCount); if (contestType != ContestTypeEnum.None) { RoundBase round = null; if (contestType == ContestTypeEnum.Bracket) { round = tournamentRepository.AddBracketRoundToTournament(tournament); } else if (contestType == ContestTypeEnum.DualTournament) { round = tournamentRepository.AddDualTournamentRoundToTournament(tournament); } else if (contestType == ContestTypeEnum.RoundRobin) { round = tournamentRepository.AddRoundRobinRoundToTournament(tournament); } tournamentRepository.Save(); if (round == null) { return; } tournamentRepository.RenameRoundInTournament(round, name); tournamentRepository.SetAdvancingPerGroupCountInRound(round, advancingCount); tournamentRepository.SetPlayersPerGroupCountInRound(round, playersPerGroupCount); tournamentRepository.Save(); } } } }
public void CanAddBracketRoundToTournament() { using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); tournament.Rounds.Should().BeEmpty(); tournamentRepository.AddBracketRoundToTournament(tournament); tournamentRepository.Save(); tournament.Rounds.Should().HaveCount(1); tournament.Rounds.First().Should().BeOfType <BracketRound>(); } using (TournamentRepository tournamentRepository = CreateTournamentRepository()) { Tournament tournament = tournamentRepository.GetTournamentByName(tournamentName); tournament.Rounds.Should().HaveCount(1); tournament.Rounds.First().Should().BeOfType <BracketRound>(); } }