private static void GetOrdersTest() { ShopContextFactory shopContextFactory = new ShopContextFactory(); ShopContext context = shopContextFactory.Create(); IOrderRepository orderRepository = new DbOrderRepository(context); var orders = orderRepository.Get(); if (orders.Any()) { } else { Console.WriteLine("Brak zamówień"); } if (orders.Any(c => c.Customer.Gender == Gender.Female)) { } if (orders.All(c => c.Customer.Gender == Gender.Male)) { } }
private static void GetOrderSearchCriteriaTest() { ShopContextFactory shopContextFactory = new ShopContextFactory(); ShopContext context = shopContextFactory.Create(); OrderSearchCriteria searchCriteria = new OrderSearchCriteria { From = DateTime.Parse("2021-01-01"), To = DateTime.Parse("2021-05-01"), }; IOrderRepository orderRepository = new DbOrderRepository(context); var orders = orderRepository.Get(searchCriteria); }