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).
Namespace: Sartorius.SAF.QualityTools.Testing
Assembly: Sartorius.SAF.QualityTools.dll
Syntax
public sealed class TestTaskScheduler : TaskScheduler
Constructors
View SourceTestTaskScheduler(bool)
Initializes a new instance of the TestTaskScheduler class.
Declaration
public TestTaskScheduler(bool executeTplTasks)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | 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 |
|---|---|
| int | 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 |
|---|---|
| IEnumerable<Task> | An empty enumerable, as Tasks are never queued, only executed. |
Overrides
View SourceQueueTask(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
View SourceTryExecuteTaskInline(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. |