SetDefaultScheduler() public static method

Uses reflection to set the default scheduler to use for any newly started task.
public static SetDefaultScheduler ( TaskScheduler taskScheduler ) : void
taskScheduler System.Threading.Tasks.TaskScheduler The to use by default.
return void
Example #1
0
        /// <summary>
        /// Replaces the <see cref="ContextSpecificationBase.PreTestFixtureSetUp"/> method to set the <see cref="TplTestPlatformHelper.TestTaskScheduler"/> as the default scheduler.
        /// </summary>
        /// <param name="contextSpecification">
        /// The target context specification instance.
        /// </param>
        private void SetupTestTaskScheduler(IContextSpecification contextSpecification)
        {
            var testTaskScheduler = new TplTestPlatformHelper.TestTaskScheduler(this.ExecuteTplTasks);

            TplTestPlatformHelper.SetDefaultScheduler(testTaskScheduler);
        }
        protected virtual void PreTestFixtureSetUp()
        {
            this.ThrownException = null;

            TplTestPlatformHelper.SetDefaultScheduler(new TplTestPlatformHelper.InvalidTaskScheduler());
        }