public void TestPostPostQuestionValidModel()
        {
            //Arrange
            PostQuestionViewModel viewModel = new PostQuestionViewModel
            {
                Question = new Question
                {
                    Subject = "Have to prefill this otherwise model state is invalid",
                    Text = "Have to prefill otherwise model state is invalid"
                }
            };
            Mock<IForumRepository> mockRepo = new Mock<IForumRepository>();
            mockRepo.Setup(x => x.SaveQuestion(It.IsAny<Question>())).Returns(1);
            ForumController target = new ForumController(mockRepo.Object);

            //Act
            RedirectToRouteResult result = target.PostQuestion(viewModel) as RedirectToRouteResult;

            //Assert
            Assert.IsNotNull(result);
            Assert.AreEqual("Question", result.RouteValues["Action"]);
            Assert.IsTrue(target.ModelState.IsValid);
            mockRepo.Verify(x => x.SaveQuestion(It.IsAny<Question>()));
        }
        public ActionResult PostQuestion(PostQuestionViewModel model)
        {
            if (ModelState.IsValid)
            {
                model.Question.Text = model.Question.Text.Replace(Environment.NewLine, "<br />");
                int questionId = repository.SaveQuestion(model.Question);
                return RedirectToAction("Question", new { id = questionId });
            }

            return View(model);
        }