public void Open_Dispose() { Mock <IFileSystemWatcher> watcher = new Mock <IFileSystemWatcher>(); FileDirectoryWatcher w = new FileDirectoryWatcher(_settings, watcher.Object); w.Open(); w.Dispose(); }
public void Second_Open_AfterDispose() { Mock <IFileSystemWatcher> watcher = new Mock <IFileSystemWatcher>(); FileDirectoryWatcher w = new FileDirectoryWatcher(_settings, watcher.Object); w.Open(); w.Dispose(); Assert.Throws <System.NullReferenceException>(() => w.Open()); }
void DiscardOldWatcher() { lock (_syncListAccess) { _throttleCalls?.Dispose(); _watcher?.Dispose(); _watcher = null; _currentList = new List <FileEntry>(); } }