Defining AddComment in a CommentController

 Given a CommentController
 When adding a Comment
 Should create the Comment
 Should add the Comment to the Repository

Test Code

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

        [TestInitialize]
        public void Setup() {
        
            When.AddComment();
        }

        [TestMethod]
        public void Should_CreateComment() {

            Should.CreateComment();
        }

        [TestMethod]
        public void Should_AddCommentToRepo() {

            Should.AddCommentToRepo();
        }        
    }

Production Code

    public class CommentController {

        public void AddComment() {
            CreateComment();
            AddCommentToRepo();
        }

        public virtual void CreateComment() { }

        public virtual void AddCommentToRepo() { }

    }

Last edited Nov 5, 2008 at 3:03 AM by mikemps, version 1

Comments

No comments yet.