public void AddAPartner() { Person john; using (var session = OpenSession()) { john = session.Get<Person>(nicePersonId); Assert.IsNull(john.Partner); var jane = new Person("Jane") { NickName = "John's Wife" }; session.Save(jane); john.Partner = jane; session.Flush(); session.Clear(); john = session.Get<Person>(nicePersonId); Assert.IsNotNull(john.Partner); Assert.AreEqual("Jane", john.Partner.Name); } using (var session = OpenSession()) { john = session.Get<Person>(nicePersonId); Assert.IsNotNull(john.Partner); Assert.AreEqual("Jane", john.Partner.Name); } }
protected override void OnSetUp() { using (ISession session = OpenSession()) { var nicePerson = new Person("John"); session.Save(nicePerson); session.Flush(); nicePersonId = nicePerson.Id; session.Clear(); } base.OnSetUp(); }
public Cat(Person master) : this() { this.master = master; }