public void Cannot_Include_Many_In_Many() { SqlSet <SqlSetInclude.Employee> set = db.Table <SqlSetInclude.Employee>() .Include("Orders.OrderDetails"); SqlSetInclude.Employee item = set.First(); }
public void Can_Include_Many_Multiple() { SqlSet <SqlSetInclude.Employee> set1 = db.Table <SqlSetInclude.Employee>() .Include("EmployeeTerritories"); SqlSet <SqlSetInclude.Employee> set2 = set1.Include("Orders"); SqlSetInclude.Employee item = set1.First(); Assert.IsNotNull(item.EmployeeTerritories); Assert.AreNotEqual(0, item.EmployeeTerritories.Count); Assert.IsTrue(item.EmployeeTerritories.All(p => Object.ReferenceEquals(p.Employee, item))); // test immutability Assert.IsTrue(item.Orders == null || item.Orders.Count == 0); item = set2.First(); Assert.IsNotNull(item.EmployeeTerritories); Assert.AreNotEqual(0, item.EmployeeTerritories.Count); Assert.IsTrue(item.EmployeeTerritories.All(p => Object.ReferenceEquals(p.Employee, item))); Assert.IsNotNull(item.Orders); Assert.AreNotEqual(0, item.Orders.Count); //Assert.IsTrue(item.Orders.All(p => Object.ReferenceEquals(p.Employee, item))); }
public void Can_Include_One_Nested() { SqlSet <SqlSetInclude.EmployeeTerritory> set = db.Table <SqlSetInclude.EmployeeTerritory>() .Include("Territory.Region"); SqlSetInclude.EmployeeTerritory item = set.First(); Assert.IsNotNull(item.Territory); Assert.IsNotNull(item.Territory.Region); }
public void Can_Include_Many_In_One() { SqlSet <SqlSetInclude.EmployeeTerritory> set = db.Table <SqlSetInclude.EmployeeTerritory>() .Include("Employee.Orders"); SqlSetInclude.EmployeeTerritory item = set.First(); Assert.IsNotNull(item.Employee); Assert.AreNotEqual(0, item.Employee.Orders.Count); //Assert.IsTrue(item.Employee.Orders.All(p => Object.ReferenceEquals(p.Employee, item.Employee))); }
public void Can_Include_Many() { SqlSet <SqlSetInclude.Category> set = db.Table <SqlSetInclude.Category>() .Include("Products"); SqlSetInclude.Category item = set.First(); Assert.IsNotNull(item.Products); Assert.AreNotEqual(0, item.Products.Count); Assert.IsTrue(item.Products.All(p => Object.ReferenceEquals(p.Category, item))); }
public void Can_Include_One_In_Many() { SqlSet <SqlSetInclude.Employee> set = db.Table <SqlSetInclude.Employee>() .Include("EmployeeTerritories.Territory"); SqlSetInclude.Employee item = set.First(); Assert.IsNotNull(item.EmployeeTerritories); Assert.AreNotEqual(0, item.EmployeeTerritories.Count); Assert.IsTrue(item.EmployeeTerritories.All(p => p.Territory != null)); }
public void Can_Include_One() { SqlSet <SqlSetInclude.Product> set = db.Table <SqlSetInclude.Product>() .Where("NOT CategoryID IS NULL AND NOT SupplierID IS NULL") .Include("Category") .Include("Supplier"); SqlSetInclude.Product item = set.First(); Assert.IsNotNull(item.Category); Assert.IsNotNull(item.Supplier); }
public Product FirstProduct() { return(productSet.First()); }