Пример #1
0
        public void Can_CountTask()
        {
            var countTasks = new List <Task <int> >();

            foreach (var section in Sections)
            {
                var query = NorthwindAdoRepository.QueryProvider.GetQuery(section, QueryKey);
                Assert.IsNotEmpty(query);

                var task = NorthwindAdoRepository.CountAsync(query);
                countTasks.Add(task);
            }

            Task.WaitAll(countTasks.ToArray());
            countTasks.All(t => t.IsCompleted).Should().Be.True();

            foreach (var task in countTasks)
            {
                Assert.Greater(task.Result, 0);

                if (IsDebugEnabled)
                {
                    log.Debug("Count = " + task.Result);
                }
            }
        }