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(); }
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(); }