Example #1
0
 public void AddComment(DatabaseService db, Comment comment)
 {
     if (!comment.Text.Contains("shit"))
     {
         db.Save(comment);
     }
 }
Example #2
0
        public void ShouldSaveACommentToTheDatabaseWhenItIsAdded()
        {
            var article = new Article("", "");
            var comment = new Comment("TDD is cool");
            var database = new Mock<DatabaseService>();

            article.AddComment(database.Object, comment);

            database.Verify(db => db.Save(comment));
        }
Example #3
0
 public virtual Article Save(Comment comment)
 {
     throw new System.NotImplementedException();
 }
Example #4
0
        public void ShouldNotSaveACommentWithShitInIt()
        {
            var article = new Article("", "");
            var comment = new Comment("this is shit....");
            var database = new Mock<DatabaseService>();

            article.AddComment(database.Object, comment);

            database.Verify(db => db.Save(comment), Times.Never());
        }