MainThreadWorkItemDispatcher
MainThreadWorkItemDispatcher handles execution of WorkItems by
directly executing them on the main thread. This is different
from the SimpleWorkItemDispatcher where the work item is dispatched
onto its own thread.
using System;
namespace NUnit.Framework.Internal.Execution
{
public class MainThreadWorkItemDispatcher : IWorkItemDispatcher
{
public int LevelOfParallelism => 0;
public void Start(WorkItem topLevelWorkItem)
{
Dispatch(topLevelWorkItem);
}
public void Dispatch(WorkItem work)
{
work?.Execute();
}
public void CancelRun(bool force)
{
throw new NotSupportedException();
}
}
}