Skip to content

Commit

Permalink
tests(TaskScheduler): Change the way the counter works
Browse files Browse the repository at this point in the history
  • Loading branch information
Belphemur committed Oct 5, 2021
1 parent 2aea40a commit 6515952
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Job.Scheduler.Tests/JobSchedulerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public async Task ExecuteInOwnScheduler()
await jobRunner.WaitForJob();
job.HasRun.Should().BeTrue();
jobRunner.Retries.Should().Be(0);
taskScheduler.Count.Should().Be(1);
taskScheduler.Scheduled.Should().Be(1);
job.InitThread.Should().NotBe(job.RunThread);
job.RunThread.Should().Be(taskScheduler.MainThread);
}
Expand Down
4 changes: 2 additions & 2 deletions Job.Scheduler.Tests/Mocks/MockTaskScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MockTaskScheduler : TaskScheduler, IDisposable
private readonly BlockingCollection<Task> _tasksCollection = new();
public Thread MainThread { get; }
private readonly CancellationTokenSource _cts = new();
public int Count { get; private set; }
public int Scheduled { get; private set; }

public MockTaskScheduler()
{
Expand All @@ -31,8 +31,8 @@ private void Execute()
{
foreach (var task in _tasksCollection.GetConsumingEnumerable(_cts.Token))
{
Scheduled++;
TryExecuteTask(task);
Count++;
}
}
catch (OperationCanceledException)
Expand Down

0 comments on commit 6515952

Please sign in to comment.