private void GenerateRepositories() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, new OrderConfigurator(), new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); var hostAdapter = new ExternalHostAddressHelper(); var vesselService = new VesselDomainService(new BaseAntiCorruptionAdapter<Vessel, WarehouseDto>( new VesselAntiCorruptionServiceWrapper( client, hostAdapter), new VesselAntiCorruptionMapper()), new VesselRepository(_scope)); var goodService = new GoodDomainService(new GoodAntiCorruptionAdapter( new GoodAntiCorruptionServiceWrapper(client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope)); var companyService = new CompanyDomainService( new CompanyAntiCorruptionAdapter(new CompanyAntiCorruptionServiceWrapper (client, hostAdapter), new CompanyAntiCorruptionMapper()), new CompanyRepository(_scope)); var orderApplicationService = new OrderApplicationService( _orderRepository, _scope, new UserRepository(_scope), vesselService, goodService, new OrderFactory(new OrderCodeGenerator() , new OrderConfigurator() , new WorkflowRepository(_scope)), companyService, new OrderItemDomainService(new EFRepository<OrderItem>(_scope)), new OrderConfigurator()); _approvalWorkFlowRepository = new WorkflowLogRepository(_scope); _approveFlowApplicationService = new ApproveFlowApplicationService(_scope, _approvalWorkFlowRepository, new WorkflowRepository(_scope)); }
public void TestInitialize() { _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer())); basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(_scope); scrapTestObjects = new ScrapTestObjectsContainer(_scope); var orderConfigurator = new OrderConfigurator ( new OrderStateFactory ( new InventoryOperationDomainService(new InventoryOperationRepository(_scope), scrapTestObjects.ScrapDomainService))); var client = new WebClientHelper(new HttpClient()); _orderRepository = new OrderRepository(_scope, orderConfigurator, new EFRepository<OrderItem>(_scope)); _orderRepository.GetAll(); _tr = new TransactionScope(); var hostAdapter = new ExternalHostAddressHelper(); var vesselService = new VesselInCompanyDomainService (new VesselInCompanyRepository(_scope, null), new VoyageRepository(_scope)); //var goodPartyService = new GoodPartyAssignmentDomainService // (new GoodPartyAssignmentAntiCorruptionAdapter(new GoodAssignmentAntiCorruptionServiceWrapper(client, hostAdapter))); var goodService = new GoodDomainService ( new GoodAntiCorruptionAdapter(new GoodAntiCorruptionServiceWrapper(client, hostAdapter), new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope), basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(_scope)); var goodUnitService = new GoodUnitDomainService ( new BaseAntiCorruptionAdapter<GoodUnit, GoodUnitDto> (new BaseAntiCorruptionServiceWrapper<GoodUnitDto>(client), new BaseAntiCorruptionMapper<GoodUnit, GoodUnitDto>()), new EFRepository<GoodUnit>(_scope)); var companyService = new CompanyDomainService ( new CompanyAntiCorruptionAdapter(new CompanyAntiCorruptionServiceWrapper(client, hostAdapter), new CompanyAntiCorruptionMapper()), new CompanyRepository(_scope)); //_target = new OrderApplicationService // ( // _orderRepository, _scope, new UserRepository(_scope), vesselService, goodService, // new OrderFactory(new OrderCodeGenerator(_orderRepository), orderConfigurator, new WorkflowRepository(_scope)), companyService, // new OrderItemDomainService(new EFRepository<OrderItem>(_scope)), orderConfigurator); //_sapid = FakeDomainService.GetCompanies().Single(c => c.Id == 1); //_imsemCo = FakeDomainService.GetCompanies().Single(c => c.Id == 3); //_hafiz = FakeDomainService.GetCompanies().Single(c => c.Id == 2); this.sapidVesselInCompany = FakeDomainService.GetVesselsInCompanies().First(c => c.CompanyId == 1); _sapidVessel2 = FakeDomainService.GetVesselsInCompanies().Last(c => c.CompanyId == 1); this.hafizVesselInCompany = FakeDomainService.GetVesselsInCompanies().First(c => c.CompanyId == 2); _good = FakeDomainService.GetGoods().Single(c => c.Id == 1); _good2 = FakeDomainService.GetGoods().Single(c => c.Id == 2); _unit = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 1); _unit2 = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 2); _unit3 = FakeDomainService.GetCompanyGoodUnits().Single(c => c.Id == 4); //_goodPartAssignment = FakeDomainService.GetGoodPartyAssignments().Single(c => c.Id == 1); //_goodPartAssignment2 = FakeDomainService.GetGoodPartyAssignments().Single(c => c.Id == 2); }