public void GetPaged_ShouldThrow_WhenCanceled() { var cts = new CancellationTokenSource(); cts.Cancel(); var query = new GetModuleListQueryPaging { PathKey = "some-key", PageNumber = 1, PageSize = 1 }; FluentActions.Invoking(() => SendAsync(query, cts.Token)).Should().ThrowAsync <TaskCanceledException>(); }
public async Task GetPagedOutOfRange_ShouldReturnEmpty() { var path = await AddAsync( new Path { Title = "Some Path3", Key = "some-path-3", Description = "Some Path Description" }); _ = await SendAsync(new CreateModule { Key = "module-key", Title = "New Module1", Description = "New Module1 Description" }); _ = await SendAsync(new CreateModule { Key = "module-key-two", Title = "New Module2", Description = "New Module2 Description" }); _ = await SendAsync(new CreateModule { Key = "module-key-three", Title = "New Module3", Description = "New Module3 Description" }); var query = new GetModuleListQueryPaging { PathKey = path.Key, PageSize = 999, PageNumber = 3 }; var result = await SendAsync(query); result.Item1.PageSize.Should().Be(999); result.Item1.PageNumber.Should().Be(3); result.Item2.Should().BeEmpty(); }