Exemple #1
0
 public async Task <IEnumerable <Path> > Handle(GetPathListQuery request, CancellationToken cancellationToken)
 {
     return(await _context.Paths
            .OrderBy(t => t.Title)
            .ProjectTo <Path>(_mapper.ConfigurationProvider)
            .ToListAsync(cancellationToken));;
 }
Exemple #2
0
        public void Get_ShouldThrow_WhenCanceled()
        {
            var cts = new CancellationTokenSource();

            cts.Cancel();

            var query = new GetPathListQuery();

            FluentActions.Invoking(() =>
                                   SendAsync(query, cts.Token)).Should().ThrowAsync <TaskCanceledException>();
        }
Exemple #3
0
        public async Task Get_ShouldReturnPathList()
        {
            await AddAsync(new Path { Title = "Path1", Key = "some-path1", Description = "Description 1" });
            await AddAsync(new Path { Title = "Path2", Key = "some-path2", Description = "Description 2" });
            await AddAsync(new Path { Title = "Path3", Key = "some-path3", Description = "Description 3" });
            await AddAsync(new Path { Title = "Path4", Key = "some-path4", Description = "Description 4" });

            var query = new GetPathListQuery();

            var result = await SendAsync(query);

            result.Should().HaveCount(4);
        }