/// <summary> /// Uses the functions startup classes specified by <see cref="FunctionsStartupAttribute"/> when configuring the host. /// Startup classes can contribute to logging, configuration sources, services, and application configuration. /// </summary> /// <param name="webHostBuilder">The web host builder to configure.</param> /// <param name="assembly">The assembly to query for attributes specifying startup classes.</param> /// <returns>The original builder, for method chaining.</returns> public static IWebHostBuilder UseFunctionsStartups(this IWebHostBuilder webHostBuilder, Assembly assembly) { foreach (var startup in HostingInternals.GetStartups(assembly)) { webHostBuilder.UseFunctionsStartup(startup); } return(webHostBuilder); }
public void GetStartups() { var startups = HostingInternals.GetStartups(typeof(FunctionsStartupTest).Assembly); var actualTypes = startups.Select(startup => startup.GetType()).ToArray(); // TestStartup2 comes before TestStartup1 due to the Order properties. var expectedTypes = new[] { typeof(TestStartup2), typeof(TestStartup1) }; Assert.Equal(expectedTypes, actualTypes); }