Exemplo n.º 1
0
        public void OrderController_Index_ShouldReturnTheSearchModelAsTheModel()
        {
            var orderSearchModel = new OrderSearchModel();
            var result = _orderController.Index(orderSearchModel);

            result.Model.Should().Be(orderSearchModel);
        }
Exemplo n.º 2
0
        public void OrderController_Index_ShouldCallOrderServiceGetAllPagedWithPassedArgument()
        {
            var orderSearchModel = new OrderSearchModel();
            var result = _orderController.Index(orderSearchModel);

            A.CallTo(() => _orderAdminService.Search(orderSearchModel)).MustHaveHappened();
        }
Exemplo n.º 3
0
        public void OrderController_Index_ShouldReturnTheResultOfTheCallToTheServiceAsViewData()
        {
            var orderSearchModel = new OrderSearchModel();
            var pagedList = PagedList<Order>.Empty;
            A.CallTo(() => _orderAdminService.Search(orderSearchModel)).Returns(pagedList);
            var result = _orderController.Index(orderSearchModel);

            result.ViewData["results"].Should().Be(pagedList);
        }
Exemplo n.º 4
0
 public OrderSearchQuery(OrderSearchModel orderSearchModel)
 {
     SearchText = orderSearchModel.SearchText;
     OrderId = orderSearchModel.OrderId;
     DateFrom = orderSearchModel.DateFrom;
     DateTo = orderSearchModel.DateTo;
     PaymentStatus = orderSearchModel.PaymentStatus;
     ShippingStatus = orderSearchModel.ShippingStatus;
     SalesChannel = orderSearchModel.SalesChannel;
     OrderTotalFrom = orderSearchModel.OrderTotalFrom;
     OrderTotalTo = orderSearchModel.OrderTotalTo;
 }
Exemplo n.º 5
0
 public IPagedList<Order> Search(OrderSearchModel model)
 {
     var query = new OrderSearchQuery(model);
     return _orderSearcher.Search(query.GetQuery(), model.Page, filter: query.GetFilter(),
         sort: new Sort(new SortField("id", SortField.INT, true)));
 }
Exemplo n.º 6
0
 public IPagedList<Order> SearchOrders(OrderSearchModel model, int page = 1, int pageSize = 10)
 {
     var query = new OrderSearchQuery(model);
     return _orderSearcher.Search(query.GetQuery(), page, pageSize, query.GetFilter(),
         new Sort(new SortField("id", SortField.INT, true)));
 }