public static async Task RunReIndexTemplate([QueueTrigger(ServiceBusConstants.QueueNames.PolicyReIndexTemplates, Connection = "AzureConnectionString")] string item, ILogger log) { using IServiceScope scope = Functions.Policy.Startup.RegisterComponents(new ServiceCollection()).CreateScope(); Message message = Helpers.ConvertToMessage <string>(item); OnReIndexTemplates function = scope.ServiceProvider.GetService <OnReIndexTemplates>(); await function.Run(message); log.LogInformation($"C# Queue trigger function processed: {item}"); }
public async Task OnReIndexTemplates_SmokeTestSucceeds() { OnReIndexTemplates onReIndexTemplates = new OnReIndexTemplates(_logger, _templatesReIndexerService, Services.BuildServiceProvider().GetRequiredService <IMessengerService>(), _userProfileProvider, IsDevelopment); SmokeResponse response = await RunSmokeTest(ServiceBusConstants.QueueNames.PolicyReIndexTemplates, async(Message smokeResponse) => await onReIndexTemplates.Run(smokeResponse)); response .Should() .NotBeNull(); }