Ejemplo n.º 1
0
        public void Example9()
        {
            var stats = new MovingAverage();

            stats.AddRange(new double[] { -5, -3, -1, 1, 3 });
            Assert.Equal(5, stats.Count);
            Assert.Equal(-1, stats.Average, 15);
        }
Ejemplo n.º 2
0
        public void Example8()
        {
            var stats = new MovingAverage();

            stats.AddRange(new double[] { 51.3, 55.6, 49.9, 52.0 });
            Assert.Equal(4, stats.Count);
            Assert.Equal(52.2, stats.Average, 15);
        }
Ejemplo n.º 3
0
        public void Example7()
        {
            var stats = new MovingAverage();

            stats.AddRange(new double[] { 9, 2, 5, 4, 12, 7, 8, 11, 9, 3, 7, 4, 12, 5, 4, 10, 9, 6, 9, 4 });
            Assert.Equal(20, stats.Count);
            Assert.Equal(7, stats.Average, 15);
        }
Ejemplo n.º 4
0
        public void Example6()
        {
            var stats = new MovingAverage();

            stats.AddRange(new double[] { 2, 4, 4, 4, 5, 5, 7, 9 });
            Assert.Equal(8, stats.Count);
            Assert.Equal(5, stats.Average, 15);
        }
Ejemplo n.º 5
0
        public void Example20()
        {
            var stats = new MovingAverage(3);

            stats.AddRange(new double[] { -1, 0, 1 });
            Assert.Equal(3, stats.Count);
            Assert.Equal(0, stats.Average, 15);
        }
Ejemplo n.º 6
0
 public void NoNullCollection()
 {
     Assert.Throws <ArgumentNullException>(delegate {
         var stats = new MovingAverage(null);
     });
     Assert.Throws <ArgumentNullException>(delegate {
         var stats = new MovingAverage(10, null);
     });
     Assert.Throws <ArgumentNullException>(delegate {
         var stats = new MovingAverage();
         stats.AddRange(null);
     });
 }