//[ExpectedException(typeof(WrongEncodedArrayFormat))] public void MustRaiseFormatErrorWithNoRound() { var encodedArray = new StringBuilder(); encodedArray.Append("["); encodedArray.Append(" ["); encodedArray.Append(" [\"Armando\", \"P\"],[\"Dave\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"Richard\", \"R\"],[\"Michael\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"Allen\", \"S\"],[\"Omer\", \"P\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"David E.\", \"R\"],[\"Richard X.\", \"P\"]"); encodedArray.Append(" ]"); encodedArray.Append("]"); try { var tournament = TournamentFactory.Parse(encodedArray.ToString()); } catch (Exception ex) { Assert.AreEqual(typeof(WrongEncodedArrayFormat), ex.GetType()); } }
//[ExpectedException(typeof(WrongPlayerStructureError))] public void MustCheckStructureOfPlayerNode() { var encodedArray = new StringBuilder(); encodedArray.Append("["); encodedArray.Append(" ["); encodedArray.Append(" ["); encodedArray.Append(" [\"Armando\", \"P\"],[\"Dave\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"Richard\", \"R\"],[\"Michael\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" ["); encodedArray.Append(" [\"Allen\", \"S\"],[\"Omer\", \"P\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"David E.\", \"R\"],[\"Richard X.\", \"P\", \"AAA\"]"); encodedArray.Append(" ]"); encodedArray.Append(" ]"); encodedArray.Append("]"); try { var tournament = TournamentFactory.Parse(encodedArray.ToString()); } catch (Exception ex) { Assert.AreEqual(typeof(WrongPlayerStructureError), ex.GetType()); } }
public void GetTournamentData() { TournamentFactory data = new TournamentFactory(); this.Tournament = data.GetTournamentDetails(); this.Matches = data.GetAllTournamentMatches(this.Tournament.Teams, this.Tournament.StartDate); }
public async Task <ActionResult <List <List <PlayerModel> > > > GetPairing(Guid tournamentID) { TournamentModel model = await _context.Tournaments .FindAsync(tournamentID); var playersModels = await _context.Players .Where(p => p.TournamentGuid == tournamentID) .Include(p => p.Opponents) .ToListAsync(); if (model == null || playersModels == null) { return(BadRequest()); } if (playersModels.Count % 2 == 1) { playersModels = await AddByePlayer(playersModels); } model.Players = playersModels; Tournament tournament = TournamentFactory.GetTournamentFromModel(model, playersModels); List <List <int> > pairings = tournament.Pair(); List <List <PlayerModel> > playersModelsPairing = GetPlayerModelsByIdInTournament(model, pairings); return(playersModelsPairing); }
public static ITournament GetTournamentFromDB(String turniername, List <ICompetitor> teilnehmerListe) { TournamentFactory tF = new TournamentFactory(); IGameMode gm; if (FindTournament(turniername).IsFinished == true) { throw new Exception("Das Turnier wurde bereits gespielt"); } if (FindTournament(turniername).Gamemode == "Double Elimination") { gm = new DoubleElimination(); } else if (FindTournament(turniername).Gamemode == "Ranked Solo Match") { gm = new RankedSoloMatch(); } else if (FindTournament(turniername).Gamemode.Equals("Ranked Team Match")) { gm = new RankedTeamMatch(); } else { throw new Exception("GameMode existiert nicht"); } return(tF.CreateTournament(turniername, teilnehmerListe, FindTournament(turniername).AmountSets, FindTournament(turniername).AmountGoals, gm, FindTournament(turniername).IsRanked)); }
public Tournament(TournamentDTO tournamentDTO, string source) { ID = tournamentDTO.ID; Name = tournamentDTO.Name; OrganisationID = tournamentDTO.OrganisationID; UserID = tournamentDTO.UserID; Size = tournamentDTO.Size; Prize = tournamentDTO.Prize; BuyIn = tournamentDTO.BuyIn; Game = tournamentDTO.Game; StartTime = tournamentDTO.StartTime; Status = tournamentDTO.Status; TeamSize = tournamentDTO.TeamSize; tournamentDB = TournamentFactory.GetTournamentDB(source); }
//[ExpectedException(typeof(WrongNumberOfTournamentRounds))] public void MustCheckNumberOfInicialRounds() { var encodedArray = new StringBuilder(); encodedArray.Append("["); encodedArray.Append(" ["); encodedArray.Append(" ["); encodedArray.Append(" [\"Armando\", \"P\"],[\"Dave\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"Richard\", \"R\"],[\"Michael\", \"S\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" ["); encodedArray.Append(" [\"Allen\", \"S\"],[\"Omer\", \"P\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"David E.\", \"R\"],[\"Richard X.\", \"P\"]"); encodedArray.Append(" ]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" ["); encodedArray.Append(" [\"Batman\", \"S\"],[\"Joker\", \"P\"]"); encodedArray.Append(" ],"); encodedArray.Append(" ["); encodedArray.Append(" [\"Luke\", \"R\"],[\"Vader\", \"S\"]"); encodedArray.Append(" ]"); encodedArray.Append(" ]"); encodedArray.Append("]"); try { var tournament = TournamentFactory.Parse(encodedArray.ToString()); } catch (Exception ex) { Assert.AreEqual(typeof(WrongNumberOfTournamentRounds), ex.GetType()); } }
public void RestartOrInitTournament() { State = SimulationState.Initialized; Tournament = TournamentFactory.GetTournament(TournamentType); }
public TournamentManager(string DataSource) { tournamentDB = TournamentFactory.GetTournamentManagerDB(DataSource); userDB = UserFactory.GetUserDB(DataSource); }