public void TestExecuteMethodReturnsWhenPluginPathIsMissingInJobDataMap() { // Arrange var pluginRunner = new AssemblyPluginJob(); IJobDetail jobDetail = new JobDetailImpl("jobsettings", typeof(IJob)); _mockJobExecutionContext.SetupGet(p => p.JobDetail).Returns(jobDetail); // Act / Assert Assert.Throws<JobExecutionException>(() => pluginRunner.Execute(_mockJobExecutionContext.Object)); }
public void TestJobFailsWhenPluginThrowsErrorDuringExecution() { // Arrange var pluginRunner = new AssemblyPluginJob(); string currentDirectory = Directory.GetCurrentDirectory(); IJobDetail jobDetail = new JobDetailImpl("jobsettings", typeof(IJob)); jobDetail.JobDataMap.Add("pluginPath", Path.Combine(currentDirectory, @"Resourses\R.Scheduler.FakeJobPluginWithError.dll")); _mockJobExecutionContext.SetupGet(p => p.JobDetail).Returns(jobDetail); // Act / Assert Assert.Throws<JobExecutionException>(() => pluginRunner.Execute(_mockJobExecutionContext.Object)); }
public void TestExecuteMethodLoadsPluginFromPathAndExecutesIt() { // Arrange var pluginRunner = new AssemblyPluginJob(); string currentDirectory = Directory.GetCurrentDirectory(); IJobDetail jobDetail = new JobDetailImpl("jobsettings", typeof(IJob)); jobDetail.JobDataMap.Add("pluginPath", Path.Combine(currentDirectory, @"Resourses\R.Scheduler.FakeJobPlugin.dll")); _mockJobExecutionContext.SetupGet(p => p.JobDetail).Returns(jobDetail); // Act pluginRunner.Execute(_mockJobExecutionContext.Object); // Assert Assert.True(File.Exists("FakeJobPlugin.txt")); }