Exemple #1
0
        public void preferred_customers_should_be_selected_when_IncludePreferred_is_true()
        {
            var query = new TopCustomersWithLowDiscountQuery
            {
                IncludePreferred = true,
                //DiscountThreshold = 3,
                //SalesThreshold = 100000
            };

            var customers = new List<Customer>();
            customers.AddRange(new[]
            {
                new Customer {Id = 1, Preferred = true},
                new Customer {Id = 2, Preferred = false},
                new Customer {Id = 3, Preferred = true}
            });

            ExecuteQuery(customers, query);

            Results.Count().ShouldEqual(2);
            Results.ElementAt(0).Id.ShouldEqual(1);
            Results.ElementAt(1).Id.ShouldEqual(3);
        }
Exemple #2
0
 public void ExecuteQuery(IEnumerable<Customer> customers, TopCustomersWithLowDiscountQuery query)
 {
     _resultsCached = customers.AsQueryable().Where(query.AsExpression()).ToList();
 }