protected override void OnSetUp() { base.OnSetUp(); using ( ISession session = this.OpenSession() ) { Category root = new Category( 1, "Root", null ); root.SubCategories.Add( new Category( 2, "First", root ) ); root.SubCategories.Add( new Category( 3, "Second", root ) ); root.SubCategories.Add( new Category( 4, "Third", root ) ); session.Save( root ); session.Flush(); } }
public Category( int id, string name, Category parent ) { this.id = id; this.name = name; subCategories = new List<Category>(); parentCategory = parent; }