예제 #1
0
        public void Add_WhenTwoValueAddedWithTheSameValue_LastEmaValueIsTheSameAsOriginalValue()
        {
            var target = new Ema(10);
            target.Add(10m);
            target.Add(10m);

            target.Values.LastOrDefault().ShouldBeEquivalentTo(10m);
        }
예제 #2
0
        public void Add_WhenTwoValueAddedWithDifferentValue_LastEmaValueIsTheAverage()
        {
            var target = new Ema(10);
            target.Add(0m);
            target.Add(10m);

            target.Values.LastOrDefault().Should().BeApproximately((180m) / 99m, 0.000000001m);
            target.Values.FirstOrDefault().ShouldBeEquivalentTo(0);
        }