예제 #1
0
    public void Standard()
    {
        List <UltimateResult> results = quotes.GetUltimate(7, 14, 28)
                                        .ToList();

        // assertions

        // proper quantities
        // should always be the same number of results as there is quotes
        Assert.AreEqual(502, results.Count);
        Assert.AreEqual(474, results.Where(x => x.Ultimate != null).Count());

        // sample values
        UltimateResult r1 = results[74];

        Assert.AreEqual(51.7770m, Math.Round((decimal)r1.Ultimate, 4));

        UltimateResult r2 = results[249];

        Assert.AreEqual(45.3121m, Math.Round((decimal)r2.Ultimate, 4));

        UltimateResult r3 = results[501];

        Assert.AreEqual(49.5257m, Math.Round((decimal)r3.Ultimate, 4));
    }
예제 #2
0
    public void Removed()
    {
        List <UltimateResult> results = quotes.GetUltimate(7, 14, 28)
                                        .RemoveWarmupPeriods()
                                        .ToList();

        // assertions
        Assert.AreEqual(502 - 28, results.Count);

        UltimateResult last = results.LastOrDefault();

        Assert.AreEqual(49.5257m, Math.Round((decimal)last.Ultimate, 4));
    }
예제 #3
0
        public void GetUltimateTest()
        {
            IEnumerable <UltimateResult> results = Indicator.GetUltimate(history, 7, 14, 28);

            // assertions

            // proper quantities
            // should always be the same number of results as there is history
            Assert.AreEqual(502, results.Count());
            Assert.AreEqual(474, results.Where(x => x.Ultimate != null).Count());

            // sample values
            UltimateResult r1 = results.Where(x => x.Index == 502).FirstOrDefault();

            Assert.AreEqual(49.5257m, Math.Round((decimal)r1.Ultimate, 4));

            UltimateResult r2 = results.Where(x => x.Index == 250).FirstOrDefault();

            Assert.AreEqual(45.3121m, Math.Round((decimal)r2.Ultimate, 4));

            UltimateResult r3 = results.Where(x => x.Index == 75).FirstOrDefault();

            Assert.AreEqual(51.7770m, Math.Round((decimal)r3.Ultimate, 4));
        }