public void DerivedIndicatorFind() { IEnumerable <Quote> history = HistoryTestData.Get(); IEnumerable <EmaResult> emaResults = Indicator.GetEma(history, 20); // can use a derive Indicator class using Linq IEnumerable <MyIndicator> myIndicatorResults = emaResults .Where(x => x.Ema != null) .Select(x => new MyIndicator { Id = 12345, Date = x.Date, MyEma = (float)x.Ema, MyProperty = false }); Assert.IsTrue(myIndicatorResults.Any()); // find specific date DateTime findDate = DateTime.ParseExact("2018-12-31", "yyyy-MM-dd", englishCulture); MyIndicator i = myIndicatorResults.Find(findDate); Assert.AreEqual(12345, i.Id); EmaResult r = emaResults.Find(findDate); Assert.AreEqual(249.3519m, Math.Round((decimal)r.Ema, 4)); }
public void DerivedIndicatorClass() { // can use a derive Indicator class MyIndicator myIndicator = new MyIndicator { Date = DateTime.Now, MyEma = 123.456f, MyProperty = false }; Assert.AreEqual(false, myIndicator.MyProperty); }