Hi,
I recently migrated to 5.0.1 and realized that AsyncRequestHandler does not have a HandleCore() anymore, nor any public Handler() method, which is a bit annoying for testing.
I created my own PublicAsyncRequestHandler but would it make sense to make the Handle() method public in AsyncRequestHandler ? (I might have missed something and apologize if it's the case).
Thank you
@alprema i ran into this issue before as well. The public method is still there, however it is explicitly implemented on the interface. so in your test you have to do something like this.
public class MyHandler : AsyncRequestHandler<Request, Response> { }
public class MyHandlerTests
{
public void Test()
{
IRequestHandler<Request, Response> handler = new MyHandler();
handler.Handle(...);
}
}
see https://github.com/jbogard/MediatR/blob/master/src/MediatR/IRequestHandler.cs#L40
Long story short, we can't have the naming conventions without hiding some methods.
Most helpful comment
@alprema i ran into this issue before as well. The public method is still there, however it is explicitly implemented on the interface. so in your test you have to do something like this.
see https://github.com/jbogard/MediatR/blob/master/src/MediatR/IRequestHandler.cs#L40