コード例 #1
0
        public async Task ReadFolders_NoFoldersExist_EmptyPageIsReturned()
        {
            var foldersPagedSeed = new PaginatedResult <FolderDto>(new List <FolderDto>(), null);

            var query        = new ReadFoldersQuery();
            var queryHandler = ReadFoldersQueryHandlerFactory.Create(foldersPagedSeed);

            var response = await queryHandler.Handle(query, CancellationToken.None);

            response.Items.Count.ShouldBe(0);
            response.NextPageToken.ShouldBeNull();
        }
コード例 #2
0
        public async Task ReadFolders_ThreeFoldersExist_ThreeFoldersAreRetrieved()
        {
            var foldersPagedSeed = GetFoldersSeed();

            var query        = new ReadFoldersQuery();
            var queryHandler = ReadFoldersQueryHandlerFactory.Create(foldersPagedSeed);

            var response = await queryHandler.Handle(query, CancellationToken.None);

            response.Items.Count.ShouldBe(foldersPagedSeed.Items.Count);
            response.NextPageToken.ShouldBe(foldersPagedSeed.NextPageToken);

            foreach (var item in response.Items)
            {
                foldersPagedSeed.Items.ShouldContain(
                    x => x.Id == item.Id &&
                    x.CreationDate == item.CreationDate &&
                    x.Name == item.Name &&
                    x.ParentId == item.ParentId);
            }
        }