Exemple #1
0
        public static async Task RunOnMergeSpecificationInformationForProviderWithResults([QueueTrigger(ServiceBusConstants.QueueNames.MergeSpecificationInformationForProvider,
                                                                                                        Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using IServiceScope scope = Functions.Results.Startup.RegisterComponents(new ServiceCollection()).CreateScope();

            //the message helper was throwing newtonsoft exceptions so gone with this
            QueueMessage <MergeSpecificationInformationRequest> queueMessage = item.AsPoco <QueueMessage <MergeSpecificationInformationRequest> >();

            Message message = new Message(queueMessage.Data.AsJsonBytes());

            foreach (KeyValuePair <string, string> property in queueMessage.UserProperties)
            {
                message.UserProperties.Add(property.Key, property.Value);
            }

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

            await function.Run(message);

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

            SmokeResponse response = await RunSmokeTest(ServiceBusConstants.QueueNames.MergeSpecificationInformationForProvider,
                                                        async(Message smokeResponse) => await onReIndexCalculationResults.Run(smokeResponse));

            response
            .Should()
            .NotBeNull();
        }