Exemplo n.º 1
0
        public void EventHooks()
        {
            var           producer = new DataProducer <int>();
            var           grp      = new ProducerGrouping <int, int>(5, producer);
            Action <int>  act      = x => { };
            Action        end      = () => { };
            IFuture <int> sum      = grp.Sum();

            grp.DataProduced += act;
            grp.EndOfData    += end;
            producer.ProduceAndEnd(1, 2, 3);
            grp.DataProduced -= act;
            grp.EndOfData    -= end;
            Assert.AreEqual(6, sum.Value);
        }
Exemplo n.º 2
0
        public void EventHooks()
        {
            var producer = new DataProducer<int>();
            var grp = new ProducerGrouping<int, int>(5, producer);
            Action<int> act = x => { };
            Action end = () => { };
            IFuture<int> sum = grp.Sum();
            grp.DataProduced += act;
            grp.EndOfData += end;
            producer.ProduceAndEnd(1, 2, 3);
            grp.DataProduced -= act;
            grp.EndOfData -= end;
            Assert.AreEqual(6, sum.Value);

        }