public void Test()
        {
            Assert.ThrowsException <ArgumentNullException>(() => new DataStoreFactory <TwentyFourHourRuleModule>(null));
            var mockDBContext = new Mock <IDatabaseContext>();
            var fac           = new DataStoreFactory <TwentyFourHourRuleModule>(mockDBContext.Object);

            Assert.ThrowsException <ArgumentNullException>(() => fac.CreateDataStore(null));
            Assert.IsNotNull(fac.CreateDataStore(new TwentyFourHourRuleModule()));
        }
        public void DataStore_Backup_CreatesBackupAccountDataStore()
        {
            var dataStoreFactory = new DataStoreFactory();

            var type = dataStoreFactory.CreateDataStore("Backup");

            Assert.IsType <BackupAccountDataStore>(type);
        }
        public void DataStore_OtherThanBackUp_CreatesAccountDataStore()
        {
            var dataStoreFactory = new DataStoreFactory();

            var type = dataStoreFactory.CreateDataStore(null);

            Assert.IsType <AccountDataStore>(type);
        }
        public void CreateHTMLDataStoreTest()
        {
            Config.StorePath = "TestFiles/DataStore/factory-storage.html";
            Config.StoreType = DataStoreType.HTML;

            var DataStore = DataStoreFactory.CreateDataStore(Config, new LoggerMock());

            Assert.AreEqual(typeof(StoreToHtml), DataStore.GetType());
        }
        public void CreateCSVDataStoreTest()
        {
            Config.StorePath = "TestFiles/DataStore/factory-storage.csv";
            Config.StoreType = DataStoreType.CSV;

            var DataStore = DataStoreFactory.CreateDataStore(Config, new LoggerMock());

            Assert.AreEqual(typeof(StoreToCSV), DataStore.GetType());
        }
Beispiel #6
0
 internal DataCenter(DataCenterInfo config)
 {
     this.dataStore                 = DataStoreFactory.CreateDataStore(this);
     this.dataReader                = DataReaderFactory.CreateDataReader(this);
     this.dataPackageFactory        = new DataPackageFactory(dataReader);
     this.codePackageFactory        = new CodePeriodFactory(dataReader);
     this.historyDataForwardFactory = new DataForwardFactory(this);
     this.dataNavigateFactory       = new DataNavigateFactory(this);
     this.accountFactory            = new AccountManager(this, this.dataStore.CreateAccountStore());
 }
Beispiel #7
0
 public DataReader(string dataCenterUri)
 {
     this.dataStore           = DataStoreFactory.CreateDataStore(dataCenterUri);
     this.codeReader          = new CodeReader(dataStore.CreateInstrumentStore());
     this.tradingDayReader    = new CacheUtils_TradingDay(dataStore.CreateTradingDayStore().Load());
     this.tradingSessionStore = dataStore.CreateTradingSessionStore();
     this.tradingTimeStore    = dataStore.CreateTradingTimeStore();
     this.tickDataReader      = new TickDataReader(dataStore, this);
     this.klineDataReader     = new KLineDataReader(dataStore, this);
     this.timeLineDataReader  = new TimeLineDataReader(this);
     this.mainContractReader  = new MainContractReader(dataStore);
 }
        public void CreateDataStoreIncorrectTypeTest()
        {
            Config.StoreType = (DataStoreType)(-1);

            try
            {
                DataStoreFactory.CreateDataStore(Config, new LoggerMock());
            }
            catch (Exception ex)
            {
                Assert.AreEqual("Unknown Data store type -1", ex.Message);
            }
        }
Beispiel #9
0
        public static DataCenter Create(DataCenterInfo dataCenterInfo)
        {
            string uristr = dataCenterInfo.Uri;
            Uri    uri    = new Uri(uristr);

            if (uri.IsFile)
            {
                IDataStore  dataStore  = DataStoreFactory.CreateDataStore(uri.LocalPath);
                IDataReader dataReader = DataReaderFactory.CreateDataReader(uri.LocalPath);
                return(new DataCenter(dataCenterInfo, dataStore, dataReader));
            }
            return(null);
        }
        public void CreateDataStoreNotImplementedTypeTest()
        {
            var Logger = new LoggerMock();

            DataStoreType[] types = new DataStoreType[] { DataStoreType.EXCEL, DataStoreType.SQL };

            foreach (DataStoreType type in types)
            {
                Config.StoreType = type;

                Assert.ThrowsException <NotImplementedException>(
                    () => DataStoreFactory.CreateDataStore(Config, Logger)
                    );
            }
        }
Beispiel #11
0
        static void Initialization(Configuration config)
        {
            Logger = new Logger.Logger(config.LogPath, new TimeProvider());
            Logger.Log("Logger initialized");

            Reader = InputProviderFactory.CreateInputReader(config);
            Logger.Log("Reader of type " + Reader.GetType().Name + " initialized");

            Driver = new InternetExplorerDriver("Resources/");
            Logger.Log("InternetExplorerDriver initialized");

            Parsers = new List <IAbstractSiteParser>()
            {
                //new Auto911Parser("http://911auto.com.ua/search/", Driver, Logger),
                //new AutoKlad("SiteParser/IE Driver/", Logger)
            };
            Logger.Log("Site parsers initialized");

            Store = DataStoreFactory.CreateDataStore(config, Logger);
            Logger.Log("DataStore of type " + Store.GetType() + "Initialized");
        }
Beispiel #12
0
 public IDataStore <T> Of <T>()
 {
     return(DataStoreFactory.CreateDataStore <T>());
 }