コード例 #1
0
        public static async Task RunDeleteTests([QueueTrigger(ServiceBusConstants.QueueNames.DeleteTests, Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using (IServiceScope scope = Functions.Scenarios.Startup.RegisterComponents(new ServiceCollection()).CreateScope())
            {
                Message message = Helpers.ConvertToMessage <string>(item);

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

                await function.Run(message);

                log.LogInformation($"C# Queue trigger function processed: {item}");
            }
        }
        public async Task OnDeleteTests_SmokeTestSucceeds()
        {
            OnDeleteTests onDeleteTests = new OnDeleteTests(_logger,
                                                            _scenariosService,
                                                            Services.BuildServiceProvider().GetRequiredService <IMessengerService>(),
                                                            _userProfileProvider,
                                                            IsDevelopment);

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

            response
            .Should()
            .NotBeNull();
        }