How can I instantiate an Azure function in e.g. integration tests through dependency injection?
Consider the following function:
public class CheckApplications(IGovernanceService governanceService, ILogger<CheckApplications> logger)
{
[Function(nameof(CheckApplications))]
public async Task CheckApplicationsTimerTrigger(
[TimerTrigger("0 0 12 * * *", RunOnStartup = false)] TimerInfo myTimer,
FunctionContext context,
CancellationToken cancellationToken)
{
...
}
}
As there is no Microsoft.AspNetCore.Mvc.Testing
package for Azure functions, I want to integration test my functions by instantiating them in code.
However, I can't see that the individual functions are present in the service collection, so how would I instantiate them in this case?