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