public async Task ResolveNotificationSimplePipeline() { var emitter = _serviceCollection .AddNotificationProcessor <PlusNotificationProcessor>() .BuildServiceProvider() .GetRequiredService <IEmitter>(); var notification = new PlusNotification(); await emitter.Publish(notification); notification.Counter.Should().Be(1); }
public async Task ResolveNotificationSequentialPipeline(uint count) { for (var i = 0; i < count; i++) { _serviceCollection.AddNotificationProcessor <PlusNotificationProcessor>(); } var emitter = _serviceCollection .BuildServiceProvider() .GetRequiredService <IEmitter>(); for (var i = 0; i < 100; i++) { var notification = new PlusNotification(); await emitter.Publish(notification); notification.Counter.Should().Be((int)count); } }
public void Init() { _emitterNotifications = new PlusNotification[Count]; _mediatorNotifications = new Notification[Count]; for (var i = 0; i < Count; i++) { _emitterNotifications[i] = new PlusNotification(); _mediatorNotifications[i] = new Notification(); } var repository = new BooRepository(null, null); _mediator = MediatorBuilder.BuildMediatR(repository, services => services .AddSingleton <INotificationHandler <Notification>, NotificationHandler>(), 5); _emitter = MediatorBuilder.BuildEmitter(repository, services => services .AddNotificationProcessor <PlusNotificationProcessor>(), 5); }