예제 #1
0
        public void HandleFileMove()
        {
            tempFile = TempFileUtil.GetTempFilePath("FileChangedWatcherTest", "foo.xml");
            using (FileChangedWatcher watcher = new FileChangedWatcher(tempFile))
            {
                watcher.OnFileChanged += new FileSystemEventHandler(FileChanged);

                string file = TempFileUtil.CreateTempXmlFile("FileChangedWatcherTest", "bar.xml", "<adam><sandler /></adam>");
                new FileInfo(file).MoveTo(tempFile);

                Assert.IsTrue(monitor.WaitOne(5000, false));
                monitor.Reset();
                Assert.AreEqual(1, filechangedCount);
            }
        }