public void UseParallelExecution_configures_options(SnsLambdaConfigurator <TestNotification, TestNotificationHandler> configurator, int maxDegreeOfParallelism) { configurator.Services.AddLogging(); configurator.UseParallelExecution(maxDegreeOfParallelism); var sp = configurator.Services.BuildServiceProvider(); var options = sp.GetService <IOptions <ParallelSnsExecutionOptions> >(); Assert.That(options?.Value.MaxDegreeOfParallelism, Is.EqualTo(maxDegreeOfParallelism)); }
public void UseParallelExecution_overrides_default_registration(int?maxDegreeOfParallelism, SnsLambdaConfigurator <TestNotification, TestNotificationHandler> configurator) { configurator.Services.AddLogging(); configurator.Services.AddTransient <ISerializer, SystemTextJsonSerializer>(); configurator.Services.AddTransient <IEventHandler <SNSEvent>, SnsEventHandler <TestNotification> >(); configurator.UseParallelExecution(maxDegreeOfParallelism); var sp = configurator.Services.BuildServiceProvider(); var handler = sp.GetService <IEventHandler <SNSEvent> >(); Assert.That(handler, Is.InstanceOf <ParallelSnsEventHandler <TestNotification> >()); }