Esempio n. 1
0
		public Book(String title, Author author)
		{
			Title = title;
			Author = author;
		}
		public void TestInitializationDuringFlush()
		{
			Assert.False(listener.Executed);
			Assert.False(listener.FoundAny);
			ISession s = OpenSession();
			s.BeginTransaction();
			var publisher = new Publisher("acme");
			var author = new Author("john");
			author.Publisher = publisher;
			publisher.Authors.Add(author);
			author.Books.Add(new Book("Reflections on a Wimpy Kid", author));
			s.Save(author);
			s.Transaction.Commit();
			s.Clear();

			s = OpenSession();
			s.BeginTransaction();
			publisher = s.Get<Publisher>(publisher.Id);
			publisher.Name = "random nally";
			s.Flush();
			s.Transaction.Commit();
			s.Clear();

			s = OpenSession();
			s.BeginTransaction();
			s.Delete(author);
			s.Transaction.Commit();
			s.Clear();
			s.Close();
			Assert.True(listener.Executed);
			Assert.True(listener.FoundAny);
		}