public void RockJobListnerShouldHandleWarningWithSingleAggregateException() { var expectedResultMessage = $"{Guid.NewGuid()} Rock Job Listener Completed With Warnings"; RunJob(GetJobDataMapDictionary(TestResultType.WarningWithSingleAggregateException, expectedResultMessage)); var actualJob = GetAddTestJob(); Assert.That.AreEqual(expectedResultMessage, actualJob.LastStatusMessage); Assert.That.AreEqual("Warning", actualJob.LastStatus); var exceptions = new ExceptionLogService(new RockContext()).Queryable().Where(els => els.Description == expectedResultMessage); Assert.That.IsTrue(exceptions.Count() == 1); }
public void RockJobListnerShouldHandleExceptionCorrectly() { var expectedExceptionMessage = $"{Guid.NewGuid()} Rock Job Listener Exception Message"; RunJob(GetJobDataMapDictionary(TestResultType.Exception, expectedExceptionMessage)); var actualJob = GetAddTestJob(); Assert.That.AreEqual(expectedExceptionMessage, actualJob.LastStatusMessage); Assert.That.AreEqual("Exception", actualJob.LastStatus); var exceptions = new ExceptionLogService(new RockContext()).Queryable().Where(els => els.Description == expectedExceptionMessage); Assert.That.IsTrue(exceptions.Count() == 1); }
public void RockJobListnerShouldHandleMultipleAggregateExceptionCorrectly() { var expectedExceptionMessage = $"{Guid.NewGuid()} Rock Job Listener Multiple Aggregate Exception Message"; RunJob(GetJobDataMapDictionary(TestResultType.MultipleAggregateException, expectedExceptionMessage)); var actualJob = GetAddTestJob(); Assert.That.AreEqual($"One or more exceptions occurred. First Exception: {expectedExceptionMessage} 1", actualJob.LastStatusMessage); Assert.That.AreEqual("Exception", actualJob.LastStatus); var exceptions = new ExceptionLogService(new RockContext()).Queryable().Where(els => els.Description.Contains(expectedExceptionMessage)); Assert.That.IsTrue(exceptions.Count() > 1); }