Created
September 21, 2023 19:25
-
-
Save pferreirafabricio/0988c7bbc67a241232219a9d5ca99a1c to your computer and use it in GitHub Desktop.
🧪 How to unit test if a Hangfire Job was enqueued with NSubstitute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _backgroundJobClient = Substitute.For<IBackgroundJobClient>(); | |
await _someService.MethodThatEnqueueSomething("idXXX"); | |
_backgroundJobClient.Received() | |
.Create( | |
Arg.Is<Job>( | |
job => job.Type == typeof(MyJobClass) | |
&& job.Args[0].ToString() == "idXXX" | |
), | |
Arg.Any<EnqueuedState>() | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment