Пример #1
0
        public static async Task RunOnCalcsCreateDraftEvent(
            [QueueTrigger(ServiceBusConstants.QueueNames.CalcEngineGenerateAllocationResults, Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using IServiceScope scope = Functions.CalcEngine.Startup.RegisterComponents(new ServiceCollection()).CreateScope();
            Message message = Helpers.ConvertToMessage <string>(item);

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

            await function.Run(message);

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

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

            response
            .Should()
            .NotBeNull();
        }