Exemplo n.º 1
0
        public void TestKLineDataIndex_DoIndex_Normal()
        {
            KLineData  data_ = ResourceLoader.GetKLineData_1Min();
            IKLineData data  = data_.GetRange(0, 449);

            MockDataProvider provider = new MockDataProvider();

            provider.DataPathDir = "testindex";
            String targetPath = provider.GetDataPath() + "\\testindex.kline";

            KLineDataStore store = new KLineDataStore(targetPath);

            store.Save(data);

            KLineDataIndexer indexer = new KLineDataIndexer(targetPath);

            indexer.DoIndex();

            KLineDataIndexResult result = indexer.GetIndexResult();

            Assert.AreEqual(2, result.DateList.Count);
            Assert.AreEqual(20131202, result.DateList[0]);
            Assert.AreEqual(20131203, result.DateList[1]);

            data = data_.GetRange(450, data_.Length - 1);
            store.Append(data);
            indexer.DoIndex();
            result = indexer.GetIndexResult();
            Assert.AreEqual(10, result.DateList.Count);

            Directory.Delete(provider.GetDataPath(), true);
        }