Exemplo n.º 1
0
        public async Task ParallelForeachSelectTest()
        {
            var source = Enumerable.Range(0, 10000).Select(x => x.ToString());

            var result = await AsyncParallelForeach.SelectAsync(source, GetAccount, 4);

            var orderedResult = result.OrderBy(acc => acc?.Id).ToArray();

            for (var i = 0; i < orderedResult.Length; i++)
            {
                Assert.That(orderedResult[i]?.Id, Is.EqualTo(i));
            }
        }
Exemplo n.º 2
0
        public void ParallelForeachTestWithoutEntity()
        {
            var source = Enumerable.Range(0, 4000).Select(x => x.ToString());

            Assert.DoesNotThrow(() => AsyncParallelForeach.ForEachAsync(source, Highload, 4));
        }