public void AverageInt64()
        {
            var data = new DataProducer <long>();
            IFuture <double> result = data.Average();

            data.ProduceAndEnd(1, 2, 3, 4, 5);
            Assert.AreEqual(3M, result.Value);
        }
        public void AverageNullableInt64Projection()
        {
            var data = new DataProducer <long?>();
            IFuture <double?> result = data.Average(x => - 2 * x);

            data.ProduceAndEnd(1, 2, null, 3, 4, null, 5);
            Assert.AreEqual(-6M, result.Value);
        }
        public void AverageNullDoubleProjection() // tests "the rest"
        {
            IDataProducer <string> prod       = new DataProducer <string>();
            Func <string, double>  projection = null;
            IFuture <double>       sum;

            Assert.Throws <ArgumentNullException>(() => sum = prod.Average(projection));
        }
        public void AverageNullNullableInt64Projection()
        {
            IDataProducer <string> prod       = new DataProducer <string>();
            Func <string, long?>   projection = null;
            IFuture <double?>      sum;

            Assert.Throws <ArgumentNullException>(() => sum = prod.Average(projection));
        }
        public void AverageComplex()
        {
            var data = new DataProducer <Complex>();
            IFuture <Complex> result = data.Average();

            data.Produce(new Complex(1, 3));
            data.Produce(new Complex(3, 1));
            data.End();
            Assert.AreEqual(new Complex(2, 2), result.Value);
        }
 public void AverageNullDoubleProjection() // tests "the rest"
 {
     IDataProducer <string> prod       = new DataProducer <string>();
     Func <string, double>  projection = null;
     IFuture <double>       sum        = prod.Average(projection);
 }
 public void AverageNullNullableInt64Projection()
 {
     IDataProducer <string> prod       = new DataProducer <string>();
     Func <string, long?>   projection = null;
     IFuture <double?>      sum        = prod.Average(projection);
 }
 public void AverageNullInt32Projection()
 {
     IDataProducer <string> prod       = new DataProducer <string>();
     Func <string, int>     projection = null;
     IFuture <double>       sum        = prod.Average(projection);
 }