Example #1
0
        public void TestAddQuestion()
        {
            // Arrange
            var repo = new FakeRepository();
            var questionController = new QuestionsController(repo);

            // Act
            questionController.AddForumQuestion("testQuestion1", "testQuestionBody1");

            // Assert
            Assert.Equal(4, repo.Questions.Count);
        }
Example #2
0
        public void TestAddReply()
        {
            // Arrange
            var repo = new FakeRepository();
            var questionController = new QuestionsController(repo);

            // Act
            questionController.AddForumQuestion("testQuestion1", "testQuestionBody1");
            Question q1 = questionController.FindQuestionByQuestionHeader("testQuestion1");
            Reply    r1 = new Reply
            {
                QuestionPost = q1,
                ReplyBody    = "testReply1"
            };

            questionController.AddReply(q1, r1);

            // Assert
            Assert.Equal(4, repo.Replies.Count);
        }