Beispiel #1
0
 public void AddComment(DatabaseService db, Comment comment)
 {
     if (!comment.Text.Contains("shit"))
     {
         db.Save(comment);
     }
 }
Beispiel #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));
        }
Beispiel #3
0
 public virtual Article Save(Comment comment)
 {
     throw new System.NotImplementedException();
 }
Beispiel #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());
        }