Exemplo n.º 1
0
        private void ResolveUsersGeneralBets()
        {
            var generalBet = AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), DateTime.UtcNow.AddDays(4)).GetUserGeneralBet("Admin");

            AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), TournamentTimesUtils.GeneralBetsResolveTime.AddDays(4)).ResolveGeneralBet(generalBet.GeneralBetId, new ResolveGeneralBetModel()
            {
                PlayerIsRight = true, TeamIsRight = false
            });

            generalBet = AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), DateTime.UtcNow.AddDays(4)).GetUserGeneralBet("User1");
            AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), TournamentTimesUtils.GeneralBetsResolveTime.AddDays(4)).ResolveGeneralBet(generalBet.GeneralBetId, new ResolveGeneralBetModel()
            {
                PlayerIsRight = false, TeamIsRight = false
            });

            generalBet = AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), DateTime.UtcNow.AddDays(4)).GetUserGeneralBet("User2");
            AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), TournamentTimesUtils.GeneralBetsResolveTime.AddDays(4)).ResolveGeneralBet(generalBet.GeneralBetId, new ResolveGeneralBetModel()
            {
                PlayerIsRight = false, TeamIsRight = true
            });

            try
            {
                AcceptenceTestsUtils.GetGeneralBetsController(GetAdmin(), DateTime.UtcNow.AddDays(4)).GetUserGeneralBet("User3");
            }
            catch (ObjectNotFoundException) { }

            var allUsers = AcceptenceTestsUtils.GetUsersController(GetUser("User3"), DateTime.UtcNow.AddDays(4)).GetAllUsers().ToDictionary(item => item.Username, item => item);

            Assert.AreEqual(37, allUsers["Admin"].Points);
            Assert.AreEqual(16, allUsers["User1"].Points);
            Assert.AreEqual(35, allUsers["User2"].Points);
            Assert.AreEqual(7, allUsers["User3"].Points);
        }
Exemplo n.º 2
0
 public void CreateControllers()
 {
     AcceptenceTestsUtils.InitDatabase();
     users    = AcceptenceTestsUtils.GetUsersController(new UserModel(String.Empty, "Admin"), DateTime.UtcNow).GetAllUsers().ToDictionary(item => item.Username, item => item);
     teams    = AcceptenceTestsUtils.GetTeamsController().GetAllTeams().ToList();
     games    = AcceptenceTestsUtils.GetGamesController(GetAdmin(), DateTime.UtcNow).GetAllGames().ToList();
     stadiums = AcceptenceTestsUtils.GetStadiumsController().GetAllStadiums().ToList();
 }
Exemplo n.º 3
0
        private void ValidateTableAfterGameResultUpdate()
        {
            AcceptenceTestsUtils.GetGamesController(GetAdmin(), DateTime.UtcNow.AddDays(1)).PutGame(games[1].GameId, CreateGameWithBetData(games[1], 0, 1, "2", "1"));
            var allUsers = AcceptenceTestsUtils.GetUsersController(GetUser("User1"), DateTime.UtcNow.AddDays(1)).GetAllUsers().ToDictionary(item => item.Username, item => item);

            Assert.AreEqual(7, allUsers["Admin"].Points);
            Assert.AreEqual(6, allUsers["User1"].Points);
            Assert.AreEqual(10, allUsers["User2"].Points);
            Assert.AreEqual(5, allUsers["User3"].Points);
        }
Exemplo n.º 4
0
        private void ValidateTableAfterAllGames()
        {
            AcceptenceTestsUtils.GetGamesController(GetAdmin(), DateTime.UtcNow.AddDays(3)).PutGame(games[4].GameId, CreateGameWithBetData(games[4], 1, 1, "1", "1"));
            AcceptenceTestsUtils.GetGamesController(GetAdmin(), DateTime.UtcNow.AddDays(3)).PutGame(games[5].GameId, CreateGameWithBetData(games[5], 2, 0, "X", "1"));
            var allUsers = AcceptenceTestsUtils.GetUsersController(GetUser("User3"), DateTime.UtcNow.AddDays(3)).GetAllUsers().ToDictionary(item => item.Username, item => item);

            Assert.AreEqual(25, allUsers["Admin"].Points);
            Assert.AreEqual(16, allUsers["User1"].Points);
            Assert.AreEqual(23, allUsers["User2"].Points);
            Assert.AreEqual(7, allUsers["User3"].Points);
        }