Example #1
0
        public async Task GetStateUrbanizationSortedPaged_AllDataSinglePageEmptyOrderByOrder_ReturnsDefaultList()
        {
            int page        = 0;
            int rowsPerPage = Data.Count;

            var actualData = (await _UrbStateService.GetStateUrbanizationSortedPaged(page, rowsPerPage, string.Empty, string.Empty)).ToList();

            Assert.AreEqual(urbStateOne.Id, actualData[0].Id, $"Expected object with id: {urbStateOne.Id} at index 0, recieved {actualData[0].Id}");
            Assert.AreEqual(urbStateTwo.Id, actualData[1].Id, $"Expected object with id: {urbStateTwo.Id} at index 0, recieved {actualData[1].Id}");
            Assert.AreEqual(urbStateThree.Id, actualData[2].Id, $"Expected object with id: {urbStateThree.Id} at index 0, recieved {actualData[2].Id}");
        }
Example #2
0
 public async Task <ActionResult <IEnumerable <UrbanizationByStateModel> > > GetWithPagination(int page, int rowsPerPage, string orderBy, string order)
 {
     try
     {
         var data = (await _UrbanizationByStateService.GetStateUrbanizationSortedPaged(page, rowsPerPage, orderBy, order));
         return(Ok(data));
     }
     catch (ArgumentException ex)
     {
         _logger.LogInformation(ex.Message);
         return(BadRequest(ex.Message));
     }
     catch (Exception ex)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, ex.Message));
     }
 }