Beispiel #1
0
        public IActionResult OnPost(string input)
        {
            Question current = repo.GetQuestion(CurrentQuestion.Title); // remember to write it to storage
            Comment  comment = new Comment(input);

            current.AddComment(comment);
            repo.AddQuestion(current);
            return(RedirectToPage("Index", new { CurrentQuestion.Title }));
        }
        public void WhenContributorAddsAComment_TheCommentShouldNotBeAddded_IfTheyDoNotHaveEnoughReputation()
        {
            var poster   = new Poster(new Name("Joe", "Bloggs"));
            var content  = new PlainTextContent();
            var question = new Question("A question", content, poster);

            var contributor = new Contributor(new Name("Joe", "Bloggs"), new Reputation(100));

            Assert.Throws <InsufficientReputationException>(() => question.AddComment(new Comment(contributor, "This is a comment")));
        }