public void ShouldLogToDebugIfProcessingIsDelayedBecauseOfMissingDeletedEvent() { var dir = new System.IO.FileInfo(GetType().Assembly.Location).Directory.FullName; var fileName = Guid.NewGuid().ToString(); MockLog log; using (SafeEventFileSystemWatcher tested = new SafeEventFileSystemWatcher(new Mock <IFileSystemWatcher>().Object)) { log = new MockLog(tested); tested.QueueEvent(this, new FileSystemEventArgs(WatcherChangeTypes.Created, dir, fileName)); Thread.Sleep(250); } Assert.IsTrue(log.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains("does not exists, awaiting Deleted event") && x.Message.Contains(dir) && x.Message.Contains(fileName))); }
public void ShouldLogQueuedEventsToDebug() { var dir = "somedir"; var file = "somefile"; MockLog log; using (SafeEventFileSystemWatcher tested = new SafeEventFileSystemWatcher(new Mock <IFileSystemWatcher>().Object)) { log = new MockLog(tested); tested.QueueEvent(tested, new FileSystemEventArgs(WatcherChangeTypes.Created, dir, file)); } Assert.IsTrue( log.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains(dir) && x.Message.Contains(file) && x.Message.Contains(WatcherChangeTypes.Created.ToString()))); }
public void ShouldLogToDebugIfProcessingIsDelayedBecauseOfMissingDeletedEvent() { var dir = new System.IO.FileInfo(GetType().Assembly.Location).Directory.FullName; var fileName = Guid.NewGuid().ToString(); MockLog log; using (SafeEventFileSystemWatcher tested = new SafeEventFileSystemWatcher(new Mock<IFileSystemWatcher>().Object)) { log = new MockLog(tested); tested.QueueEvent(this, new FileSystemEventArgs(WatcherChangeTypes.Created, dir, fileName)); Thread.Sleep(250); } Assert.IsTrue(log.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains("does not exists, awaiting Deleted event") && x.Message.Contains(dir) && x.Message.Contains(fileName))); }
public void ShouldLogQueuedEventsToDebug() { var dir = "somedir"; var file = "somefile"; MockLog log; using (SafeEventFileSystemWatcher tested = new SafeEventFileSystemWatcher(new Mock<IFileSystemWatcher>().Object)) { log = new MockLog(tested); tested.QueueEvent(tested, new FileSystemEventArgs(WatcherChangeTypes.Created, dir, file)); } Assert.IsTrue( log.Any(x => x.Level == MockLog.Level.Debug && x.Message.Contains(dir) && x.Message.Contains(file) && x.Message.Contains(WatcherChangeTypes.Created.ToString()))); }