public void Removed() { List <AlmaResult> results = quotes.GetAlma(10, 0.85, 6) .RemoveWarmupPeriods() .ToList(); // assertions Assert.AreEqual(502 - 9, results.Count); AlmaResult last = results.LastOrDefault(); Assert.AreEqual(242.1871m, Math.Round((decimal)last.Alma, 4)); }
public void GetAlma() { int lookbackPeriod = 10; double offset = 0.85; double sigma = 6; List <AlmaResult> results = Indicator.GetAlma(history, lookbackPeriod, offset, sigma) .ToList(); // assertions // proper quantities // should always be the same number of results as there is history Assert.AreEqual(502, results.Count); Assert.AreEqual(493, results.Where(x => x.Alma != null).Count()); // sample values AlmaResult r1 = results[501]; Assert.AreEqual(242.1871m, Math.Round((decimal)r1.Alma, 4)); AlmaResult r2 = results[249]; Assert.AreEqual(257.5787m, Math.Round((decimal)r2.Alma, 4)); AlmaResult r3 = results[149]; Assert.AreEqual(235.8609m, Math.Round((decimal)r3.Alma, 4)); AlmaResult r4 = results[24]; Assert.AreEqual(216.0619m, Math.Round((decimal)r4.Alma, 4)); AlmaResult r5 = results[9]; Assert.AreEqual(214.1839m, Math.Round((decimal)r5.Alma, 4)); AlmaResult r6 = results[8]; Assert.AreEqual(null, r6.Alma); }