public void Momento_PeristRetrieveAddComment_TheCommentSeedIdIsMaintained() { IDocumentStore documentStore = GetRavenDb(); IDocumentDatabase database = new RavenDb(documentStore); Momento momento = new Momento(); string commentName = Guid.NewGuid().ToString(); momento.AddComment(new Comment { Author = commentName }); database.Add(momento); database.Save(); Momento momento2 = database.SingleOrDefault<Momento>(m => m.Id == momento.Id); string commentName2 = Guid.NewGuid().ToString(); Comment comment1 = new Comment {Author = commentName2}; momento2.AddComment(comment1); const int expectedAutoGeneratedId = 2; Assert.AreEqual(comment1.Id, expectedAutoGeneratedId); }
public void Momento_MarkCommentAsSpam_CorrectCommentIsMarkedAsSpamAndPersistedToDataStore() { IDocumentStore documentStore = GetRavenDb(); IDocumentDatabase database = new RavenDb(documentStore); Momento momento = new Momento(); string commentName = Guid.NewGuid().ToString(); momento.AddComment(new Comment() { Author = commentName }); database.Add(momento); database.Save(); Momento momento2 = database.SingleOrDefault<Momento>(m => m.Id == momento.Id); Comment comment = momento2.Comments.Where(c => c.Author == commentName).SingleOrDefault(); momento.MarkCommentAsSpam(comment.Id); database.Add(momento); database.Save(); Momento momento3 = database.SingleOrDefault<Momento>(m => m.Id == momento.Id); Comment comment2 = momento3.Comments.Where(c => c.Author == commentName).SingleOrDefault(); Assert.AreEqual(CommentStatus.Spam, comment2.Status); }