Пример #1
0
        public void ShouldGetOrderTotalWithFunction()
        {
            var order = _db.Orders.First(x => StoreContext.GetOrderTotal(x.Id) == 4424.90M);

            Assert.NotNull(order);
            Assert.Equal(4424.90M, order.OrderTotal ?? 0);
        }
Пример #2
0
 private static void GetRecordsOver(decimal amount)
 {
     using var db = new StoreContext();
     foreach (var order in db.Orders.Where(x => StoreContext.GetOrderTotal(x.Id) > amount))
     {
         Console.WriteLine($"Qty: {order.CustomerId}, Total: {order.OrderTotal}");
     }
 }
Пример #3
0
        public void ShouldFilterWithMappedFunction()
        {
            ExecuteInATransaction(RunTheTest);

            void RunTheTest()
            {
                //CreateCategoryAndProducts();
                //Execution happens
                Context.CustomerId = 1;
                var cats = Context.Orders
                           .Where(x => x.OrderTotal > StoreContext.GetOrderTotal(4))
                           .ToList();
            }
        }