public void SetQuizVariablesTest() { model.CurrentQuiz = quizViewModel.GetQuizByTitle("Test Quiz"); model.SetQuizVariables(model.CurrentQuiz); Assert.AreEqual(model.Id, model.CurrentQuiz.Id); Assert.AreEqual(model.Title, model.CurrentQuiz.Title); Assert.AreEqual(model.Description, model.CurrentQuiz.Description); Assert.AreEqual(model.PassMark, model.CurrentQuiz.PassMark); Assert.AreEqual(model.Category, model.CurrentQuiz.Category); //Do not check Questions as I am setting the Answer.IsCorrect value to be different based on the Correct Property //Assert.AreEqual(model.Questions, model.CurrentQuiz.Questions); }
// GET: Edit Quiz public ActionResult EditQuiz(EditQuizViewModel model, string QuizName) { if (model.Id == 0) { model.CurrentQuiz = quizViewModel.GetQuizByTitle(QuizName); model.SetQuizVariables(model.CurrentQuiz); } else { model.SaveQuizDetails(); } model.Categories = quizViewModel.Categories; return(View(model)); }
public void GetQuizByTitleTest() { Quiz searchedForByTitle = model.GetQuizByTitle("Test Quiz"); Assert.AreEqual(searchedForByTitle.Title, "Test Quiz"); }