public void MustFirstSaveReferencedObjectBeforeSavingRefereningObject() { //given Customer customer = Om.CreateCustomer(); Order order = Om.CreateOrderWith(customer); //this would not happen if persistence cascaded from Order to Customer NhAssert.VerifyInsertThrowsBecausePropertyReferencesUnsavedInstance(order, x => x.Customer); }
public void CanTestWhenAssociationIsLazyLoaded() { //given Customer customer = Om.CreateCustomerWithOneRep(); DbFixture.Insert(customer); //when var loadedCustomer = Nh.GetFromDb <Customer>(customer.Id); //then NhAssert.IsLazyLoaded(loadedCustomer.CustomerRepresentatives); }