Exemplo n.º 1
0
        public async Task OnGetAsync_WithPageNumberEqualsTo2And12Posts_ShouldReturnCurrentPageEqualsTo2()
        {
            var mediator = new Mock <IMediator>();

            mediator.Setup(o => o.Send(It.IsAny <SearchArticlesQuery>(), default(CancellationToken))).Returns(
                Task.FromResult(new SearchResultDto <ArticleSearchDto>
            {
                CurrentPage = 2,
                Results     = new List <ArticleSearchDto>
                {
                    new ArticleSearchDto {
                        Slug = "test11"
                    },
                    new ArticleSearchDto {
                        Slug = "test12"
                    }
                }
            }));

            // Act
            var searchModel = new SearchModel(mediator.Object, ConfigureAutomapperServices.ConfigureAutomapper(null));

            var result = await searchModel.OnGetAsync(query : "test", pageNumber : 2);

            Assert.Equal(2, searchModel.SearchResult.CurrentPage);
        }
Exemplo n.º 2
0
 public OnGet()
 {
     _Mediator = new Mock <IMediator>();
     _Mapper   = ConfigureAutomapperServices.ConfigureAutomapper(null);
 }