public async Task EnumerableAsyncTests()
        {
            var rand  = new Random();
            var items = EnumerableAsyncTest.YieldAsync(
                async(yield) =>
            {
                var tasks = new List <Task>();
                for (int i = 0; i < 100; i++)
                {
                    await Task.Run(() => Thread.Sleep(rand.Next() % 20));
                    var yieldTask = yield(i, "foo", new List <int>());
                    // tasks.Add(yieldTask);
                    await yieldTask;
                }

                //tasks.Add(yield(110, "bar", new List<int>()));
                //tasks.Add(yield(111, "food", new List<int>()));
                //tasks.Add(yield(112, "barf", new List<int>()));

                await yield(110, "bar", new List <int>());
                await yield(111, "food", new List <int>());
                await yield(112, "barf", new List <int>());

                await Task.WhenAll(tasks.ToArray());
            });
            int count = 0;
            await items.ForAllAsync(
                async (a, b, c) =>
            {
                await Task.Run(() => Thread.Sleep(rand.Next() % 20));
                count++;
            });

            Assert.AreEqual(103, count);
        }
        public async Task IterateAsyncTests()
        {
            var items = EnumerableAsyncTest.YieldAsync(
                async(yield) =>
            {
                Thread.Sleep(1000);
                var tasks = new List <Task>();
                for (int i = 0; i < 100; i++)
                {
                    var yieldTask = yield(i, "foo", new List <int>());
                    await yieldTask;
                }
            });
            var results = items.ToEnumerableX(
                (a, b, c) =>
            {
                Thread.Sleep(20);
                return(a);
            });

            Assert.AreEqual(100, results.Count());
        }