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