Beispiel #1
0
        public GetOrdersResponse GetOrdersByCriteria(GetOrdersRequest request)
        {
            GetOrdersResponse      response = new GetOrdersResponse();
            OrderBusinessComponent bc       = DependencyInjectionHelper.GetOrderBusinessComponent();

            IQueryable <Order> orders = bc.GetOrdersByCriteria(request.SearchType, request.CustomerId);

            response.Orders = OrderAdapter.OrdersToListDtos(orders);

            return(response);
        }
Beispiel #2
0
        public GetOrdersResponse GetOrdersByCriteria(GetOrdersRequest request)
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                throw new FaultException <NotAuthenticatedFault>(new NotAuthenticatedFault());
            }
            GetOrdersResponse      response = new GetOrdersResponse();
            OrderBusinessComponent bc       = DependencyInjectionHelper.GetOrderBusinessComponent();
            IQueryable <Order>     orders   = bc.GetOrdersByCriteria(request.SearchType, request.CustomerId);

            response.Orders = OrderAdapter.OrdersToListDtos(orders);

            return(response);;
        }
Beispiel #3
0
        public void TestGetOrderByCriteria()
        {
            OrderBusinessComponent service = new OrderBusinessComponent(this.context);
            Order order = new Order {
                OrderId = 456, Customer = new Customer {
                    CustomerId = 1234
                }
            };
            IList <Order> orders = new List <Order> {
                order
            };

            foreach (OrderSearchType type in Enum.GetValues(typeof(OrderSearchType)))
            {
                Expect.Once.On(context).Method("GetAll").Will(Return.Value(orders.AsQueryable()));
                IQueryable <Order> resultOrders = service.GetOrdersByCriteria(type, 1234);
                Assert.AreEqual <decimal>(1, resultOrders.Count());
                Assert.AreEqual <decimal>(order.OrderId, resultOrders.First().OrderId);
            }

            mockBuilder.VerifyAllExpectationsHaveBeenMet();
        }