public static async Task RunDeleteDatasets([QueueTrigger(ServiceBusConstants.QueueNames.DeleteDatasets, Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using (IServiceScope scope = Functions.Datasets.Startup.RegisterComponents(new ServiceCollection()).CreateScope())
            {
                CultureInfo.CurrentCulture = new CultureInfo("en-GB");
                Message message = Helpers.ConvertToMessage <string>(item);

                OnDeleteDatasets function = scope.ServiceProvider.GetService <OnDeleteDatasets>();

                await function.Run(message);

                log.LogInformation($"C# Queue trigger function processed: {item}");
            }
        }
Ejemplo n.º 2
0
        public async Task OnDeleteDatasets_SmokeTestSucceeds()
        {
            OnDeleteDatasets onDeleteDatasets = new OnDeleteDatasets(_logger,
                                                                     _datasetService,
                                                                     Services.BuildServiceProvider().GetRequiredService <IMessengerService>(),
                                                                     _userProfileProvider,
                                                                     IsDevelopment);

            SmokeResponse response = await RunSmokeTest(ServiceBusConstants.QueueNames.DeleteDatasets,
                                                        async(Message smokeResponse) => await onDeleteDatasets.Run(smokeResponse));

            response
            .Should()
            .NotBeNull();
        }