예제 #1
0
        public static async Task RunValidateDatasetEvent([QueueTrigger(ServiceBusConstants.QueueNames.ValidateDataset, Connection = "AzureConnectionString")] string item, ILogger log)
        {
            using (IServiceScope scope = Functions.Datasets.Startup.RegisterComponents(new ServiceCollection()).CreateScope())
            {
                CultureInfo.CurrentCulture = new CultureInfo("en-GB");
                Message message = Helpers.ConvertToMessage <GetDatasetBlobModel>(item);

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

                await function.Run(message);

                log.LogInformation($"C# Queue trigger function processed: {item}");
            }
        }
예제 #2
0
        public async Task OnDatasetValidationEventFired_SmokeTestSucceeds()
        {
            OnDatasetValidationEvent onDatasetValidationEvent = new OnDatasetValidationEvent(_logger,
                                                                                             _datasetService,
                                                                                             Services.BuildServiceProvider().GetRequiredService <IMessengerService>(),
                                                                                             _userProfileProvider,
                                                                                             IsDevelopment);

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

            response
            .Should()
            .NotBeNull();
        }