Ejemplo n.º 1
0
        public void ReadFolders_NextPageTokenIsInvalid_ThrowsInvalidNextPageTokenRequestException()
        {
            var query        = new ReadFoldersQuery(100, Guid.NewGuid().ToString());
            var queryHandler = ReadFoldersQueryHandlerFactory.CreateForInvalidNextPageTokenRepositoryException();

            Should.Throw <InvalidNextPageTokenRequestException>(
                async() => await queryHandler.Handle(query, CancellationToken.None));
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
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);
            }
        }