public static async Task RunAddRelationship([QueueTrigger(ServiceBusConstants.QueueNames.AddDefinitionRelationshipToSpecification, Connection = "AzureConnectionString")] string item, ILogger log) { using IServiceScope scope = Functions.Specs.Startup.RegisterComponents(new ServiceCollection()).CreateScope(); Message message = Helpers.ConvertToMessage <AssignDefinitionRelationshipMessage>(item); OnAddRelationshipEvent function = scope.ServiceProvider.GetService <OnAddRelationshipEvent>(); await function.Run(message); log.LogInformation($"C# Queue trigger function processed: {item}"); }
public async Task OnAddRelationshipEvent_SmokeTestSucceeds() { OnAddRelationshipEvent onAddRelationshipEvent = new OnAddRelationshipEvent(_logger, _specificationsService, Services.BuildServiceProvider().GetRequiredService <IMessengerService>(), _userProfileProvider, IsDevelopment); SmokeResponse response = await RunSmokeTest(ServiceBusConstants.QueueNames.AddDefinitionRelationshipToSpecification, async(Message smokeResponse) => await onAddRelationshipEvent.Run(smokeResponse)); response .Should() .NotBeNull(); }