public void Updating_detached_entities_collections_does_not_work() { Initialize(); Blog blog; using (new SessionScope()) { CreateBlog(); blog = Blog.Find(1); } using (new StatelessSessionScope()) { blog.Posts = new ArrayList(); for (int i = 0; i < 10; i++) { var post = new Post() { Title = "Post" + i, Created = DateTime.Now}; post.Create(); blog.Posts.Add(post); } blog.Update(); } Assert.AreEqual(0, Blog.Find(1).Posts.Count); }
public void Inversively_adding_to_a_detached_entitys_collections_works() { Initialize(); Blog blog; using (new SessionScope()) { CreateBlog(); blog = Blog.Find(1); } using (new StatelessSessionScope()) { for (int i = 0; i < 10; i++) { var post = new Post() { Blog = blog, Title = "Post" + i, Created = DateTime.Now }; post.Create(); } } Assert.AreEqual(10, Blog.Find(1).Posts.Count); }