public void Can_Persist_Joins() { Initialize(true); using (var repository = new NHibernateBlogService()) { var post = DummyLivePost(); var category = new Category() { Name = "Test" }; post.Categories.Add(category); repository.Save(post); repository.Save(category); Assert.AreEqual(1, repository.GetPosts().Count); } using (var repository = new NHibernateBlogService()) { Assert.AreEqual(1, repository.GetPosts().Count); Assert.AreEqual(1, repository.GetCategories().Count); var post = repository.GetPosts().First(); Assert.AreEqual(1, post.Categories.Count); } }
public void Can_Save_Post_With_Category_Attached() { Initialize(true); using (var repository = new NHibernateBlogService()) { var category = new Category() { Name = "Test" }; var post = DummyLivePost(); post.Categories.Add(category); repository.Save(post); repository.Save(category); Assert.AreEqual(1, repository.GetPosts().Count); Assert.AreEqual(1, repository.GetCategories().Count); } }
public void Can_Load_Saved_Category() { Initialize(true); using (var repository = new NHibernateBlogService()) { var category = new Category() { Name = "Test" }; repository.Save(category); Assert.AreEqual(1, repository.GetCategories().Count); } }