public void Test_CheckAnswer() { using (NameGameDBEntities entities = new NameGameDBEntities()) { Game game = entities.Games.FirstOrDefault(); GameHelpers gh = new GameHelpers(); string result = gh.CheckAnswer(game.GameId, 1, 6); if (result != "") { return; } Assert.AreNotEqual("", result, "no answer found"); } }
public void Test_GetQuestion() { GameHelpers gh = new GameHelpers(); //Note: there must be at least one game populated in the database - get the gameId for that game and then test using (NameGameDBEntities entities = new NameGameDBEntities()) { Game game = entities.Games.FirstOrDefault(); if (game != null) { //let's retrieve the data for the first question in the game string question = gh.GetQuestion(8, 1); Assert.AreNotEqual("", question, true, "Game question not found"); } else { Assert.Fail("Game not found in database"); } } }