Beispiel #1
0
        public void Add_Match()
        {
            var        db           = new DatabaseRepository("VictoriousEntities");
            int        tournamentId = db.GetAllTournaments()[0].TournamentID;
            MatchModel match        = new MatchModel()
            {
                BracketID    = db.GetAllBracketsInTournament(tournamentId)[0].BracketID,
                ChallengerID = db.GetAllUsersInTournament(tournamentId)[0].TournamentUserID,
                DefenderID   = db.GetAllUsersInTournament(tournamentId)[1].TournamentUserID,
                MatchNumber  = 1
            };

            var result = db.AddMatch(match);

            Assert.AreEqual(DbError.SUCCESS, result);
        }
Beispiel #2
0
        public void Set_Challenger()
        {
            var db = new DatabaseRepository("VictoriousEntities");

            MatchModel match = new MatchModel()
            {
                BracketID    = 3,
                ChallengerID = 1,
                DefenderID   = 2,
                MatchNumber  = 1
            };

            db.AddMatch(match);

            Assert.AreEqual(1, match.Challenger.TournamentUserID);
        }
Beispiel #3
0
        public void Add_Match_And_Get_Challenger()
        {
            var db = new DatabaseRepository("VictoriousEntities");

            MatchModel match = new MatchModel()
            {
                BracketID    = 3,
                ChallengerID = 1,
                DefenderID   = 2,
                MatchNumber  = 1
            };

            db.AddMatch(match);

            TournamentUserModel user = match.Challenger;

            Assert.AreEqual(db.GetTournamentUser(match.ChallengerID), user);
        }