Skip to content

Instantly share code, notes, and snippets.

@renestein
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save renestein/864ad719fbd30d38767b to your computer and use it in GitHub Desktop.
Save renestein/864ad719fbd30d38767b to your computer and use it in GitHub Desktop.
public abstract class IAutonomousSchedulerTests : ITaskSchedulerTests
{
private TaskFactory m_testTaskFactory;
protected abstract IProxyScheduler ProxyScheduler
{
get;
}
public TaskFactory TestTaskFactory
{
get
{
return m_testTaskFactory;
}
}
public override void InitializeTest()
{
m_testTaskFactory = new TaskFactory(ProxyScheduler.AsTplScheduler());
base.InitializeTest();
}
....
}
public class IoServiceThreadPoolSchedulerTests : IAutonomousSchedulerTests
{
private ProxyScheduler m_proxyScheduler;
private IoServiceScheduler m_ioService;
private ITaskScheduler m_threadPool;
protected override IProxyScheduler ProxyScheduler
{
get
{
return m_proxyScheduler;
}
}
protected override ITaskScheduler Scheduler
{
get
{
return m_threadPool;
}
}
public override void InitializeTest()
{
m_ioService = new IoServiceScheduler();
m_threadPool = new IoServiceThreadPoolScheduler(m_ioService);
m_proxyScheduler = new ProxyScheduler(m_threadPool);
base.InitializeTest();
}
public override void CleanupTest()
{
m_threadPool.Dispose();
base.CleanupTest();
}
....
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment