예제 #1
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));
        }
예제 #2
0
        public async Task GetAll_ShouldReturn2Items()
        {
            //Arrange
            UrlMapPageOutput outputs = await _controller.Get(new UrlMapFilterInput()
            {
                Take = 2
            });

            //Assert
            var result = Assert.IsType <UrlMapPageOutput> (outputs);

            var model = Assert.IsAssignableFrom <UrlMapPageOutput>(result);

            Assert.Equal(2, model.Items.Count);
        }