public void TestInitialize()
        {
            _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer()));

            basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(_scope);

            OrderConfigurator orderConfigurator = null;
            //new OrderConfigurator(new OrderStateFactory(new FuelReportDomainService(new FuelReportRepository(_scope),
            //    new VoyageDomainService( new VoyageRepository(_scope)),new InventoryOperationDomainService(new InventoryOperationRepository(_scope)),
            //    new InventoryOperationRepository(_scope),new InventoryOperationFactory()   ),new InvoiceDomainService() ));

            var client = new WebClientHelper(new HttpClient());
            _orderRepository = new OrderRepository(_scope, orderConfigurator, new EFRepository<OrderItem>(_scope));
            _orderRepository.GetAll();
            _tr = new TransactionScope();

            var hostAdapter = new ExternalHostAddressHelper();

            _target = new GoodFacadeService(
                new GoodDomainService(
                    new GoodAntiCorruptionAdapter(
                        new GoodAntiCorruptionServiceWrapper
                    (client, hostAdapter),
                    new GoodAntiCorruptionMapper()),
                    new EFRepository<Good>(_scope),
                    basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(_scope)),
                    new GoodToGoodDtoMapper(new CompanyGoodUnitToGoodUnitDtoMapper()));
        }
        public void TestInitialize()
        {
            _scope = new UnitOfWorkScope(new EFUnitOfWorkFactory(() => new DataContainer()));

            basicInfoDomainServiceObjects = new BasicInfoDomainServiceObjectsContainer(_scope);

            _target = new GoodUnitConvertorDomainService(
                new GoodDomainService(
                    new GoodAntiCorruptionAdapter(
                        new GoodAntiCorruptionServiceWrapper(new WebClientHelper(new HttpClient()),
                                                             new ExternalHostAddressHelper()),
                        new GoodAntiCorruptionMapper()), new EFRepository<Good>(_scope),
                        basicInfoDomainServiceObjects.CompanyDomainService, new EFRepository<GoodUnit>(_scope)),
                        new GoodUnitDomainService(new BaseAntiCorruptionAdapter<GoodUnit, GoodUnitDto>(new BaseAntiCorruptionServiceWrapper<GoodUnitDto>
                            (new WebClientHelper(new HttpClient())), new BaseAntiCorruptionMapper<GoodUnit, GoodUnitDto>()),
                            new EFRepository<GoodUnit>(_scope)

                            ));
        }
Пример #3
0
        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);
        }