public SimpleTestContainer() { // domain event publisher var domainEventPublisher = new SimpleEventPublisher(); // infrastructure service var emaildispatcher = new EmailDispatcher(); // event listeners var driverCreatedEventListener = new DriverCreatedEventListener(); domainEventPublisher.Subscribe <DriverCreatedEvent>(driverCreatedEventListener); //unitOfWork var unitOfWork = new MemoryCarRentalUnitOfWork( new MemoryRepository <Driver>(), new MemoryRepository <Car>(), new MemoryRepository <Rental>(), new MemoryRepository <Scooter>()); // factories var rentalFactory = new RentalFactory(domainEventPublisher); var carFactory = new CarFactory(domainEventPublisher); var freeMinutesFactory = new FreeMinutesFactory(); // mappers var carMapper = new CarMapper(); var driverMapper = new DriverMapper(); var scooterMapper = new ScooterMapper(); var rentalMapper = new RentalMapper(); this.CarService = new CarService( unitOfWork, carMapper, domainEventPublisher); this.ScooterService = new ScooterService( unitOfWork, scooterMapper, domainEventPublisher); this.DriverService = new DriverService( unitOfWork, driverMapper, domainEventPublisher); this.RentalService = new RentalService( unitOfWork, rentalFactory, rentalMapper, freeMinutesFactory, domainEventPublisher); }
public TestContainer() { UnitOfWork = new MemoryCarRentalUnitOfWork(); var carFactory = new CarFactory(); var driverFactory = new DriverFactory(); _rentalFactory = new RentalFactory(); var rentalAreaFactory = new RentalAreaFactory(); var positionService = new PositionService(UnitOfWork); var carMapper = new CarMapper(); var driverMapper = new DriverMapper(); _rentalMapper = new RentalMapper(); var rentalAreaMapper = new RentalAreaMapper(); CarService = new CarService(carFactory, UnitOfWork, carMapper); DriverService = new DriverService(driverFactory, UnitOfWork, driverMapper); RentalService = new RentalService(_rentalFactory, UnitOfWork, _rentalMapper, positionService); RentalAreaService = new RentalAreaService(rentalAreaFactory, UnitOfWork, rentalAreaMapper); }