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 Tasks were queued using QueueTask(Task).

Inheritance
object
TaskScheduler
TestTaskScheduler
TaskScheduler.FromCurrentSynchronizationContext()
TaskScheduler.Current
TaskScheduler.Default
TaskScheduler.Id
TaskScheduler.UnobservedTaskException
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Sartorius.SAF.QualityTools.Testing
Assembly: Sartorius.SAF.QualityTools.dll
Syntax
public sealed class TestTaskScheduler : TaskScheduler

Constructors

View Source

TestTaskScheduler(bool)

Initializes a new instance of the TestTaskScheduler class.

Declaration
public TestTaskScheduler(bool executeTplTasks)
Parameters
Type Name Description
bool 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
int

Always 1, in order to prevent concurrency.

Overrides
TaskScheduler.MaximumConcurrencyLevel

Methods

View Source

GetScheduledTasks()

Gets the Tasks currently scheduled to this scheduler.

Declaration
protected override IEnumerable<Task> GetScheduledTasks()
Returns
Type Description
IEnumerable<Task>

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

Overrides
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
Task task

The task to be executed.

Overrides
TaskScheduler.QueueTask(Task)
View Source

TryExecuteTaskInline(Task, bool)

Runs the provided Task synchronously on the current thread.

Declaration
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
Parameters
Type Name Description
Task task

The task to be executed.

bool taskWasPreviouslyQueued

Whether the Task was previously queued to the scheduler.

Returns
Type Description
bool

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

Overrides
TaskScheduler.TryExecuteTaskInline(Task, bool)

Extension Methods

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