示例#1
0
 public ActionResult AddQuestion(QuestionInput question)
 {
     if (!ModelState.IsValid)
     {
         return(View(question));
     }
     repository.Add(question.ToQuestion());
     return(RedirectToAction("Index"));
 }
示例#2
0
        public void ToQuestionReturnsCorrectResult(
            string tags,
            IEnumerable <string> expected)
        {
            var sut = new QuestionInput();

            sut.Tags  = tags;
            sut.Title = "foo";
            sut.Body  = "bar";

            var actual = sut.ToQuestion();

            Assert.Equal(expected, actual.Tags);
            Assert.Equal(sut.Title, actual.Title);
            Assert.Equal(sut.Body, actual.Body);
        }