public void MapsOneToManyUsingConventions() { var cust = new Customer() { Name = "Jeremy" }; var order = new Order() { Customer = cust }; using (ContextScope.Begin()) { cust.Orders.Add(order); cust.Save(); } using (ContextScope.Begin()) { cust = Customer.FindAll().Single(); cust.Orders.Count().ShouldEqual(1); } }
public void MapsManyToOneUsingConventions() { var cust = new Customer() { Name = "Jeremy" }; var order = new Order() { Customer = cust }; using (ContextScope.Begin()) { cust.Save(); order.Save(); } using (ContextScope.Begin()) { order = Order.FindById(order.Id); order.Customer.Name.ShouldEqual("Jeremy"); } }