jbogard / MediatR

Simple, unambitious mediator implementation in .NET
Apache License 2.0
10.91k stars 1.16k forks source link

Validate the registered requests? #943

Closed romainf-ubi closed 11 months ago

romainf-ubi commented 12 months ago

Hi!

I have several projects in my solution and each project generates a single EXE. Each EXE is registering different requests and I'd like to unit test that some requests are indeed registered.

My goal would be to do something like that:

var myApp = MyApp.Create();

var request = myApp.Host.Services.GetService<MyRequest>();  // this obviously doesn't work...
Assert.That(requests, Is.Not.Null);                         // but it's to see what I'd like to be able to test
jbogard commented 11 months ago

This is better suited for Stack Overflow.

romainf-ubi commented 11 months ago

Thx. Done here: https://stackoverflow.com/questions/77046588/is-it-possible-to-test-that-a-mediatr-request-has-been-registered