Defining AddCommentToRepo in a CommentController

 Given a CommentController
 When AddCommentToRepo
 Should add the Comment to the Repository

Test Code

    [TestClass]
    public class Given_CommentController_When_AddCommentToRepo : BehaviorOf<CommentController> {

        [TestMethod]
        public void Should_add_the_Comment_to_the_Repository() {

            When.AddCommentToRepo();
            Should.IgnoringArgs().BlogRepository.AddComment(null);
        }
    }

Production Code

    public class CommentController {

        public BlogRepository BlogRepository { get; set; }
        public Comment Comment { get; set; }

        public virtual void AddCommentToRepo() {
            BlogRepository.AddComment(Comment);
        }

    }

    public interface BlogRepository {

        void AddComment(Comment Comment);
    }

    public interface Comment {}

Last edited Nov 5, 2008 at 7:47 PM by mikemps, version 1

Comments

No comments yet.