Example #1
0
        public void ShouldReturnNotFound_WhenIdNotFound()
        {
            var query = new GetPathQuery()
            {
                Id = 99999
            };

            FluentActions.Invoking(() =>
                                   SendAsync(query)).Should().ThrowAsync <NotFoundException>();
        }
Example #2
0
        public void GetOne_ShouldThrow_WhenCanceled()
        {
            var cts = new CancellationTokenSource();

            cts.Cancel();

            var query = new GetPathQuery()
            {
                Id = 1
            };

            FluentActions.Invoking(() =>
                                   SendAsync(query, cts.Token)).Should().ThrowAsync <TaskCanceledException>();
        }
Example #3
0
        public async Task GetOne_ShouldReturnPath()
        {
            var path = await AddAsync(new Path
            {
                Title       = "Some Path",
                Key         = "some-path",
                Description = "Some Path Description",
                Tags        = new List <string> {
                    "Tag1", "Tag2", "Tag3"
                }
            });

            var query = new GetPathQuery()
            {
                Id = path.Id
            };

            var result = await SendAsync(query);

            result.Title.Should().NotBeEmpty();
            result.Tags.Should().HaveCount(3);
        }