public IActionResult Requests(int?pageSize, int page = 1)
        {
            int _pageSize = pageSize ?? 10;
            PagedResult <RequestDetailsViewModel> pagedResult = new PagedResult <RequestDetailsViewModel>
            {
                CurrentPage = page,
                PageSize    = _pageSize,
                PageCount   = (int)Math.Ceiling(requestsManagementService.Count() / (double)_pageSize),
                Elements    = requestsManagementService.GetAll(page, _pageSize).Select(r => requestDetailsMapper.MapTo(r)).ToList()
            };

            return(View(pagedResult));
            // return View(mapper.Map<IEnumerable<RequestDetailsViewModel>>(requestsManagementService.GetAll()));
        }
Example #2
0
        public void CanGetAllRequests()
        {
            // Establish Context
            IList <Request> requestsToExpect = new List <Request>();

            Request request =
                RequestInstanceFactory.CreateValidTransientRequest();

            requestsToExpect.Add(request);

            _requestRepository.Expect(r => r.GetAll())
            .Return(requestsToExpect);

            // Act
            IList <Request> requestsRetrieved =
                _requestManagementService.GetAll();

            // Assert
            requestsRetrieved.ShouldNotBeNull();
            requestsRetrieved.Count.ShouldEqual(1);
            requestsRetrieved[0].ShouldNotBeNull();
            requestsRetrieved[0].ShouldEqual(request);
        }