public void TestAppendIQuoteBasic_FillGap() { _quoteBasic.Add(600, 1, 1, 1, 1, 1); IQuoteBasic qb = new QuoteBasic("symbol1", 10); // 不填充 qb.Add(720, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 10, false); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(720, _quoteBasic.Time[1]); // 填充 _quoteBasic.Clear(); _quoteBasic.Add(600, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 10, true); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(720, _quoteBasic.Time[2]); qb.Add(840, 12, 1, 1, 1, 1); _quoteBasic.Append(qb, 10, true); Assert.AreEqual(840, _quoteBasic.Time[4]); qb.Add(890, 12, 1, 1, 1, 1); _quoteBasic.Append(qb, 10, true); Assert.AreEqual(840, _quoteBasic.Time[4]); qb.Add(910, 12, 1, 1, 1, 1); _quoteBasic.Append(qb, 10, true); Assert.AreEqual(900, _quoteBasic.Time[5]); Assert.AreEqual(910, _quoteBasic.Time[6]); }
public void TestAppendIQuoteBasic() { _quoteBasic.Add(600, 1, 1, 1, 1, 1); // 600 // 非整数倍 IQuoteBasic qb = new QuoteBasic("symbol1", 20); qb.Add(640, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, -1, false, false); // 600 Assert.AreEqual(1, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.LastTime); // 整数倍 qb.Add(660, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, -1, false, false); Assert.AreEqual(2, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); // 为空 qb.Clear(); _quoteBasic.Append(qb, -1, false, false); Assert.AreEqual(2, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]);; // 为null qb = null; _quoteBasic.Append(qb, -1, false, false); Assert.AreEqual(2, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); // 不填补空洞 qb = new QuoteBasic("symbol1", 20); qb.Add(6000, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, -1, false, false); Assert.AreEqual(3, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(6000, _quoteBasic.Time[2]); }
public void TestInsert() { QuoteBasic qb2 = new QuoteBasic("symbol1", 60); _quoteBasic.Insert(qb2); Assert.AreEqual(0, _quoteBasic.Count); qb2.Add(100, 1, 1, 1, 1, 1, false); _quoteBasic.Insert(qb2); Assert.AreEqual(1, _quoteBasic.Count); _quoteBasic.Clear(); qb2.Clear(); _quoteBasic.Add(100, 1, 1, 1, 1, 1, false); _quoteBasic.Add(500, 1, 1, 1, 1, 1, false); qb2.Add(10, 1, 1, 1, 1, 1, false); _quoteBasic.Insert(qb2); Assert.AreEqual(10, _quoteBasic.FirstTime); qb2.Clear(); qb2.Add(600, 1, 1, 1, 1, 1, false); _quoteBasic.Insert(qb2); Assert.AreEqual(600, _quoteBasic.LastTime); }
public void TestAppendIQuoteBasic_SubInterval() { _quoteBasic.Add(600, 1, 1, 1, 1, 1); // 600 IQuoteBasic qb = new QuoteBasic("symbol1", 20); qb.Add(620, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 620 Assert.AreEqual(2, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(620, _quoteBasic.Time[1]); qb.Clear(); qb.Add(640, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 640 Assert.AreEqual(2, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(640, _quoteBasic.Time[1]); qb.Add(680, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 660, 680 Assert.AreEqual(3, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(680, _quoteBasic.Time[2]); qb.Add(700, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 660, 700 Assert.AreEqual(3, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(700, _quoteBasic.Time[2]); qb.Add(740, 1, 1, 1, 1, 1); qb.Add(760, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 660, 720, 760 Assert.AreEqual(4, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(720, _quoteBasic.Time[2]); Assert.AreEqual(760, _quoteBasic.Time[3]); qb = new QuoteBasic("symbol1", 1); qb.Add(761, 1, 1, 1, 1, 1); qb.Add(762, 1, 1, 1, 1, 1); qb.Add(763, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 1); // 600, 660, 720, 763 Assert.AreEqual(4, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(720, _quoteBasic.Time[2]); Assert.AreEqual(763, _quoteBasic.Time[3]); qb.Add(780, 1, 1, 1, 1, 1); _quoteBasic.Append(qb, 20); // 600, 660, 720, 780 Assert.AreEqual(4, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.Time[0]); Assert.AreEqual(660, _quoteBasic.Time[1]); Assert.AreEqual(720, _quoteBasic.Time[2]); Assert.AreEqual(780, _quoteBasic.Time[3]); }
public void TestAdd() { _quoteBasic.Add(600, 1, 1, 1, 1, 1); Assert.AreEqual(1, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.LastTime); // 小于lastTime时 _quoteBasic.Add(10, 1, 1, 1, 1, 1); Assert.AreEqual(1, _quoteBasic.Count); Assert.AreEqual(600, _quoteBasic.LastTime); }