public static void m1() { Builder builder = new Builder( SqlDataMapperType, DataMapperParams, PropertyColumnMapperType, MultipleConnectionPolicyType); IDataMapper <ProductSimple> productMapper = builder.Build <ProductSimple>(); ISqlEnumerable <ProductSimple> prods = productMapper.GetAll(); foreach (ProductSimple p in prods) { Console.WriteLine(p); } Console.WriteLine("-------------"); ISqlEnumerable <ProductSimple> prods2 = prods.Where("CategoryID = 7"); foreach (ProductSimple p in prods2) { Console.WriteLine(p); } Console.WriteLine("-------------"); ISqlEnumerable <ProductSimple> prods3 = prods2.Where("UnitsinStock > 30"); foreach (ProductSimple p in prods3) { Console.WriteLine(p); } }
public void GetAllAndWhereProductsWithSuccess() { // Arrange Builder builder = new Builder( SqlDataMapperType, DataMapperParams, PropertyColumnMapperType, MultipleConnectionPolicyType); IDataMapper <ProductSimple> productMapper = builder.Build <ProductSimple>(); // Act ISqlEnumerable <ProductSimple> prods = productMapper.GetAll(); ISqlEnumerable <ProductSimple> prods2 = prods.Where("CategoryID = 7"); ISqlEnumerable <ProductSimple> prods3 = prods2.Where("UnitsinStock > 30"); // Assert Assert.AreEqual(prods.Count(), 77); Assert.AreEqual(prods2.Count(), 5); Assert.AreEqual(prods3.Count(), 1); }