private void ExecuteJob <TCriteria>(IParameterisedJob <TCriteria> job, TCriteria criteria) { try { var jobStatus = job.Run(criteria); ShowProgressBarStatus(jobStatus); if (jobStatus == JobStatus.Failed) { MessageBox.Show(ToolUI.MsgJobFailed); } if (jobStatus == JobStatus.SuccessWithWarnings) { MessageBox.Show(ToolUI.MsgJobWasCompletedWithSomeWarnings); } } catch (DependentJobWasNotRunException) { ShowProgressBarStatus(JobStatus.Failed); MessageBox.Show(ToolUI.MsgEmployeeAndPayRuleJobsWereNotRun); } catch (FileNotAccessibleException ex) { ShowProgressBarStatus(JobStatus.Failed); MessageBox.Show(string.Format(ToolUI.MsgFileIsNotAccessible, ex.FileName)); } catch (SourceFileWasNotFoundException ex) { ShowProgressBarStatus(JobStatus.Failed); MessageBox.Show(string.Format(ToolUI.SourceFileIsNotFoundAt, ex.FileName), ToolUI.ApplicationName, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void JobFailsIfPersonNumbersAreNull() { var criteria = new PunchRoundTestCriteria() { StartDate = new DateTime(2017, 4, 10) }; CommandExecutor.Setup(w => w.Execute <WtkProfileExtractOutputData, List <WtkProfile> >(It.IsAny <WtkProfileExtractOutputData>())).Returns(new List <WtkProfile>()); var jobStatus = Job.Run(criteria); Assert.AreEqual(JobStatus.SuccessWithWarnings, jobStatus); }