Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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"));
        }