Example #1
0
        public void TestRetrieveSpecificUserScore()
        {
            LeaderBoard leaderBoardRow = LeaderBoardDBConnector.GetLeaderBoardRow(dataSource, "t2");

            Assert.NotNull(leaderBoardRow);
            Assert.Equal(90, leaderBoardRow.Score);
        }
        public IActionResult Edit(LeaderBoard leaderBoard, string id)
        {
            leaderBoard.Username = id;
            LeaderBoardDBConnector.Update(Constants.DATA_SOURCE, leaderBoard);

            return Redirect("/LeaderBoard");
        }
Example #3
0
        public IActionResult Edit(string id)
        {
            LeaderBoard user = LeaderBoardDBConnector.GetLeaderBoardRow(Constants.DATA_SOURCE, id);

            user.Username = id;
            return(View(user));
        }
Example #4
0
        public void TestUpdate()
        {
            LeaderBoard userRank = new LeaderBoard();

            userRank.Username = "******";
            userRank.Score    = 40;
            Assert.True(LeaderBoardDBConnector.Update(dataSource, userRank));
        }
        public IActionResult IndexAPI()
        {
            ViewBag.Active = "LeaderBoard";

            var board = LeaderBoardDBConnector.GetLeaderBoard(Constants.DATA_SOURCE);

            return Json(board);
        }
        public IActionResult Index([FromHeader]string sendJson)
        {
            ViewBag.Active = "LeaderBoard";

            var board = LeaderBoardDBConnector.GetLeaderBoard(Constants.DATA_SOURCE);

            return sendJson != null && sendJson.Equals("True") ? Json(board) : (IActionResult)View(board);
        }
Example #7
0
        public void TestDelete()
        {
            LeaderBoard userRank = new LeaderBoard();

            userRank.Username = "******";
            userRank.Score    = 50;
            Assert.True(LeaderBoardDBConnector.Create(dataSource, userRank));

            List <LeaderBoard> leaderboard = LeaderBoardDBConnector.GetLeaderBoard(dataSource);

            Assert.NotNull(leaderboard);
            int count = leaderboard.Count;

            Assert.True(LeaderBoardDBConnector.Delete(dataSource, "Test Delete User"));

            leaderboard = LeaderBoardDBConnector.GetLeaderBoard(dataSource);

            Assert.NotNull(leaderboard);
            Assert.Equal(count - 1, leaderboard.Count);
        }
Example #8
0
        public void TestGetUsersNotOnLeaderBoard()
        {
            List <LeaderBoard> usersNotOnLeaderboard = LeaderBoardDBConnector.GetUsersNotOnLeaderBoard(dataSource);

            Assert.NotNull(usersNotOnLeaderboard);
        }
Example #9
0
        public void TestEntireLeaderBoard()
        {
            List <LeaderBoard> userScores = LeaderBoardDBConnector.GetLeaderBoard(dataSource);

            Assert.NotNull(userScores);
        }
 public IActionResult Delete(string id)
 {
     LeaderBoardDBConnector.Delete(Constants.DATA_SOURCE, id);
     return Redirect("/LeaderBoard");
 }
 public IActionResult Add()
 {
     return View(LeaderBoardDBConnector.GetUsersNotOnLeaderBoard(Constants.DATA_SOURCE));
 }