Mocking extension methods is not possible as they are
Use the static modifier to declare a static member, which belongs to the type itself rather than to a specific object.
Create the mocked logger that is injected into
var loggerMock = new Mock<ILogger<SomeServiceClient>>();
loggerMock.Object and calling the unit of work you can verify what the extension method is calling under the hood.
Key things to look at here are:
LogLevel.Errorwhich will be for
logEntryToBeWrittenis the text to be logged without the exeption.
var logEntryToBeWritten = "The what what borked"; loggerMock.Verify( x => x.Log( It.Is<LogLevel>(l => l == LogLevel.Error), It.IsAny<EventId>(), It.Is<It.IsAnyType>((v, t) => v.ToString() == logEntryToBeWritten), It.IsAny<Exception>(), It.Is<Func<It.IsAnyType, Exception, string>>((v, t) => true)));