Пример #1
0
        public async Task Should_Get_All_Authors_Without_Any_Filter()
        {
            var result = await _authorAppService.GetListAsync(new GetAuthorListDto());

            result.TotalCount.ShouldBeGreaterThanOrEqualTo(2);
            result.Items.ShouldContain(x => x.Name == "Li");
            result.Items.ShouldContain(x => x.Name == "Jun");
        }
Пример #2
0
        public async Task Should_Get_All_Authors_Without_Any_Filter()
        {
            var result = await _authorAppService.GetListAsync(new GetAuthorListDto());

            result.TotalCount.ShouldBeGreaterThanOrEqualTo(2);
            result.Items.ShouldContain(author => author.Name == "George Orwell");
            result.Items.ShouldContain(author => author.Name == "Douglas Adams");
        }
Пример #3
0
        //  public    <AuthorDto> Author { get; private set; }
        public async Task OnGet(GetAuthorListDto input)
        {
            //Author = await _authorAppService.GetListAuthorAsync(input);
            Author = await _authorAppService.GetListAsync(input);

            //var data = "b8f5c1a9-e910-fb6c-5f10-39fa16dd492c";
            //Author=await _authorAppService.GetAsync(Guid.Parse(data));
        }
Пример #4
0
        public async Task Should_Get_PagedAndSorted_Of_Authors()
        {
            var result = await WithUnitOfWorkAsync(async() =>
            {
                var input = new PagedAndSortedResultRequestDto
                {
                    SkipCount      = 0,
                    MaxResultCount = 10,
                    Sorting        = "Name"
                };

                return(await _authorAppService.GetListAsync(input));
            });

            result.TotalCount.ShouldBe(1);
            result.Items.Count.ShouldBe(1);
        }
Пример #5
0
        public async Task Should_Create_A_Valid_Book()
        {
            var authors = await _authorAppService.GetListAsync(new GetAuthorListDto());

            var firstAuthor = authors.Items.First();

            var result = await _bookAppService.CreateAsync(new CreateUpdateBookDto()
            {
                AuthorId    = firstAuthor.Id,
                Name        = "2021科幻之旅",
                Type        = BookType.ScienceFiction,
                PublishDate = DateTime.Now,
                Price       = 11,
                IsTrue      = BookIsTrue.True
            });

            result.Id.ShouldNotBe(Guid.Empty);
            result.Name.ShouldBe("2021科幻之旅");
        }
        public async Task Should_Create_A_Valid_Book()
        {
            var authors = await _authorAppService.GetListAsync(new GetAuthorListDto());

            var firstAuthor = authors.Items.First();
            //Act
            var result = await _bookAppService.CreateAsync(
                new CreateUpdateBookDto
            {
                AuthorId    = firstAuthor.Id,
                Name        = "New test book 42",
                Price       = 10,
                PublishDate = System.DateTime.Now,
                Type        = BookType.ScienceFiction
            }
                );

            //Assert
            result.Id.ShouldNotBe(Guid.Empty);
            result.Name.ShouldBe("New test book 42");
        }
Пример #7
0
 public Task <PagedResultDto <AuthorDto> > GetListAsync(GetAuthorListDto input)
 {
     return(_authorAppService.GetListAsync(input));
 }