public async Task GetAuthorQueryHandler_ReturnsAuthor() { await AddAuthor(); var getAuthorQueryHandler = new GetAuthorQueryHandler(TestContext.CreateHandlerContext <AuthorViewModel>(RequestDbContext), _authorService); var message = new GetAuthorQuery() { IncludeProfile = true }; var result = await getAuthorQueryHandler.Handle(message, CancellationToken.None); Assert.Equal("Tom", result.FirstName); }
public async Task GetAuthorTest() { var authorToGet = _authorFaker.Generate(); _dbContext.GetAuthor(authorToGet.Id).Returns(authorToGet); var getAuthorQueryHandler = new GetAuthorQueryHandler(_dbContext); var getAuthorQuery = new GetAuthorQuery { Id = authorToGet.Id }; var author = await getAuthorQueryHandler.Handle(getAuthorQuery, CancellationToken.None); author.Should().Be(authorToGet); }