public FileSystemScheduleMonitorTests() { _monitor = new FileSystemScheduleMonitor(); _testTimerName = "Program.TestJob"; _statusFile = _monitor.GetStatusFileName(_testTimerName); _statusRoot = Path.Combine(Path.GetTempPath(), @"webjobs\timers"); Directory.CreateDirectory(_statusRoot); CleanStatusFiles(); }
public FileSystemScheduleMonitorTests() { _monitor = new FileSystemScheduleMonitor(); _testTimerName = "Program.TestJob"; _statusFile = _monitor.GetStatusFileName(_testTimerName); _statusRoot = Path.Combine(Path.GetTempPath(), @"webjobssdk\timers"); Directory.CreateDirectory(_statusRoot); CleanStatusFiles(); }
public void StatusFilePath_ThrowsWhenPathDoesNotExist() { string invalidPath = @"c:\temp\webjobssdktests\doesnotexist"; Assert.False(Directory.Exists(invalidPath)); FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); ArgumentException expectedException = Assert.Throws<ArgumentException>(() => localMonitor.StatusFilePath = invalidPath); Assert.Equal("value", expectedException.ParamName); Assert.Equal("The specified path does not exist.\r\nParameter name: value", expectedException.Message); }
public void StatusFilePath_ThrowsWhenPathDoesNotExist() { string invalidPath = @"c:\temp\webjobstests\doesnotexist"; Assert.False(Directory.Exists(invalidPath)); FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); ArgumentException expectedException = Assert.Throws <ArgumentException>(() => localMonitor.StatusFilePath = invalidPath); Assert.Equal("value", expectedException.ParamName); Assert.Equal("The specified path does not exist.\r\nParameter name: value", expectedException.Message); }
public void StatusFilePath_OverridesDefaultWhenSet() { FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); string expectedPath = Path.Combine(Path.GetTempPath(), @"webjobssdk\timers"); Assert.Equal(expectedPath, localMonitor.StatusFilePath); string statusFileName = localMonitor.GetStatusFileName(_testTimerName); Assert.Equal(expectedPath, Path.GetDirectoryName(statusFileName)); expectedPath = Path.Combine(Path.GetTempPath(), @"webjobssdktests\anotherstatuspath"); Directory.CreateDirectory(expectedPath); localMonitor.StatusFilePath = expectedPath; Assert.Equal(expectedPath, localMonitor.StatusFilePath); statusFileName = localMonitor.GetStatusFileName(_testTimerName); Assert.Equal(expectedPath, Path.GetDirectoryName(statusFileName)); }
public void StatusFilePath_OverridesDefaultWhenSet() { FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); string expectedPath = Path.Combine(Path.GetTempPath(), @"webjobs\timers"); Assert.Equal(expectedPath, localMonitor.StatusFilePath); string statusFileName = localMonitor.GetStatusFileName(_testTimerName); Assert.Equal(expectedPath, Path.GetDirectoryName(statusFileName)); expectedPath = Path.Combine(Path.GetTempPath(), @"webjobstests\anotherstatuspath"); Directory.CreateDirectory(expectedPath); localMonitor.StatusFilePath = expectedPath; Assert.Equal(expectedPath, localMonitor.StatusFilePath); statusFileName = localMonitor.GetStatusFileName(_testTimerName); Assert.Equal(expectedPath, Path.GetDirectoryName(statusFileName)); }
public void Constructor_Defaults() { Environment.SetEnvironmentVariable("HOME", null); // when HOME is not defined, default to local temp directory FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); string expectedPath = Path.Combine(Path.GetTempPath(), @"webjobssdk\timers"); Assert.Equal(expectedPath, localMonitor.StatusFilePath); Environment.SetEnvironmentVariable("HOME", @"C:\home"); string currentDirectory = @"D:\local\Temp\jobs\continuous\Test\mlxx1xht.zmv"; // example from actual Azure WebJob string jobDirectory = @"C:\home\data\jobs\continuous\Test"; Directory.CreateDirectory(jobDirectory); localMonitor = new FileSystemScheduleMonitor(currentDirectory); Assert.Equal(@"C:\home\data\jobs\continuous\Test", localMonitor.StatusFilePath); Directory.Delete(jobDirectory); Environment.SetEnvironmentVariable("HOME", null); }
public void Constructor_Defaults() { Environment.SetEnvironmentVariable("HOME", null); // when HOME is not defined, default to local temp directory FileSystemScheduleMonitor localMonitor = new FileSystemScheduleMonitor(); string expectedPath = Path.Combine(Path.GetTempPath(), @"webjobs\timers"); Assert.Equal(expectedPath, localMonitor.StatusFilePath); Environment.SetEnvironmentVariable("HOME", @"C:\home"); string currentDirectory = @"D:\local\Temp\jobs\continuous\Test\mlxx1xht.zmv"; // example from actual Azure WebJob string jobDirectory = @"C:\home\data\jobs\continuous\Test"; Directory.CreateDirectory(jobDirectory); localMonitor = new FileSystemScheduleMonitor(currentDirectory); Assert.Equal(@"C:\home\data\jobs\continuous\Test", localMonitor.StatusFilePath); Directory.Delete(@"C:\home\", true); Environment.SetEnvironmentVariable("HOME", null); }
/// <summary> /// Constructs a new instance /// </summary> public TimersConfiguration() { ScheduleMonitor = new FileSystemScheduleMonitor(); }