Esempio n. 1
0
 public DataService(UnitOfWork unitOfWork, IConfiguration configuration,
                    CvOnlineDataService cvOnlineDataService,
                    CvBankasDataService cvBankasDataService,
                    CvMarketDataService cvMarketDataService
                    )
 {
     _configuration = configuration;
     _unitOfWork    = unitOfWork;
 }
Esempio n. 2
0
        public TestBase()
        {
            _cvOnlineScraper = SetupMockScraper(cvOnlineFilePath);
            _cvBankasScraper = SetupMockScraper(cvBankasFilePath);
            _cvMarketScraper = SetupMockScraper(CvMarketFilePath);


            _cvOnlineScrapeService = new CvOnlineScrapeService(_cvOnlineScraper, new CvOnlineConfiguration());
            _cvBankasScrapeService = new CvBankasScrapeService(_cvBankasScraper, new CvBankasConfiguration());
            _cvMarketScrapeService = new CvMarketScrapeService(_cvMarketScraper, new CvMarketConfiguration());

            var options = new DbContextOptionsBuilder <DataContext>()
                          .UseInMemoryDatabase("TestDb")
                          .Options;

            var context = new DataContext(options);

            var mapperConfig = new MapperConfiguration(cfg => cfg.AddProfile <MappingProfile>());

            var _mapper = mapperConfig.CreateMapper();

            _cvOnlineRepostory  = new CvOnlineRepostory(context, _mapper);
            _cvBankasRepository = new CvBankasRepository(context, _mapper);
            _cvMarketRepository = new CvMarketRepository(context, _mapper);

            _companyService = new CompanyService(context);

            _cvOnlineDataService = new CvOnlineDataService(
                _cvOnlineScrapeService, _cvOnlineRepostory, _mapper, _companyService);

            _cvBankasDataService = new CvBankasDataService(
                _cvBankasScrapeService, _cvBankasRepository, _mapper, _companyService);

            _cvMarketDataService = new CvMarketDataService(
                _cvMarketScrapeService, _cvMarketRepository, _mapper, _companyService);


            _unitOfWork = new UnitOfWork(context, _mapper);

            _dataService = new DataService(_unitOfWork, _mapper,
                                           _cvOnlineDataService, _cvBankasDataService, _cvMarketDataService
                                           );
        }