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
Namespace: Sartorius.SAF.QualityTools.Testing
Assembly: Sartorius.SAF.QualityTools.dll
Syntax
public sealed class TestTaskScheduler : TaskScheduler
Constructors
View SourceTestTaskScheduler(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 |
Properties
View SourceMaximumConcurrencyLevel
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
Methods
View SourceGetScheduledTasks()
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
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
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. |