public ActionResult AddQuestion(QuestionInput question) { if (!ModelState.IsValid) { return(View(question)); } repository.Add(question.ToQuestion()); return(RedirectToAction("Index")); }
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); }