コード例 #1
0
        public void TesDeletetQuiz()
        {
            BoraNowSeeder.Seed();
            var bo        = new QuizBusinessObject();
            var resList   = bo.List();
            var resDelete = bo.Delete(resList.Result.First().Id);

            resList = bo.List();

            Assert.IsTrue(resDelete.Success && resList.Success && resList.Result.First().IsDeleted);
        }
コード例 #2
0
        public void TestUpdateQuiz()
        {
            BoraNowSeeder.Seed();
            var qbo     = new QuizBusinessObject();
            var resList = qbo.List();

            var quiz    = resList.Result.FirstOrDefault();
            var newQuiz = new Quiz("BoraNow Quiz");

            quiz.Title = newQuiz.Title;

            var resUpdate = qbo.Update(quiz);

            resList = qbo.List();
            Assert.IsTrue(resUpdate.Success && resList.Success && resList.Result.First().Title == quiz.Title);
        }
コード例 #3
0
        public void TestListQuiz()
        {
            BoraNowSeeder.Seed();
            var bo      = new QuizBusinessObject();
            var resList = bo.List();

            Assert.IsTrue(resList.Success && resList.Result.Count == 1);
        }
コード例 #4
0
ファイル: QuizController.cs プロジェクト: figueirinha/BoraNow
        public ActionResult <List <QuizViewModel> > List()
        {
            var res = _bo.List();

            if (!res.Success)
            {
                return(new ObjectResult(HttpStatusCode.InternalServerError));
            }
            var list = new List <QuizViewModel>();

            foreach (var item in res.Result)
            {
                list.Add(QuizViewModel.Parse(item));
            }
            return(list);
        }