Пример #1
0
        public void SimpleLoad(CancellationToken cancelToken)
        {
            var workerStrategy = new DedicatedThreadWorkerStrategy();

            var readPattern = new StaticLoadPattern() { WorkerCount = 5 };

            Task t = readPattern.ExecuteAsync(new UnitTest(ConcurrentRead), workerStrategy, cancelToken);

            var writePattern = new StaticLoadPattern() { WorkerCount = 1 };

            //add a burst of execution
            Task t1 = writePattern.ExecuteAsync(new UnitTest(ConcurrentWrite), workerStrategy, cancelToken);

            //wait for original workers to complete
            Task.WaitAll(t, t1);
        }
Пример #2
0
        public void SimpleLoad(CancellationToken cancelToken)
        {
            var unitTests = new UnitTest[] { new UnitTest(this.Foo), new UnitTest(this.Bar), new UnitTest(this.Shz), new UnitTest(this.Nit) };

            var testPattern = new RandomTestPattern();

            testPattern.Initialize(0, unitTests);

            var workerStrategy = new DedicatedThreadWorkerStrategy();

            var loadPattern = new StaticLoadPattern() { WorkerCount = 24 };

            Task t = loadPattern.ExecuteAsync(testPattern, workerStrategy, cancelToken);

            Task.Delay(3000).GetAwaiter().GetResult();

            var rootLoadPattern = new StaticLoadPattern() { WorkerCount = 500 };

            //add a burst of execution
            rootLoadPattern.Execute(new UnitTest(Root), workerStrategy, new CancellationTokenSource(10000).Token);

            //wait for original workers to complete
            t.GetAwaiter().GetResult();
        }
Пример #3
0
        public void OnlyReaders(CancellationToken cancelToken)
        {
            var workerStrategy = new DedicatedThreadWorkerStrategy();

            //setup dictionary

            var readPattern = new StaticLoadPattern() { WorkerCount = 5 };

            readPattern.ExecuteAsync(new UnitTest(ConcurrentRead), workerStrategy, cancelToken).Wait();
        }