Ejemplo n.º 1
0
        public void TestGetPlayerById()
        {
            PlayerRepository playerRepo       = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestGetPlayerById"));
            PlayerController playerController = new PlayerController(playerRepo);

            var actionResult = playerController.GetById(10);

            Assert.IsNotType <BadRequestObjectResult>(actionResult.Result);
        }
Ejemplo n.º 2
0
        public void TestDelete()
        {
            CategoryRepository categoryRepo       = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestDelete"));
            CategoryController categoryController = new CategoryController(categoryRepo);

            var actionResult = categoryController.Delete(36);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
Ejemplo n.º 3
0
        public void TestDeleteQuestionController()
        {
            QuestionRepository questionRepo       = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteQuestionController"));
            QuestionController questionController = new QuestionController(questionRepo);

            var actionResult = questionController.Delete(11);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
        public void TestGetQuestionsAndAnswers()
        {
            GameRepository gameRepo       = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionsAndAnswers"));
            GameController gameController = new GameController(gameRepo);

            var actionResult = gameController.GetQuestionsAndAnswers(1);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
        public void TestGetGameByIdController()
        {
            GameRepository gameRepo       = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetGameByIdController"));
            GameController gameController = new GameController(gameRepo);

            var actionResult = gameController.GetById(4);

            Assert.IsNotType <BadRequestObjectResult>(actionResult.Result);
        }
Ejemplo n.º 6
0
        public void TestDeletePlayerController()
        {
            PlayerRepository playerRepo       = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestDeletePlayerController"));
            PlayerController playerController = new PlayerController(playerRepo);

            var actionResult = playerController.Delete(12);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
Ejemplo n.º 7
0
        public void TestGetQuestionByIdController()
        {
            QuestionRepository questionRepo       = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionByIdController"));
            QuestionController questionController = new QuestionController(questionRepo);

            var actionResult = questionController.GetById(10);

            Assert.IsNotType <BadRequestObjectResult>(actionResult.Result);
        }
        public void TestUpdateScoreValidation()
        {
            ApplicationContext _context = DatabaseDummy.DatabaseDummyCreate("TestUpdateScoreValidation");
            var player  = _context.Players.Where(a => a.PlayerName == "Elena").FirstOrDefault();
            var players = _context.Players.Where(a => a.GameroomId == player.GameroomId).ToList();

            bool updateScoreValidationResult = Validation.UpdateScoreValidation(players, player.PlayerName);

            Assert.True(updateScoreValidationResult);
        }
        public void TestPostGames()
        {
            GameRepository gameRepo       = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestPostGames"));
            GameController gameController = new GameController(gameRepo);
            Game           game           = new Game()
            {
                UniqueKey = 8,
            };
            var actionResult = gameController.PostGames(game);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
Ejemplo n.º 10
0
        public void TestPostPlayer()
        {
            PlayerRepository playerRepo       = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestPostPlayer"));
            PlayerController playerController = new PlayerController(playerRepo);
            PlayerUniqueKey  player           = new PlayerUniqueKey
            {
                PlayerName = "Andreea",
                UniqueKey  = 1
            };
            var actionResult = playerController.PostPlayer(player);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
Ejemplo n.º 11
0
        public void TestUpdatePlayerScoreController()
        {
            PlayerRepository playerRepo       = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestUpdatePlayerScoreController"));
            PlayerController playerController = new PlayerController(playerRepo);
            PlayerScore      player           = new PlayerScore()
            {
                Name      = "Dana",
                Score     = 50,
                UniqueKey = 1
            };
            var actionResult = playerController.UpdatePlayerScore(player);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
        public void TestDeleteCategory()
        {
            CategoryRepository categoryRepo = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteCategory"));

            try
            {
                categoryRepo.Delete(34);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 13
0
        public void TestGetPlayersByUniqueKey()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetPlayersByRoomId"));

            try
            {
                var players = gameRepo.GetPlayersByUniqueKey(1);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 14
0
        public void TestGetByIDGame()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDGame"));

            try
            {
                var game = gameRepo.GetByID(4);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 15
0
        public void TestGetByIDPlayer()
        {
            PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDPlayer"));

            try
            {
                var player = playerRepo.GetByID(10);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 16
0
        public void TestGetQuestionsAndAnswersByUniqueKey()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionsAndAnswersByGameRoomId"));

            try
            {
                var questions = gameRepo.GetQuestionsAndAnswersByUniqueKey(1);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 17
0
        public void TestGetAverageScore()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetAverageScore"));

            try
            {
                var averageScore = gameRepo.GetAverageScore(1);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
        public void TestCreatePlayerValidation()
        {
            ApplicationContext _context = DatabaseDummy.DatabaseDummyCreate("TestCreatePlayerValidation");
            Player             player   = new Player();

            player.PlayerName  = "Paul";
            player.PlayerScore = 5000;
            player.GameroomId  = 4;
            var players = _context.Players.Where(a => a.GameroomId == player.GameroomId).ToList();

            bool createPlayerValidationResult = Validation.CreatePlayerValidation(players, player);

            Assert.True(createPlayerValidationResult);
        }
Ejemplo n.º 19
0
        public void TestUpdatePlayerScore()
        {
            PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestUpdatePlayerScore"));

            try
            {
                playerRepo.UpdatePlayerScore(1, "Elena", 50);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 20
0
        public void TestGetQuestionByID()
        {
            QuestionRepository questionRepo = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionByID"));

            try
            {
                var question = questionRepo.GetByID(10);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 21
0
        public void TestDeletePlayer()
        {
            PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestDeletePlayer"));

            try
            {
                playerRepo.Delete(10);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 22
0
        public void TestDeleteQuestion()
        {
            QuestionRepository questionRepo = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteQuestion"));

            try
            {
                questionRepo.Delete(10);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 23
0
        public void TestDeleteGame()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteGame"));

            try
            {
                gameRepo.Delete(4);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
        public void TestGetByIDCategory()
        {
            CategoryRepository categoryRepo = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDCategory"));

            try
            {
                var category = categoryRepo.GetByID(35);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 25
0
        public void TestCreateCategoryController()
        {
            CategoryRepository categoryRepo       = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestCreateCategoryController"));
            CategoryController categoryController = new CategoryController(categoryRepo);

            Category category = new Category
            {
                CategoryName = "History",
                NumberOfUses = 0
            };

            var actionResult = categoryController.CreateCategory(category);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
Ejemplo n.º 26
0
        public void TestCreateGame()
        {
            GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestCreateGame"));
            Game           game     = new Game();

            game.UniqueKey = 3;

            try
            {
                gameRepo.Create(game);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 27
0
        public void TestPostQuestion()
        {
            QuestionRepository questionRepo       = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestPostQuestion"));
            QuestionController questionController = new QuestionController(questionRepo);
            Question           question           = new Question()
            {
                QuestionText       = "Cine esti?",
                CorrectAnswer      = "Persoana",
                WrongAnswer1       = ",jscbvghszd",
                WrongAnswer2       = "sdjkdcudhsf",
                WrongAnswer3       = "Mama",
                QuestionDifficulty = 5
            };
            var actionResult = questionController.PostQuestion(question);

            Assert.IsNotType <BadRequestObjectResult>(actionResult);
        }
        public void TestCreateCategory()
        {
            var      categoryRepo = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestCreateCategory"));
            Category category     = new Category();

            category.CategoryName = "History";
            category.NumberOfUses = 0;

            try
            {
                categoryRepo.Create(category);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }
Ejemplo n.º 29
0
        public void TestPostCategories()
        {
            CategoryRepository categoryRepo       = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestPostCategories"));
            CategoryController categoryController = new CategoryController(categoryRepo);

            Password password = new Password();

            password.Pass = "******";
            try
            {
                var actionResult = categoryController.PostCategories(password);
                Assert.IsNotType <BadRequestObjectResult>(actionResult);
            }
            catch
            {
                Assert.True(true);
            }
        }
Ejemplo n.º 30
0
        public void TestCreatePlayer()
        {
            PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestCreatePlayer"));
            PlayerUniqueKey  player     = new PlayerUniqueKey
            {
                PlayerName = "Paul",
                UniqueKey  = 1
            };

            try
            {
                playerRepo.Create(player);
                Assert.True(true);
            }
            catch
            {
                Assert.True(false);
            }
        }