Tips & tricks for unit testing in .NET Core 3: Checking matching and non matching arguments on ILogger

added by DotNetKicks
2/5/2020 1:59:29 PM


You must have been like me for a long time unable to do one thing with ILogger: test the arguments that are passed to its methods during your unit tests. You must most likely use extension methods such as LogDebug, logError etc ...... and indeed you can neither mock nor test the arguments passed to them.