public void TestGetGamesController() { GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetGamesController")); GameController gameController = new GameController(gameRepo); var actionResult = gameController.GetGames(); Assert.IsNotType <BadRequestObjectResult>(actionResult.Result); }
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); }
public void TestDeletePlayerController() { PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestDeletePlayerController")); PlayerController playerController = new PlayerController(playerRepo); var actionResult = playerController.Delete(12); Assert.IsNotType <BadRequestObjectResult>(actionResult); }
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); }
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); }
public void TestGetByIDCategory() { CategoryRepository categoryRepo = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDCategory")); try { var category = categoryRepo.GetByID(35); Assert.True(true); } catch { Assert.True(false); } }
public void TestDeleteCategory() { CategoryRepository categoryRepo = new CategoryRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteCategory")); try { categoryRepo.Delete(34); Assert.True(true); } catch { Assert.True(false); } }
public void TestGetByIDGame() { GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDGame")); try { var game = gameRepo.GetByID(4); Assert.True(true); } catch { Assert.True(false); } }
public void TestDeleteGame() { GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteGame")); try { gameRepo.Delete(4); Assert.True(true); } catch { Assert.True(false); } }
public void TestGetQuestionByID() { QuestionRepository questionRepo = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionByID")); try { var question = questionRepo.GetByID(10); Assert.True(true); } catch { Assert.True(false); } }
public void TestGetQuestionsAndAnswersByUniqueKey() { GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetQuestionsAndAnswersByGameRoomId")); try { var questions = gameRepo.GetQuestionsAndAnswersByUniqueKey(1); Assert.True(true); } catch { Assert.True(false); } }
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 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); }
public void TestUpdatePlayerScore() { PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestUpdatePlayerScore")); try { playerRepo.UpdatePlayerScore(1, "Elena", 50); Assert.True(true); } catch { Assert.True(false); } }
public void TestGetByIDPlayer() { PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestGetByIDPlayer")); try { var player = playerRepo.GetByID(10); Assert.True(true); } catch { Assert.True(false); } }
public void TestDeletePlayer() { PlayerRepository playerRepo = new PlayerRepository(DatabaseDummy.DatabaseDummyCreate("TestDeletePlayer")); try { playerRepo.Delete(10); Assert.True(true); } catch { Assert.True(false); } }
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 TestDeleteQuestion() { QuestionRepository questionRepo = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestDeleteQuestion")); try { questionRepo.Delete(10); Assert.True(true); } catch { Assert.True(false); } }
public void TestGetPlayersByUniqueKey() { GameRepository gameRepo = new GameRepository(DatabaseDummy.DatabaseDummyCreate("TestGetPlayersByRoomId")); try { var players = gameRepo.GetPlayersByUniqueKey(1); Assert.True(true); } catch { Assert.True(false); } }
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); }
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); } }
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); } }
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); } }
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); } }
public void TestCreateCategoryGame() { CategoryGameRepository categoryGameRepo = new CategoryGameRepository(DatabaseDummy.DatabaseDummyCreate("TestCreateCategoryGame")); GameCategories gameCategories = new GameCategories { GameId = 4, CategoriesId = new List <int>() { 34, 35 } }; try { categoryGameRepo.Create(gameCategories); Assert.True(true); } catch { Assert.True(false); } }
public void TestCreateQuestion() { QuestionRepository questionRepo = new QuestionRepository(DatabaseDummy.DatabaseDummyCreate("TestCreateQuestion")); Question question = new Question { QuestionText = "Intrebare3", CorrectAnswer = "49", WrongAnswer1 = "1", WrongAnswer2 = "2", WrongAnswer3 = "3", CategoryId = 34, QuestionDifficulty = 1 }; try { questionRepo.Create(question); Assert.True(true); } catch { Assert.True(false); } }
public void TestAddCategoriesToGame() { CategoryGameRepository categoryGameRepo = new CategoryGameRepository(DatabaseDummy.DatabaseDummyCreate("TestAddCategoriesToGame")); CategoryGameController categoryGameController = new CategoryGameController(categoryGameRepo); GameCategories gameCategories = new GameCategories { GameId = 4, CategoriesId = new List <int>() { 34, 35 } }; var actionResult = categoryGameController.AddCategoriesToGame(gameCategories); Assert.IsNotType <BadRequestObjectResult>(actionResult); }