public async Task Can_limit_the_activity_execution()
        {
            var concurrentExecution = ActivityExecution.Concurrent(3);

            concurrentExecution.Set(_activityHost);

            for (int i = 0; i < 20; i++)
            {
                await concurrentExecution.ExecuteAsync(NewWorkerTask());
            }

            Assert.That(TestActivity.MaxConcurrentExecution, Is.EqualTo(3));
        }
        public async Task Execute_activity_in_sequence_when_concurrent_limit_is_one()
        {
            var concurrentExecution = ActivityExecution.Concurrent(1);

            concurrentExecution.Set(_activityHost);

            await concurrentExecution.ExecuteAsync(NewWorkerTask());

            await concurrentExecution.ExecuteAsync(NewWorkerTask());

            await concurrentExecution.ExecuteAsync(NewWorkerTask());

            await concurrentExecution.ExecuteAsync(NewWorkerTask());


            Assert.That(TestActivity.MaxConcurrentExecution, Is.EqualTo(1));
        }
 public void Throws_exception_when_limit_is_zero()
 {
     Assert.Throws <ArgumentException>(() => ActivityExecution.Concurrent(0));
 }