private void ArrangeRecords() { BlogLazy blog = new BlogLazy() { Author = "Markus", Name = "Conversations" }; PostLazy post = new PostLazy() { Blog = blog, Category = "Scenario", Title = "The Convesration is here", Contents = "A new way for AR in fat clients", Created = new DateTime(2010, 1, 1), Published = true }; blog.Save(); post.Save(); }
public void CanUseIConversationDirectly() { ArrangeRecords(); using (IConversation conversation = new ScopedConversation()) { BlogLazy blog = null; conversation.Execute(() => { blog = BlogLazy.FindAll().First(); }); Assert.That(blog, Is.Not.Null); Assume.That(blog.Author, Is.EqualTo("Markus")); // Lazy access Assert.That(blog.PublishedPosts.Count, Is.EqualTo(1)); blog.Author = "Anonymous"; conversation.Execute(() => blog.Save()); } Assert.That(BlogLazy.FindAll().First().Author, Is.EqualTo("Anonymous")); }