public async Task GetAll_ShouldReturn_PageItems()
        {
            //Arrange


            //Act
            var urlMapFilterInput = new UrlMapFilterInput()
            {
                Take = 2,
                Page = 2
            };
            var urlMapOutputs = await _tinyUrlService.GetAll(urlMapFilterInput);


            //Assert
            Assert.Equal(urlMapFilterInput.Take, urlMapOutputs.Items.Count);
            Assert.Equal(2, urlMapFilterInput.Skip);
        }
Пример #2
0
        public async Task <IViewComponentResult> InvokeAsync(string sorting, int currentPage = 1, int take = 10)
        {
            var urlMapOutputs = await _tinyUrlService.GetAll(new UrlMapFilterInput()
            {
                Sorting = sorting,
                Page    = currentPage,
                Take    = take,
            });

            return(View(urlMapOutputs));
        }
Пример #3
0
        public async Task OnGetAsync(string filter, int currentPage = 1, int pageSize = 10)
        {
            var input = new UrlMapFilterInput()
            {
                Filter = filter,
                Page   = currentPage,
                Take   = pageSize,
            };

            Result = await _tinyUrlService.GetAll(input);

            CurrentPage = currentPage;
            TotalPages  = (int)Math.Ceiling(decimal.Divide(Result.TotalCount, pageSize));
        }
 /// <summary>
 /// Gets all the url objects stored .
 /// </summary>
 public JsonResult GetAll()
 {
     return(Json(_service.GetAll()));
 }
Пример #5
0
 public async Task <UrlMapPageOutput> Get([FromQuery] UrlMapFilterInput input)
 {
     return(await _tinyUrlService.GetAll(input));
 }