public HttpResponseMessage Get(int agentId, int page = 1, int pageSize = 2)
        {
            var customerPagedListAPIResult = new CustomerPagedListAPIResult
            {
                Page     = page,
                PageSize = pageSize,
                Usage    = "HttpGet:~/api/Customers/{agentId}/{page?}/{pageSize?} or {args} can be on querystring, {args?} are optional"
            };

            customerPagedListAPIResult.CustomerList = CustomerBusinessLayer.GetCustomersByAgentId(agentId, page, pageSize);

            if (customerPagedListAPIResult.CustomerList == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound, customerPagedListAPIResult));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, customerPagedListAPIResult));
        }
Example #2
0
 public void WillCallDBLayerOnceWhenGetByAgentId()
 {
     CustomerBusinessLayer.GetCustomersByAgentId(1, 1, 1);
     mockDBLayer.Verify(m => m.FindAllEntiesByQuery <Customer>(It.IsAny <Query>(), It.IsAny <int>(), It.IsAny <int>()), Times.Once);
 }