Want to write unit test for HttpTrigger GET. Have method signature as follow:
public static async Task<HttpResponseMessage> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", Route = null)]
HttpRequestMessage request,
ILogger log)
here, ILogger
is type of Microsoft.Extensions.Logging.
How to write unit test case with this injection,
Tried to create stub of ILogger
using below stuff but this needs LoggerFactory
.
public class LoggerWriter : Microsoft.Extensions.Logging.Logger<ILogger>
{
public LoggerWriter() : base() // this needs logger factory.
{
}
}
Any sample unit test for httptrigger azure function to overcome above issue (Ilogger
injection) is helpful.