Closed CasperWSchmidt closed 1 month ago
Still no answer to this? Is Azure Functions completely dead? @anthonychu
@fabiocav @brettsam @anthonychu Has Microsoft completely stopped developing this? Looking at closed issues the latest was closed January 2021 and none of the recently opened issues has been answered (including this one). It's not easy trusting Azure Functions in production when you get the feeling that MS does not prioritize it...
This is truly a bad customer experience. more than 4 months without any kind of response! I guess Azure Functions are truly dead and we are forced to move to AWS or GCP to be taken seriously :(
Still nothing? This is impresive!
@CasperWSchmidt Have you tried this workaround?
var startup = new StartupHelper();
var webJobsBuilderContext = new WebJobsBuilderContext
{
Configuration = new ConfigurationStub()
};
using var host = new HostBuilder()
.ConfigureWebJobs(webJobsBuilder => startup.Configure(webJobsBuilderContext, webJobsBuilder))
.Build();
var container = startup.GetContainer();
Assert.NotNull(container.GetInstance<SomeHandler>());
Assert.NotNull(container.GetInstance<SomeOtherHandler>());
It's a slightly modified version of a code described in the article Integration Testing in Azure Functions with Dependency Injection by Saeb Amini
@ycherkes No - I will definitely try that when I get the time :)
Apologies for lack of engagement here.
This item reflects a feature request, and we do not presently have plans to make changes to this component outside of what is necessary to support the in-process model through its remaining support window.
Hi there
I'm trying to do some testing to ensure that our functions will startup correctly, but instead of using Microsofts DI framework, we use SimpleInjector. To make sure that we can use services registered in both frameworks we use the approach described here. In my tests, I want to call the method
Configure
to get everything registered and then be able to access the instance ofContainer
to check if relevant services are registered correctly. Our Azure Functions are humble objects that simply ask the mediator to handle the request, but this call requires the correct handlers to be able to be resolved from the container in order for the functions to run correctly.I have tried to make stub classes for
FunctionsHostBuilderContext
andFunctionsHostBuilder
, but even though i create an instance ofWebJobsBuilderContext
and set my configuration stub correctly, it is not returned to my startup code becauseGetContext()
onIFunctionsHostBuilder
is an extension method that checks if the context is an instance of the internal interfaceIFunctionsHostBuilderExt
. If not, it returns a new default context.This makes it really hard to test if the startup process registers everything correctly. Why is
GetContext()
not just a method onIFunctionsHostBuilder
, and if not, why not exposeIFunctionsHostBuilderExt
to the public so that my own stub class can inherit from this interface as well :)Any other ideas as to how I can test this are welcome.
My test classes looks like this:
The test I'm trying to run:
Ideally I would just create in instance of
FunctionsHostBuilder
and provide the configuration, but that is not possible because the class is internal as well...