Beispiel #1
0
        public void Init(string testName)
        {
            TestName = testName;
            QueryServiceMock      queryService      = new QueryServiceMock();
            WoxContextServiceMock woxContextService = new WoxContextServiceMock(queryService);
            var constantProvider = new ConstantProvider <ScalarFloat, float>();
            IUnitService <ScalarFloat, float> unitService = new UnitService <ScalarFloat, float>(constantProvider);
            SystemServiceMock systemService = new SystemServiceMock();
            IDataAccessConfigurationService dataAccessConfigurationService = new DataAccessConfigurationService(systemService);
            IDataAccessService          dataAccessService          = new DataAccessService(dataAccessConfigurationService);
            IPrefixDefinitionRepository prefixDefinitionRepository = new PrefixDefinitionRepository(dataAccessService);
            IUnitDefinitionRepository   unitDefinitionRepository   = new UnitDefinitionRepository(dataAccessService);
            IFileGeneratorService       fileGeneratorService       = new FileGeneratorServiceMock();
            IFileReaderService          fileReaderService          = new FileReaderServiceMock();
            IUnitConversionService      unitConversionService      = new UnitConversionService(unitService, dataAccessService, prefixDefinitionRepository, unitDefinitionRepository, fileGeneratorService, fileReaderService);

            WoxUnitResultFinder woxUnitResultFinder = new WoxUnitResultFinder(woxContextService, unitConversionService, systemService);

            systemService.ApplicationDataPath = TestPath;

            dataAccessService.Init();
            woxUnitResultFinder.Init();

            WoxContextService   = woxContextService;
            QueryService        = queryService;
            WoxUnitResultFinder = woxUnitResultFinder;
            SystemService       = systemService;

            WoxContextService.AddQueryFetcher("unit", WoxUnitResultFinder);
        }
        public void Init(string testName)
        {
            TestName = testName;
            QueryServiceMock               queryService                  = new QueryServiceMock();
            WoxContextServiceMock          woxContextService             = new WoxContextServiceMock(queryService);
            SystemWebAppServiceMock        systemService                 = new SystemWebAppServiceMock();
            IDataAccessService             dataAccessService             = new DataAccessService(systemService);
            IWebAppItemRepository          webAppItemRepository          = new WebAppItemRepository(dataAccessService);
            IWebAppConfigurationRepository webAppConfigurationRepository = new WebAppConfigurationRepository(dataAccessService);
            FileGeneratorServiceMock       fileGeneratorService          = new FileGeneratorServiceMock();
            FileReaderServiceMock          fileReaderService             = new FileReaderServiceMock();
            IHelperService helperService = new HelperService();
            ApplicationInformationServiceMock applicationInformationService = new ApplicationInformationServiceMock();
            IWebAppService   webAppService         = new WebAppService(dataAccessService, webAppItemRepository, webAppConfigurationRepository, systemService, fileGeneratorService, fileReaderService, helperService);
            IWoxResultFinder woxWebAppResultFinder = new WebAppResultFinder(woxContextService, webAppService, helperService, applicationInformationService, systemService);

            systemService.ApplicationDataPath = GetApplicationDataPath();

            WoxContextService             = woxContextService;
            QueryService                  = queryService;
            SystemService                 = systemService;
            WebAppService                 = webAppService;
            FileGeneratorService          = fileGeneratorService;
            FileReaderService             = fileReaderService;
            WoxWebAppResultFinder         = woxWebAppResultFinder;
            HelperService                 = helperService;
            ApplicationInformationService = applicationInformationService;

            WoxContextService.AddQueryFetcher("wap", WoxWebAppResultFinder);
        }