public void CleanBasicDataTest() { // compose basic data List <BasicData> o = Cleaners.ConvertHistoryToBasic(history, "O"); List <BasicData> h = Cleaners.ConvertHistoryToBasic(history, "H"); List <BasicData> l = Cleaners.ConvertHistoryToBasic(history, "L"); List <BasicData> c = Cleaners.ConvertHistoryToBasic(history, "C"); List <BasicData> v = Cleaners.ConvertHistoryToBasic(history, "V"); // assertions // should always be the same number of results as there is history Assert.AreEqual(502, c.Count); // samples BasicData ro = o[501]; BasicData rh = h[501]; BasicData rl = l[501]; BasicData rc = c[501]; BasicData rv = v[501]; // proper last date DateTime lastDate = DateTime.ParseExact("12/31/2018", "MM/dd/yyyy", englishCulture); Assert.AreEqual(lastDate, rc.Date); // last values should be correct Assert.AreEqual(244.92m, ro.Value); Assert.AreEqual(245.54m, rh.Value); Assert.AreEqual(242.87m, rl.Value); Assert.AreEqual(245.28m, rc.Value); Assert.AreEqual(147031456, rv.Value); }
public void CleanBasicDataTest() { // compose basic data IEnumerable <BasicData> o = Cleaners.ConvertHistoryToBasic(history, "O"); IEnumerable <BasicData> h = Cleaners.ConvertHistoryToBasic(history, "H"); IEnumerable <BasicData> l = Cleaners.ConvertHistoryToBasic(history, "L"); IEnumerable <BasicData> c = Cleaners.ConvertHistoryToBasic(history, "C"); IEnumerable <BasicData> v = Cleaners.ConvertHistoryToBasic(history, "V"); // remove index foreach (BasicData x in c) { x.Index = null; } // re-clean index c = Cleaners.PrepareBasicData(c); // assertions // should always be the same number of results as there is history Assert.AreEqual(502, c.Count()); // should always have index Assert.IsFalse(c.Where(x => x.Index == null || x.Index <= 0).Any()); // samples BasicData ro = o.Where(x => x.Index == 502).FirstOrDefault(); BasicData rh = h.Where(x => x.Index == 502).FirstOrDefault(); BasicData rl = l.Where(x => x.Index == 502).FirstOrDefault(); BasicData rv = v.Where(x => x.Index == 502).FirstOrDefault(); // use close as special case to evaluate index BasicData rc = c .Where(x => x.Date == DateTime.ParseExact("12/31/2018", "MM/dd/yyyy", cultureProvider)) .FirstOrDefault(); // last index should be 502 Assert.AreEqual(502, rc.Index); // last values should be correct Assert.AreEqual(244.92m, ro.Value); Assert.AreEqual(245.54m, rh.Value); Assert.AreEqual(242.87m, rl.Value); Assert.AreEqual(245.28m, rc.Value); Assert.AreEqual(147031456, rv.Value); }
public void CleanBasicDataBadParamTest() { // compose basic data Cleaners.ConvertHistoryToBasic(history, "E"); }
public object ConvertToBasicData() { return(Cleaners.ConvertHistoryToBasic(h)); }
public void NoBasicData() { List <Quote> h = new List <Quote>(); Cleaners.ConvertHistoryToBasic(h); }