Example #1
0
        public async Task TestSearchPoems()
        {
            var res = _service.SearchPoems(new SearchPoemDto {
                AuthorName = "李白", MaxResultCount = 1, SkipCount = 0
            });

            Assert.Equal(2, res.TotalCount);
            Assert.Equal(1, res.Items.Count);
        }
Example #2
0
        public void SearchPomts_Test()
        {
            // Act
            var output = _appService.SearchPoems(new SearchPoemDto {
                AuthorName = "李白", MaxResultCount = 20, SkipCount = 0
            });

            // Assert
            output.Items.Count.ShouldBe(2);

            output.Items[0].Title.ShouldBe("静夜思");
        }
Example #3
0
        public void OnGet(string SearchString, string author, int?pageIndex)
        {
            if (pageIndex.HasValue && pageIndex.Value > 0)
            {
                CurrentPage = pageIndex.Value;
            }
            CurrentFilter = SearchString;
            CurrentAuthor = author;
            var req = new SearchPoemDto();

            req.Keyword        = CurrentFilter;
            req.AuthorName     = author;
            req.SkipCount      = CurrentPage * PageSize;
            req.MaxResultCount = PageSize;
            poemResults        = _appService.SearchPoems(req);
        }