public void IncomingOutgoing() { //if HSQLDialect skip test ISession s = OpenSession(); Master master1 = new Master(); Master master2 = new Master(); Master master3 = new Master(); s.Save(master1); s.Save(master2); s.Save(master3); master1.AddIncoming(master2); master2.AddOutgoing(master1); master1.AddIncoming(master3); master3.AddOutgoing(master1); object m1id = s.GetIdentifier(master1); Assert.AreEqual(2, s.CreateFilter(master1.Incoming, "where this.id > 0 and this.Name is not null").List().Count); s.Flush(); s.Close(); s = OpenSession(); master1 = (Master)s.Load(typeof(Master), m1id); int i = 0; foreach (Master m in master1.Incoming) { Assert.AreEqual(1, m.Outgoing.Count, "outgoing"); Assert.IsTrue(m.Outgoing.Contains(master1), "outgoing"); s.Delete(m); i++; } Assert.AreEqual(2, i, "incoming-outgoing"); s.Delete(master1); s.Flush(); s.Close(); }