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

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

            await function.Run(message);

            log.LogInformation($"C# Queue trigger function processed: {item}");
        }
Example #2
0
        public async Task OnApplyTemplateCalculations_SmokeTestSucceeds()
        {
            OnApplyTemplateCalculations onApplyTemplateCalculations = new OnApplyTemplateCalculations(_logger,
                                                                                                      _applyTemplateCalculationsService,
                                                                                                      Services.BuildServiceProvider().GetRequiredService <IMessengerService>(),
                                                                                                      _userProfileProvider,
                                                                                                      IsDevelopment);

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

            response
            .Should()
            .NotBeNull();
        }