I am trying to cover TDD and have begun to study mockery. I need advice on what I should test and how to make my classes more behavioral rather than just data containers (with a bunch of getters / setters).
Consider this class.
public class Post { List<Comment> Comments {get; private set;} public void AddComment(string message) { Comment.Add(new Comment(message)); } }
An example of checking the status check will be
[Test] public void CanAddCommentToPost() { Post p = new Post(); p.AddComment("AAAAA"); Assert.AreEqual(1, Comments.Count); }
I'm not quite sure what I should do to check the behavior, can someone provide some samples using Moq?
moq mocking
Anton P
source share