public RequestChangeOfSupplierTests() { var services = new ServiceCollection(); _connectionString = Environment.GetEnvironmentVariable("MarketData_IntegrationTests_ConnectionString"); services.AddScoped <IDbConnectionFactory>(sp => new SqlDbConnectionFactory(_connectionString)); services.AddScoped <IUnitOfWorkCallback, UnitOfWorkCallback>(); services.AddScoped <ISystemDateTimeProvider, SystemDateTimeProviderStub>(); services.AddScoped <IEventPublisher, EventPublisherStub>(); services.AddScoped <IActorMessagePublisher, ActorMessagePublisher>(); services.AddScoped <IMeteringPointRepository, MeteringPointRepository>(); services.AddScoped <IEnergySupplierRepository, EnergySupplierRepository>(); services.AddMediatR(new[] { typeof(RequestChangeSupplierCommandHandler).Assembly, }); services.AddScoped(typeof(IPipelineBehavior <,>), typeof(UnitOfWorkHandlerBehavior <,>)); services.AddScoped(typeof(IPipelineBehavior <,>), typeof(PublishIntegrationEventsHandlerBehavior <,>)); services.AddScoped <IPipelineBehavior <RequestChangeOfSupplier, RequestChangeOfSupplierResult>, PublishActorMessageHandlerBehavior>(); services.AddGreenEnergyHub(typeof(RequestChangeOfSupplier).Assembly); DapperNodaTimeSetup.Register(); _serviceProvider = services.BuildServiceProvider(); _mediator = _serviceProvider.GetRequiredService <IMediator>(); _meteringPointRepository = _serviceProvider.GetRequiredService <IMeteringPointRepository>(); _energySupplierRepository = _serviceProvider.GetRequiredService <IEnergySupplierRepository>(); _unitOfWorkCallback = _serviceProvider.GetRequiredService <IUnitOfWorkCallback>(); _actorMessagePublisher = _serviceProvider.GetRequiredService <IActorMessagePublisher>(); }
public ActorMessagePublisher(IDbConnectionFactory connectionFactory, ISystemDateTimeProvider systemDateTimeProvider, IUnitOfWorkCallback unitOfWorkCallback, IJsonSerializer jsonSerializer) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); _systemDateTimeProvider = systemDateTimeProvider ?? throw new ArgumentNullException(nameof(systemDateTimeProvider)); _unitOfWorkCallback = unitOfWorkCallback ?? throw new ArgumentNullException(nameof(unitOfWorkCallback)); _jsonSerializer = jsonSerializer; }
public EnergySupplierRepository(IUnitOfWorkCallback unitOfWorkCallback, IDbConnectionFactory connectionFactory) { _unitOfWorkCallback = unitOfWorkCallback ?? throw new ArgumentNullException(nameof(unitOfWorkCallback)); _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); }
public MeteringPointRepository(IDbConnectionFactory connectionFactory, IUnitOfWorkCallback unitOfWorkCallback) { _connectionFactory = connectionFactory ?? throw new ArgumentNullException(nameof(connectionFactory)); _unitOfWorkCallback = unitOfWorkCallback ?? throw new ArgumentNullException(nameof(unitOfWorkCallback)); }
public UnitOfWorkHandlerBehavior(IUnitOfWorkCallback unitOfWorkCallback) { _unitOfWorkCallback = unitOfWorkCallback ?? throw new ArgumentNullException(nameof(unitOfWorkCallback)); }