コード例 #1
0
 public void Step(ITestPattern testPattern, IWorkerStrategy workerStrategy, CancellationToken cancelToken)
 {
     for (int i = 0; !cancelToken.IsCancellationRequested && i < this.StepIncrease && this.WorkerCount <= this.MaxWorkers; i++)
     {
         workerStrategy.SpawnWorker(testPattern, cancelToken);
     }
 }
コード例 #2
0
 public void Step(ITestPattern testPattern, IWorkerStrategy workerStrategy, CancellationToken cancelToken)
 {
     for (int i = 0; !cancelToken.IsCancellationRequested && i < this.StepIncrease && this.WorkerCount <= this.MaxWorkers; i++)
     {
         workerStrategy.SpawnWorker(testPattern, cancelToken);
     }
 }
コード例 #3
0
        private void RunWorker(ITestPattern pattern, CancellationToken cancelToken)
        {
            while (!cancelToken.IsCancellationRequested)
            {
                UnitTest t = pattern.GetNextTest();

                t.Execute();
            }
        }
コード例 #4
0
        public async Task ExecuteWorkerAsync(ITestPattern pattern, CancellationToken cancelToken)
        {
            while (!cancelToken.IsCancellationRequested)
            {
                UnitTest test = pattern.GetNextTest();

                await this.ExecuteTestAsync(test, cancelToken);
            }
        }
コード例 #5
0
        private void RunWorker(ITestPattern pattern, CancellationToken cancelToken)
        {
            while (!cancelToken.IsCancellationRequested)
            {
                UnitTest t = pattern.GetNextTest();

                t.Execute();
            }
        }
コード例 #6
0
        public async Task ExecuteWorkerAsync(ITestPattern pattern, CancellationToken cancelToken)
        {
            while (!cancelToken.IsCancellationRequested)
            {
                UnitTest test = pattern.GetNextTest();

                await this.ExecuteTestAsync(test, cancelToken);
            }
        }
コード例 #7
0
        public async Task ExecuteAsync(ITestPattern testPattern, IWorkerStrategy workerStrategy, CancellationToken cancelToken)
        {
            while ((!cancelToken.IsCancellationRequested) && (this.WorkerCount < this.MaxWorkers))
            {
                this.Step(testPattern, workerStrategy, cancelToken);

                if ((!cancelToken.IsCancellationRequested) && (this.WorkerCount < this.MaxWorkers))
                {
                    await Task.Delay(this.StepDuration, cancelToken);
                }
            }
        }
コード例 #8
0
        public async Task ExecuteAsync(ITestPattern testPattern, IWorkerStrategy workerStrategy, CancellationToken cancelToken)
        {
            while ((!cancelToken.IsCancellationRequested) && (this.WorkerCount < this.MaxWorkers))
            {
                this.Step(testPattern, workerStrategy, cancelToken);

                if ((!cancelToken.IsCancellationRequested) && (this.WorkerCount < this.MaxWorkers))
                {
                    await Task.Delay(this.StepDuration, cancelToken);
                }
            }
        }
コード例 #9
0
        public void Execute(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
        {
            ManualResetEventSlim cancelSignaled = new ManualResetEventSlim(false);

            using (cancelToken.Register(() => cancelSignaled.Set()))
            {
                for (int i = 0; i < this.WorkerCount; i++)
                {
                    execStrategy.SpawnWorker(testPattern, cancelToken);
                }

                cancelSignaled.Wait();
            }
        }
コード例 #10
0
        public void Execute(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
        {
            ManualResetEventSlim cancelSignaled = new ManualResetEventSlim(false);

            using (cancelToken.Register(() => cancelSignaled.Set()))
            {
                for (int i = 0; i < this.WorkerCount; i++)
                {
                    execStrategy.SpawnWorker(testPattern, cancelToken);
                }

                cancelSignaled.Wait();
            }
        }
コード例 #11
0
        public async Task ExecuteAsync(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
        {
            SemaphoreSlim cancelSignaled = new SemaphoreSlim(0, 1);

            using (cancelToken.Register(() => cancelSignaled.Release()))
            {
                for (int i = 0; i < this.WorkerCount; i++)
                {
                    execStrategy.SpawnWorker(testPattern, cancelToken);
                }

                await cancelSignaled.WaitAsync();
            }
        }
コード例 #12
0
        public async Task ExecuteAsync(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
        {
            SemaphoreSlim cancelSignaled = new SemaphoreSlim(0, 1);

            using (cancelToken.Register(() => cancelSignaled.Release()))
            {
                for (int i = 0; i < this.WorkerCount; i++)
                {
                    execStrategy.SpawnWorker(testPattern, cancelToken);
                }

                await cancelSignaled.WaitAsync();
            }
        }
コード例 #13
0
 public void Execute(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
 {
     this.ExecuteAsync(testPattern, execStrategy, cancelToken).GetAwaiter().GetResult();
 }
コード例 #14
0
        public void SpawnWorker(ITestPattern pattern, CancellationToken cancelToken)
        {
            Task t = new Task(() => RunWorker(pattern, cancelToken), TaskCreationOptions.LongRunning);

            t.Start();
        }
コード例 #15
0
 public void Execute(ITestPattern testPattern, IWorkerStrategy execStrategy, CancellationToken cancelToken)
 {
     this.ExecuteAsync(testPattern, execStrategy, cancelToken).GetAwaiter().GetResult();
 }
コード例 #16
0
        public void SpawnWorker(ITestPattern pattern, CancellationToken cancelToken)
        {
            Task t = new Task(() => RunWorker(pattern, cancelToken), TaskCreationOptions.LongRunning);

            t.Start();
        }
コード例 #17
0
 public void SpawnWorker(ITestPattern pattern, CancellationToken cancelToken)
 {
     Task throwaway = this.ExecuteWorkerAsync(pattern, cancelToken);
 }
コード例 #18
0
 public void SpawnWorker(ITestPattern pattern, CancellationToken cancelToken)
 {
     Task throwaway = this.ExecuteWorkerAsync(pattern, cancelToken);
 }