Пример #1
0
        public static async Task RunCalculationResultsCsvGeneration([QueueTrigger(ServiceBusConstants.QueueNames.CalculationResultsCsvGeneration, Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using IServiceScope scope = Functions.Results.Startup.RegisterComponents(new ServiceCollection()).CreateScope();

            Message message = Helpers.ConvertToMessage <string>(item);

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

            await function.Run(message);

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

            SmokeResponse response = await RunSmokeTest(ServiceBusConstants.QueueNames.CalculationResultsCsvGeneration,
                                                        async(Message smokeResponse) => await onCalculationResultsCsvGeneration.Run(smokeResponse), useSession : true);

            response
            .Should()
            .NotBeNull();
        }