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

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

            await function.Run(message);

            log.LogInformation($"C# Queue trigger function processed: {item}");
        }
示例#2
0
        public async Task OnCalcsInstructAllocationResults_SmokeTestSucceeds()
        {
            OnCalcsInstructAllocationResults onCalcsInstructAllocationResults = new OnCalcsInstructAllocationResults(_logger,
                                                                                                                     _buildProjectsService,
                                                                                                                     Services.BuildServiceProvider().GetRequiredService <IMessengerService>(),
                                                                                                                     _userProfileProvider,
                                                                                                                     IsDevelopment);

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

            response
            .Should()
            .NotBeNull();
        }