Пример #1
0
        public void TestListQuizQuestion()
        {
            BoraNowSeeder.Seed();
            var bo      = new QuizQuestionBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }