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