コード例 #1
0
        public void Can_Delete_A_Saved_Post()
        {
            var newPost = new Post()
                              {
                                  Body = "Corpo do post!",
                                  Title = "Titulo do post",
                                  Slug = "Titulo do post".Slugify(),
                                  Author = "Renata Fan"
                              };

            var repository = new NHibernateRepository<Post>(SessionFactory, null);
            repository.Add(newPost);

            Session.Flush();

            Post saved = repository.FirstOrDefault(c => c.Id == newPost.Id);

            repository.Remove(saved);

            Session.Flush();

            Assert.AreEqual(0, repository.Count);
        }