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

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

            await function.Run(message);

            log.LogInformation($"C# Queue trigger function processed: {item}");
        }
示例#2
0
        public async Task OnUpdateCodeContextCache_SmokeTestSucceeds()
        {
            OnUpdateCodeContextCache onApplyTemplateCalculations = new OnUpdateCodeContextCache(_logger,
                                                                                                Substitute.For <ICodeContextCache>(),
                                                                                                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();
        }