Esempio n. 1
0
        public void ValidIndex_ShouldReturnAverage()
        {
            var sut    = new MaIndicator(3, c => c.Close);
            var candle = _fixture.Create <Candle>();

            var candles = new List <Candle>
            {
                candle, candle, candle
            };

            var ma = sut.Calculate(candles, 2);

            Assert.Equal(candle.Close, ma);
        }
Esempio n. 2
0
        public void BarCountBiggerThanCandleSize_ShouldReturnZero()
        {
            var sut     = new MaIndicator(3, c => c.Close);
            var candles = new List <Candle>
            {
                _fixture.Create <Candle>(),
                _fixture.Create <Candle>(),
                _fixture.Create <Candle>()
            };

            var ma = sut.Calculate(candles, 1);

            Assert.Equal(0, ma);
        }