public ActionResult QuestionDelete(QuestionViewModel question)
        {
            try
            {
                _questionLogic.DeleteQuestionFromDatabase(new Question(question.QuestionId));

                return(RedirectToAction("QuestionOverview"));
            }
            catch
            {
                return(View("../Shared/Error"));
            }
        }
Exemplo n.º 2
0
        public void DeleteQuestion_IsValid()
        {
            Mock <IQuestionContext> mockContext = new Mock <IQuestionContext>();
            Mock <Category>         category    = new Mock <Category>("Medisch");
            Mock <Question>         question    = new Mock <Question>(1, "foo", "baa", Question.QuestionStatus.Open, DateTime.Today, true, category.Object, 12);

            mockContext.Setup(x => x.DeleteQuestion(question.Object));

            QuestionLogic questionLogic = new QuestionLogic(mockContext.Object);

            questionLogic.DeleteQuestionFromDatabase(question.Object);

            mockContext.Verify(x => x.DeleteQuestion(question.Object), Times.Exactly(1));
        }