public void TestListQuizQuestion() { BoraNowSeeder.Seed(); var bo = new QuizQuestionBusinessObject(); var resList = bo.List(); Assert.IsTrue(resList.Success && resList.Result.Count == 1); }
public void TestUpdateQuizQuestion() { BoraNowSeeder.Seed(); var qqbo = new QuizQuestionBusinessObject(); var resList = qqbo.List(); var item = resList.Result.FirstOrDefault(); var qbo = new QuizBusinessObject(); var quiz = new Quiz("This quiz rocks"); qbo.Create(quiz); item.QuizId = quiz.Id; item.Question = "viewpoint?"; var resUpdate = qqbo.Update(item); resList = qqbo.List(); Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Question == "viewpoint?" && resList.Result.First().QuizId == quiz.Id); }
public ActionResult <List <QuizQuestionViewModel> > List() { var res = _bo.List(); if (!res.Success) { return(new ObjectResult(HttpStatusCode.InternalServerError)); } var list = new List <QuizQuestionViewModel>(); foreach (var item in res.Result) { list.Add(QuizQuestionViewModel.Parse(item)); } return(list); }