public void Can_Save_and_Load_Aliased_References() { var customer = new AliasedCustomer { Name = "Customer 1", PrimaryAddress = new AliasedCustomerAddress { AddressLine1 = "1 Humpty Street", City = "Humpty Doo", State = "Northern Territory", Country = "Australia" }, }; db.Save(customer); Assert.That(customer.Id, Is.GreaterThan(0)); Assert.That(customer.PrimaryAddress.AliasedCustomerId, Is.EqualTo(0)); db.SaveReferences(customer, customer.PrimaryAddress); Assert.That(customer.PrimaryAddress.AliasedCustomerId, Is.EqualTo(customer.Id)); var dbCustomer = db.LoadSingleById <AliasedCustomer>(customer.Id); dbCustomer.PrintDump(); Assert.That(dbCustomer.PrimaryAddress, Is.Not.Null); }
public void Can_Save_and_Load_Aliased_References() { var customer = new AliasedCustomer { Name = "Customer 1", PrimaryAddress = new AliasedCustomerAddress { AddressLine1 = "1 Humpty Street", City = "Humpty Doo", State = "Northern Territory", Country = "Australia" }, }; db.Save(customer); Assert.That(customer.Id, Is.GreaterThan(0)); Assert.That(customer.PrimaryAddress.AliasedCustId, Is.EqualTo(0)); db.SaveReferences(customer, customer.PrimaryAddress); Assert.That(customer.PrimaryAddress.AliasedCustId, Is.EqualTo(customer.Id)); var dbCustomer = db.LoadSingleById<AliasedCustomer>(customer.Id); dbCustomer.PrintDump(); Assert.That(dbCustomer.PrimaryAddress, Is.Not.Null); }