public IHttpActionResult GameQuestion(int gameId, int qNumber) { string questionData = gh.GetQuestion(gameId, qNumber); string clueData = gh.GetQuestionClue(gameId, qNumber); object retData = new { question = questionData, clue = clueData }; if (questionData == "") { return(NotFound()); } else { return(Ok(retData)); } }
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"); } } }