public void AddFile() { Mock <IFile> m = new Mock <IFile>(); WatcherCurrentFileList c = new WatcherCurrentFileList(); c.AddFile(new CurrentFileEntry("test1.txt", m.Object)); var l = c.GetList(); Assert.True(l.Count == 1); Assert.True(l.ContainsKey("test1.txt")); }
public void Start(IFileSystemWatcher watcherInterface = null, int updateRatioInMilliseconds = 0) { Stop(); _watcher = new WatcherFileList(_settingsFileWatcher, watcherInterface, updateRatioInMilliseconds); _source = new CancellationTokenSource(); _fileList = new WatcherCurrentFileList(); _channel = Channel.CreateBounded <FileTask>(MaxFileChanges); _channelNewOutput = Channel.CreateBounded <NewOutput>(MaxFileChanges); _current = Task.Run(async() => await this.ReadChannel(_source.Token)); _watcher.Start(HandleFileChanges); }