mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-30 19:40:05 -07:00
swap out the scheduler #2750
This commit is contained in:
parent
52d9a7a586
commit
c3c0228b45
14 changed files with 117 additions and 87 deletions
36
src/Ombi.Schedule.Tests/OmbiQuartzTests.cs
Normal file
36
src/Ombi.Schedule.Tests/OmbiQuartzTests.cs
Normal file
|
@ -0,0 +1,36 @@
|
|||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Quartz;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ombi.Schedule.Tests
|
||||
{
|
||||
[TestFixture]
|
||||
public class OmbiQuartzTests
|
||||
{
|
||||
|
||||
[Test]
|
||||
[Ignore("Cannot get this to work")]
|
||||
public async Task Test()
|
||||
{
|
||||
var scheduleMock = new Mock<IScheduler>();
|
||||
scheduleMock.Setup(x => x.TriggerJob(It.IsAny<JobKey>(),
|
||||
It.IsAny<CancellationToken>()));
|
||||
var sut = new QuartzMock(scheduleMock);
|
||||
|
||||
await QuartzMock.TriggerJob("ABC");
|
||||
|
||||
scheduleMock.Verify(x => x.TriggerJob(It.Is<JobKey>(j => j.Name == "ABC"),
|
||||
default(CancellationToken)), Times.Once);
|
||||
}
|
||||
}
|
||||
public class QuartzMock : OmbiQuartz
|
||||
{
|
||||
public QuartzMock(Mock<IScheduler> mock)
|
||||
{
|
||||
_instance = this;
|
||||
_scheduler = mock.Object;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue