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));
        }
Ejemplo n.º 2
0
        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));
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 5
0
        private void VerifyScheduleStatus(DateTime expectedLast, DateTime expectedNext)
        {
            string   statusFile     = _monitor.GetStatusFileName(_testTimerName);
            string   statusLine     = File.ReadAllText(statusFile);
            JObject  status         = JObject.Parse(statusLine);
            DateTime lastOccurrence = (DateTime)status["Last"];
            DateTime nextOccurrence = (DateTime)status["Next"];

            Assert.Equal(expectedLast, lastOccurrence);
            Assert.Equal(expectedNext, nextOccurrence);
        }