예제 #1
0
        public void Can_add_post_to_blog()
        {
            var post = new Post
                        {
                            Title = "First Post",
                            Body = "Just a test",
                            PublicationDate = DateTime.Today
                        };
            blog.Posts.Add(post);
            Session.Update(blog);

            Session.Flush();
            Session.Clear();

            var fromDb = Session.Get<Blog>(blog.Id);

            fromDb.Posts.Count.ShouldEqual(1);
            fromDb.Posts.First().Id.ShouldEqual(post.Id);
        }
예제 #2
0
        protected override void CreateInitialData(ISession session)
        {
            base.CreateInitialData(session);
            blog = new Blog { Name = "Gabriel's Blog", Author = author };
            post = new Post
                       {
                           Title = "First Post",
                           Body = "Just a test",
                           PublicationDate = DateTime.Today
                       };
            blog.Posts.Add(post);
            session.Save(blog);

            comment = new Comment("This is my comment", DateTime.Today, "*****@*****.**");
        }