Exemple #1
0
        public SimpleTestContainer()
        {
            var domainEventPublisher = new SimpleEventPublisher();

            var uoW = new MemoryCarRentalUoW(
                new MemoryRepository <Driver>(),
                new MemoryRepository <Car>(),
                new MemoryRepository <Rental>(),
                new MemoryRepository <Office>()
                );

            var freeMinutesPolicyFactory = new FreeMinutesPolicy();
            var rentalFactory            = new RentalFactory(domainEventPublisher);

            var carMapper    = new CarMapper();
            var driverMapper = new DriverMapper();
            var rentalMapper = new RentalMapper();
            var officeMapper = new OfficeMapper();


            DriverService       = new DriverService(uoW, driverMapper, domainEventPublisher);
            CarService          = new CarService(uoW, carMapper, domainEventPublisher);
            RentalService       = new RentalService(uoW, rentalMapper, domainEventPublisher, rentalFactory, freeMinutesPolicyFactory);
            FinishRentalService = new StopRentalService(uoW, domainEventPublisher);
            OfficeService       = new OfficeService(uoW, officeMapper, domainEventPublisher);
        }
 public RentalService(ICarRentalUoW uoW, RentalMapper rentalMapper, IDomainEventPublisher domainEventPublisher, RentalFactory rentalFactory, FreeMinutesPolicy policyFactory)
 {
     _uoW                  = uoW;
     _rentalMapper         = rentalMapper;
     _domainEventPublisher = domainEventPublisher;
     _rentalFactory        = rentalFactory;
     _policyFactory        = policyFactory;
 }