public async void Handle_Async_Query() { var fakeQuery = new Query(); var fakeModel = new Model(); var handler = new Mock <IQueryHandlerAsync <Query, Model> >(); handler .Setup(x => x.Handle(fakeQuery, _cancellationToken)) .ReturnsAsync(fakeModel); _mockHandlerFactory .Setup(x => x.Resolve(typeof(IQueryHandlerAsync <Query, Model>))) .Returns(handler.Object); var result = await _dispatcher.AskAsync(fakeQuery, _cancellationToken); Assert.Equal(result, fakeModel); }