Skip to content

Instantly share code, notes, and snippets.

@renestein
Last active August 29, 2015 14:01
Show Gist options
  • Save renestein/ef9e8cb3f0664ede4550 to your computer and use it in GitHub Desktop.
Save renestein/ef9e8cb3f0664ede4550 to your computer and use it in GitHub Desktop.
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
public void QueueTask_When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
var dummyTask = new Task(() => {});
Scheduler.Dispose();
Scheduler.QueueTask(dummyTask);
}
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
public void TryExecuteTaskInline_When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
var dummyTask = new Task(() => {});
Scheduler.Dispose();
Scheduler.TryExecuteTaskInline(dummyTask, false);
}
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
public void GetScheduledTasks_When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
Scheduler.Dispose();
Scheduler.GetScheduledTasks();
}
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
public void MaximumConcurrencyLevel_When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
Scheduler.Dispose();
var maximumConcurrencyLevel = Scheduler.MaximumConcurrencyLevel;
}
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
private void SetProxyScheduler__When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
Scheduler.Dispose();
Scheduler.ProxyScheduler = null;
}
[TestMethod]
[ExpectedException(typeof (ObjectDisposedException))]
private void GetProxyScheduler__When_TaskScheduler_Disposed_Then_Throws_ObjectDisposedException()
{
Scheduler.Dispose();
var proxyScheduler = Scheduler.ProxyScheduler;
}
[TestMethod]
public void Dispose_Repeated_Call_Does_Not_Throw()
{
Scheduler.Dispose();
Scheduler.Dispose();
}
[TestMethod]
public void Dispose_Does_Not_Throw()
{
Scheduler.Dispose();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment