MassTransit Consumer Testing #1079
-
Hey ! Im having issues trying to test an IConsumer using MassTransit. Everything works properly, but I cannot figure out how to create an integration test to check that the consumer actually gets fired. The problem is that I cannot make the TestHarness "wait" until the consumer gets fired. It always gets executed after the test and that's why It fails. I can create a loop and ** await Task.Delay(100);** to wait for it and it will eventually work. But It is not what I was expecting. Any help would be greatly appreciated! In my web app factory:
And this is my test
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @kron0s19 If this helps, you can wait until the bus has finished processing your event by awaiting the InactivityTask
Please See Chris P's comment on a similar question to yours: MassTransit/MassTransit#4890 (comment) Also the Test Harness's |
Beta Was this translation helpful? Give feedback.
Hi @kron0s19 If this helps, you can wait until the bus has finished processing your event by awaiting the InactivityTask
Please See Chris P's comment on a similar question to yours: MassTransit/MassTransit#4890 (comment)
Also the Test Harness's
Published
property contains a list which you can use to assert if it has been published or not:testHarness.Published...