Skip to content

Commit

Permalink
Add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebakov Dmitriy Sergeevich committed Nov 27, 2021
1 parent c803ba9 commit 3a5f7d4
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Horarium.Test/RunnerJobTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,12 @@ public async Task Start_ExecutionWithDelay_IncreaseInterval()
settings,
new JsonSerializerSettings(),
Mock.Of<IHorariumLogger>(),
<<<<<<< HEAD
Mock.Of<IExecutorJob>(),
Mock.Of<IUncompletedTaskList>());
=======
Mock.Of<IExecutorJob>());
>>>>>>> f47d280 (Add unit tests)

// Act
runnerJobs.Start();
Expand All @@ -176,11 +180,19 @@ public async Task Start_ExecutionWithDelay_IncreaseInterval()
await Task.Delay(interval);
interval += settings.IntervalStartJob.Multiply(settings.JobThrottleSettings.IntervalMultiplier);
await Task.Delay(interval);
<<<<<<< HEAD

// Assert
jobRepositoryMock.Verify(r => r.GetReadyJob(It.IsAny<string>(), It.IsAny<TimeSpan>()), Times.Exactly(3));
}

=======

// Assert
jobRepositoryMock.Verify(r => r.GetReadyJob(It.IsAny<string>(), It.IsAny<TimeSpan>()), Times.Exactly(3));
}

>>>>>>> f47d280 (Add unit tests)
[Fact]
public async Task Start_ExecutionWithDelay_MaxInterval()
{
Expand All @@ -206,20 +218,29 @@ public async Task Start_ExecutionWithDelay_MaxInterval()
settings,
new JsonSerializerSettings(),
Mock.Of<IHorariumLogger>(),
<<<<<<< HEAD
Mock.Of<IExecutorJob>(),
Mock.Of<IUncompletedTaskList>());
=======
Mock.Of<IExecutorJob>());
>>>>>>> f47d280 (Add unit tests)

// Act
runnerJobs.Start();
await Task.Delay(settings.IntervalStartJob - TimeSpan.FromMilliseconds(500));
jobRepositoryMock.Invocations.Clear();

await Task.Delay(TimeSpan.FromSeconds(5));
<<<<<<< HEAD

=======

>>>>>>> f47d280 (Add unit tests)
// Assert
jobRepositoryMock.Verify(r => r.GetReadyJob(It.IsAny<string>(), It.IsAny<TimeSpan>()), Times.Exactly(5));
}

<<<<<<< HEAD
[Fact]
public async Task Start_NextJobStarted_AddsJobTaskToUncompletedTasks()
{
Expand Down Expand Up @@ -284,5 +305,7 @@ public async Task StopAsync_AwaitsWhenAllCompleted()
// Assert
uncompletedTaskList.Verify(x => x.WhenAllCompleted(cancellationToken), Times.Once);
}
=======
>>>>>>> f47d280 (Add unit tests)
}
}

0 comments on commit 3a5f7d4

Please sign in to comment.