コード例 #1
0
        public async Task Handler_GivenInvalidAuthorId_ReturnsEmptyCommentsDTOCollection()
        {
            // Arrange
            var query = new GetPostsByAuthorIdQuery {
                AuthorId = 99
            };

            // Act
            var handler = new GetPostsByAuthorIdQuery.GetPostsByAuthorIdQueryHandler(Context, Mapper);
            var result  = await handler.Handle(query, CancellationToken.None);

            // Assert
            result.ShouldBeEmpty();
        }
コード例 #2
0
        public async Task Handler_GivenValidAuthorId_ReturnsNotEmptyPostsDTOCollection()
        {
            // Arrange
            var query = new GetPostsByAuthorIdQuery {
                AuthorId = 1
            };

            // Act
            var handler = new GetPostsByAuthorIdQuery.GetPostsByAuthorIdQueryHandler(Context, Mapper);
            var result  = await handler.Handle(query, CancellationToken.None);

            // Assert
            result.ShouldBeOfType <List <PostDTO> >();
            result.ShouldNotBeNull();
        }