Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save renestein/9c53056734769181306b to your computer and use it in GitHub Desktop.
Save renestein/9c53056734769181306b to your computer and use it in GitHub Desktop.
[TestMethod]
public void Run_When_More_Tasks_Added_Then_All_Tasks_Are_Executed()
{
bool wasTask1Called = false;
bool wasTask2Called = false;
m_scheduler.Dispatch(() =>
{
wasTask1Called = true;
});
m_scheduler.Dispatch(() =>
{
wasTask2Called = true;
});
m_scheduler.Run();
Assert.IsTrue(wasTask1Called && wasTask2Called);
}
[TestMethod]
public void Run_When_Two_Tasks_Added_Then_Returns_Two()
{
const int NUMBER_OF_SCHEDULED_TASKS = 2;
Enumerable.Range(0, NUMBER_OF_SCHEDULED_TASKS)
.Select(_ => m_scheduler.Dispatch(() =>
{
})).ToArray();
var executedTasksCount = m_scheduler.Run();
Assert.AreEqual(NUMBER_OF_SCHEDULED_TASKS, executedTasksCount);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment