示例#1
0
        public void Can_add_new_blog()
        {
            var blog = new Blog {Name = "Gabriel's Blog", Author = author};
            Session.Save(blog);
            Session.Flush();
            Session.Clear();

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

            fromDb.ShouldNotBeNull();
            fromDb.ShouldNotBeTheSameAs(blog);
            fromDb.Id.ShouldEqual(blog.Id);
            fromDb.Name.ShouldEqual(blog.Name);
            fromDb.Author.ShouldNotBeNull();
            fromDb.Author.Id.ShouldEqual(blog.Author.Id);
        }
示例#2
0
 protected override void CreateInitialData(ISession session)
 {
     base.CreateInitialData(session);
     blog = new Blog {Name = "Gabriel's Blog", Author = author};
     session.Save(blog);
 }
示例#3
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, "*****@*****.**");
        }