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