Skip to content

Instantly share code, notes, and snippets.

@taylorc
Last active January 9, 2020 04:15
Show Gist options
  • Save taylorc/47cb383d6f04bccdf27ac586b7d16ee8 to your computer and use it in GitHub Desktop.
Save taylorc/47cb383d6f04bccdf27ac586b7d16ee8 to your computer and use it in GitHub Desktop.
[Collection("QueryTests")]
public class GetTodosQueryTests {
private readonly ApplicationDbContext _context;
private readonly IMapper _mapper;
public GetTodosQueryTests(QueryTestFixture fixture) {
_context = fixture.Context;
_mapper = fixture.Mapper;
}
[Fact]
public async Task Handle_ReturnsCorrectVmAndListCount() {
var query = new GetTodosQuery();
var handler = new GetTodosQuery.GetTodosQueryHandler(_context, _mapper);
var result = await handler.Handle(query, CancellationToken.None);
result.ShouldBeOfType < TodosVm > ();
result.Lists.Count.ShouldBe(1);
var list = result.Lists.First();
list.Items.Count.ShouldBe(5);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment