Show / Hide Table of Contents

Class TestTaskScheduler

Provides a task scheduler that runs tasks only on the current thread, and records the order in which System.Threading.Tasks.Tasks were queued using QueueTask(Task).

Inheritance
System.Object
System.Threading.Tasks.TaskScheduler
TestTaskScheduler
System.Threading.Tasks.TaskScheduler.FromCurrentSynchronizationContext()
System.Threading.Tasks.TaskScheduler.TryDequeue(System.Threading.Tasks.Task)
System.Threading.Tasks.TaskScheduler.TryExecuteTask(System.Threading.Tasks.Task)
System.Threading.Tasks.TaskScheduler.Current
System.Threading.Tasks.TaskScheduler.Default
System.Threading.Tasks.TaskScheduler.Id
System.Threading.Tasks.TaskScheduler.UnobservedTaskException
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.QualityTools.Testing
Assembly: Sartorius.SAF.QualityTools.dll
Syntax
public sealed class TestTaskScheduler : TaskScheduler

Constructors

View Source

TestTaskScheduler(Boolean)

Initializes a new instance of the TestTaskScheduler class.

Declaration
public TestTaskScheduler(bool executeTplTasks)
Parameters
Type Name Description
System.Boolean executeTplTasks

Setting this field to false will prevent any queued task from starting.

Properties

View Source

MaximumConcurrencyLevel

Gets the maximum degree of parallelism for this scheduler.

Declaration
public override int MaximumConcurrencyLevel { get; }
Property Value
Type Description
System.Int32

Always 1, in order to prevent concurrency.

Overrides
System.Threading.Tasks.TaskScheduler.MaximumConcurrencyLevel

Methods

View Source

GetScheduledTasks()

Gets the Tasks currently scheduled to this scheduler.

Declaration
protected override IEnumerable<Task> GetScheduledTasks()
Returns
Type Description
System.Collections.Generic.IEnumerable<System.Threading.Tasks.Task>

An empty enumerable, as Tasks are never queued, only executed.

Overrides
System.Threading.Tasks.TaskScheduler.GetScheduledTasks()
View Source

QueueTask(Task)

Runs the provided Task synchronously on the current thread.

Declaration
protected override void QueueTask(Task task)
Parameters
Type Name Description
System.Threading.Tasks.Task task

The task to be executed.

Overrides
System.Threading.Tasks.TaskScheduler.QueueTask(System.Threading.Tasks.Task)
View Source

TryExecuteTaskInline(Task, Boolean)

Runs the provided Task synchronously on the current thread.

Declaration
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
Parameters
Type Name Description
System.Threading.Tasks.Task task

The task to be executed.

System.Boolean taskWasPreviouslyQueued

Whether the Task was previously queued to the scheduler.

Returns
Type Description
System.Boolean

True if the Task was successfully executed; otherwise, false.

Overrides
System.Threading.Tasks.TaskScheduler.TryExecuteTaskInline(System.Threading.Tasks.Task, System.Boolean)

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX