public void TestPublishWithDelay() { MockJobInc.Publish(true, TimeSpan.FromSeconds(2)); MockJobInc.Publish(true, TimeSpan.FromSeconds(2)); _timeProvider.CurrentTimeUtc = DateTime.UtcNow; //FireActiveTimers(); StopWorkers(); Assert.AreEqual(0, _counter.Value); StartWorkers(); _timeProvider.AdvanceTime(1000); //FireActiveTimers(); StopWorkers(); Assert.AreEqual(0, _counter.Value); StartWorkers(); _timeProvider.AdvanceTime(1000); //FireActiveTimers(); StopWorkers(); Assert.AreEqual(2, _counter.Value); }
public void TestPublishInc() { MockJobInc.Publish(true); StopWorkers(); Assert.AreEqual(1, _counter.Value); }
public void TestPublishDec() { MockJobInc.Publish(false); StopWorkers(); Assert.AreEqual(-1, _counter.Value); }
public void TestCanceledAsyncJobs() { MockJobInc.Publish(true); MockAsyncJobCanceled.Publish(); StopWorkers(); Assert.AreEqual(1, _counter.Value); Assert.AreEqual(1, _messages.GetCount()); }
public void TestFailedJobs() { MockJobInc.Publish(true); MockJobFailed.Publish(true); StopWorkers(); Assert.AreEqual(1, _counter.Value); Assert.AreEqual(1, _messages.GetCount()); }
public void TestLongRunningImmediateJob() { MockJobInc.Publish(true, 10_000); var totalLongRunning = 0; for (var i = 0; i < _settings.LongRunningWorkersCount; i++) { totalLongRunning += _messages.GetCount(string.Format(_settings.LongRunningQueueNameTemplate, i)); } Assert.AreEqual(1, totalLongRunning); }