Ejemplo n.º 1
0
        public void TestSkylineRunnerArgs()
        {
            const string skyFile   = @"C:\Dummy\path\Test_file.sky";
            const string dataFile1 = @"C:\Dummy\path\Test1.raw";

            var mainSettings = MainSettings.GetDefault();

            mainSettings.SkylineFilePath = skyFile;

            var accumulationWindow = AccumulationWindow.Get(DateTime.Now, MainSettings.ACCUM_TIME_WINDOW);

            Assert.AreEqual(accumulationWindow.EndDate.Subtract(accumulationWindow.StartDate).Days + 1,
                            MainSettings.ACCUM_TIME_WINDOW);

            var expected =
                string.Format("--in=\"{0}\" --remove-before={1} --import-file=\"{3}\" --import-on-or-after={2} --save", skyFile,
                              accumulationWindow.StartDate.ToShortDateString(),
                              accumulationWindow.StartDate.ToShortDateString(), dataFile1);

            var importContext = new ImportContext(dataFile1);

            Assert.IsFalse(importContext.ImportExisting);

            var args = mainSettings.SkylineRunnerArgs(importContext);

            Assert.AreEqual(expected, args.Trim());
        }
Ejemplo n.º 2
0
        public void TestSkylineRunnerArgsImportExisting()
        {
            const string skyFile   = @"C:\Dummy\path\Test_file.sky";
            const string dataFile1 = @"C:\Dummy\path\Test1.raw";
            const string dataFile2 = @"C:\Dummy\path\Test2.raw";

            var mainSettings = MainSettings.GetDefault();

            mainSettings.SkylineFilePath = skyFile;

            // Create an import context.
            var importContext = new ImportContext(new List <string>()
            {
                dataFile1, dataFile2
            });

            Assert.IsTrue(importContext.ImportExisting);

            // Arguments for the first file.
            var expected =
                string.Format("--in=\"{0}\" --import-file=\"{1}\" --save", skyFile, dataFile1);

            importContext.GetNextFile();
            var args = mainSettings.SkylineRunnerArgs(importContext);

            Assert.AreEqual(expected, args.Trim());

            // Arguments for the second file
            importContext.GetNextFile();
            Assert.IsTrue(importContext.ImportingLast());
            expected =
                string.Format("--in=\"{0}\" --import-file=\"{1}\" --save", skyFile, dataFile2);

            args = mainSettings.SkylineRunnerArgs(importContext);
            Assert.AreEqual(expected, args.Trim());

            Assert.IsNull(importContext.GetNextFile());
        }
Ejemplo n.º 3
0
        private void TestGetExistingFilesForInstrument(string testDir, string instrument)
        {
            var folderToWatch = CreateDirectory(testDir, instrument);

            // Create a .sky files
            var skyFile = CreateFile(folderToWatch, "test.sky");

            List <string> dataFiles;

            SetupTestFolder(folderToWatch, instrument, out dataFiles);

            var          watcher = new AutoQCFileSystemWatcher(new TestLogger(), new TestConfigRunner());
            AutoQcConfig config  = new AutoQcConfig();

            var mainSettings = MainSettings.GetDefault();

            config.MainSettings = mainSettings;

            Assert.AreEqual(mainSettings.QcFileFilter, FileFilter.GetFileFilter(AllFileFilter.NAME, string.Empty));
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.IncludeSubfolders = false;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.ValidateSettings();

            watcher.Init(config);
            var files = watcher.GetExistingFiles();

            Assert.AreEqual(1, files.Count);
            Assert.AreEqual(dataFiles[0], files[0]);

            mainSettings.IncludeSubfolders = true;
            mainSettings.ValidateSettings();

            watcher.Init(config);
            files = watcher.GetExistingFiles();
            Assert.AreEqual(5, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[1]));
            Assert.IsTrue(files.Contains(dataFiles[2]));
            Assert.IsTrue(files.Contains(dataFiles[3]));
            Assert.IsTrue(files.Contains(dataFiles[4]));

            /* Files:
             * "root_QC_"
             * "QC_one"
             * "one_1_a_QC_"
             * "one_1_b_QC"
             * "two_qc_"
             */
            mainSettings.QcFileFilter = FileFilter.GetFileFilter(ContainsFilter.NAME, "QC");
            watcher.Init(config);
            files = watcher.GetExistingFiles();
            Assert.AreEqual(4, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[1]));
            Assert.IsTrue(files.Contains(dataFiles[2]));
            Assert.IsTrue(files.Contains(dataFiles[3]));

            mainSettings.QcFileFilter = FileFilter.GetFileFilter(StartsWithFilter.NAME, "QC_");
            watcher.Init(config);
            files = watcher.GetExistingFiles();
            Assert.AreEqual(1, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[1]));

            mainSettings.QcFileFilter = FileFilter.GetFileFilter(EndsWithFilter.NAME, "_QC_");
            watcher.Init(config);
            files = watcher.GetExistingFiles();
            Assert.AreEqual(2, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[2]));

            mainSettings.QcFileFilter = FileFilter.GetFileFilter(RegexFilter.NAME, "[ab]_QC");
            watcher.Init(config);
            files = watcher.GetExistingFiles();
            Assert.AreEqual(2, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[2]));
            Assert.IsTrue(files.Contains(dataFiles[3]));
        }
Ejemplo n.º 4
0
        private static void TestGetNewFilesForInstrument(string testDir, string instrument)
        {
            var           logger       = new TestLogger();
            IConfigRunner configRunner = new TestConfigRunner();

            configRunner.ChangeStatus(ConfigRunner.RunnerStatus.Running);


            // folder to watch
            var folderToWatch = CreateDirectory(testDir, instrument);
            // Create a .sky files
            var skyFile = CreateFile(folderToWatch, "test2_a.sky");

            var config = new AutoQcConfig();

            // 1. Look for files in folderToWatchOnly
            var watcher      = new AutoQCFileSystemWatcher(logger, configRunner);
            var mainSettings = MainSettings.GetDefault();

            config.MainSettings = mainSettings;

            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.IncludeSubfolders = false;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.ValidateSettings();

            watcher.Init(config);
            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            // Create new files in the folder
            List <string> dataFiles;

            SetupTestFolder(folderToWatch, instrument, out dataFiles);

            // Only one file should have been added to the queue since we are not monitoring sub-folders
            Assert.AreEqual(1, watcher.GetExistingFiles().Count);
            var    files = new List <string>();
            string f;

            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(1, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsNull(watcher.GetFile()); // Nothing in the queue

            watcher.Stop();

            // 2. Look for files in subfolders
            watcher = new AutoQCFileSystemWatcher(logger, configRunner);
            // folder to watch
            folderToWatch = CreateDirectory(testDir, instrument + "_2");
            // Create a .sky files
            skyFile = CreateFile(folderToWatch, "test2_b.sky");
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.IncludeSubfolders = true; // watch sub-folders
            mainSettings.ValidateSettings();
            watcher.Init(config);

            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            dataFiles.Clear();
            SetupTestFolder(folderToWatch, instrument, out dataFiles); // Create new files in the folder

            files = new List <string>();
            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(5, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[1]));
            Assert.IsTrue(files.Contains(dataFiles[2]));
            Assert.IsTrue(files.Contains(dataFiles[3]));
            Assert.IsTrue(files.Contains(dataFiles[4]));

            watcher.Stop();

            //  3. Look for files in subfolders matching a pattern
            watcher = new AutoQCFileSystemWatcher(logger, configRunner);
            // folder to watch
            folderToWatch = CreateDirectory(testDir, instrument + "_3");
            // Create a .sky files
            skyFile = CreateFile(folderToWatch, "test2_c.sky");
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.IncludeSubfolders = true;                                                  // watch sub-folders
            mainSettings.QcFileFilter      = FileFilter.GetFileFilter(ContainsFilter.NAME, "_QC_"); // file name pattern
            mainSettings.ValidateSettings();
            watcher.Init(config);

            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            dataFiles.Clear();
            SetupTestFolder(folderToWatch, instrument, out dataFiles); // Create new files in the folder

            files = new List <string>();
            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(2, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[2]));

            watcher.Stop();

            // 4. Add new files in directory by first creating a temp file/directory and renaming it.
            // This should trigger a "Renamed" event for the FileSystemWatcher
            watcher = new AutoQCFileSystemWatcher(logger, configRunner);
            // folder to watch
            folderToWatch = CreateDirectory(testDir, instrument + "_4");
            // Create a .sky files
            skyFile = CreateFile(folderToWatch, "test2_d.sky");
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.IncludeSubfolders = false;
            mainSettings.QcFileFilter      = FileFilter.GetFileFilter(AllFileFilter.NAME, string.Empty);
            mainSettings.ValidateSettings();
            watcher.Init(config);

            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            dataFiles.Clear();
            SetupTestFolder(folderToWatch, instrument, out dataFiles,
                            true); // Create temp file first and rename it

            watcher.CheckDrive();  // Otherwise UNC tests might fail on //net-lab3

            files = new List <string>();
            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(1, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));

            watcher.Stop();
        }
Ejemplo n.º 5
0
        public void TestBackgroundWorker_ProcessNewFiles()
        {
            // Create a test directory to monitor
            var dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            Assert.IsNotNull(dir);
            var testDir = Path.Combine(dir, "TestBackgroundWorker");

            if (Directory.Exists(testDir))
            {
                Directory.Delete(testDir, true);
            }
            Assert.IsFalse(Directory.Exists(testDir));
            Directory.CreateDirectory(testDir);
            Assert.IsTrue(Directory.Exists(testDir));

            var appControl     = new TestAppControl();
            var logger         = new TestLogger();
            var processControl = new TestProcessControl(logger);
            var mainSettings   = MainSettings.GetDefault();

            mainSettings.FolderToWatch  = testDir;
            mainSettings.InstrumentType = "NoInstrument";

            AutoQcConfig config = new AutoQcConfig();

            config.MainSettings     = mainSettings;
            config.PanoramaSettings = PanoramaSettings.GetDefault();
            config.Name             = "Test Config";
            config.IsEnabled        = true;

            var configRunner = new ConfigRunner(config, appControl);

            // Start the background worker.
//            configRunner.Start();
            //Thread.Sleep(1000);
//            Assert.IsTrue(configRunner.IsBusy());

            // Create a new file in the test directory.
//            Thread.Sleep(1000);
            CreateNewFile(testDir, "test1.txt");

//            // Wait till the the file has been processed.
//            while (!processControl.IsDone())
//            {
//                Thread.Sleep(500);
//            }
//            Assert.IsTrue(configRunner.IsRunning());
//
//            // Create another file in the test directory.
//            Thread.Sleep(1000);
//            CreateNewFile(testDir, "test2.txt");
//
//            // Wait till the the file has been processed.
//            // Process4 returns exit code 1. This should put the file in the re-import queue.
//            while (!processControl.IsDone())
//            {
//                Thread.Sleep(500);
//            }
//
//            // Assert.IsTrue(appControl.Waiting);
//            Thread.Sleep(2 * AutoQCBackgroundWorker.WAIT_FOR_NEW_FILE);
//            //Assert.IsTrue(appControl.Waiting);
//
//            Assert.AreEqual(Regex.Replace(logger.GetLog(), @"\s+", ""),
//                Regex.Replace(GetExpectedLog_ProcessNew(), @"\s+", ""));
        }
Ejemplo n.º 6
0
        void SaveSettings(ConfigFileUse configFileUse)
        {
            var defaultSettings = MainSettings.GetDefault();
            var readSettings    = ConfigurationHelper.GetMainProperties(configFileUse,
                                                                        defaultSettings, writeToLog: null);

            // Special case: if we have switched from user config file to application config file,
            // we still have to update that particular setting in the user config file, or it won't
            // persist through program restart.
            if (originalConfigFileUse != ConfigFileUse.ApplicationConfig &&
                configFileUse == ConfigFileUse.ApplicationConfig)
            {
                var userConfiguration = TwoFilesConfiguration.Create(ConfigFileUse.UserConfig);
                userConfiguration.SetValue(ConfigurationParameters.ConfigurationConfigFileParameter, configFileUse);
                userConfiguration.Save();
            }

            var configuration = TwoFilesConfiguration.Create(configFileUse);

            configuration.SetValue(ConfigurationParameters.ConfigurationConfigFileParameter, configFileUse);

            SaveSetting(configuration, readSettings, ConfigurationParameters.LogFontSize,
                        MainSettings.LogFontSize);
            SaveSetting(configuration, readSettings, ConfigurationParameters.TreeViewFontSize,
                        MainSettings.TreeViewFontSize);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ShowMessageCountParameter,
                        MainSettings.ShowMessageCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.SaveMessageToFileParameter,
                        MainSettings.SaveMessageToFile);
            SaveSetting(configuration, readSettings, ConfigurationParameters.UseAsciiParameter,
                        MainSettings.UseAscii);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.SavePropertiesToFileParameter,
                        MainSettings.SavePropertiesToFile);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.SaveCheckpointsToFileParameter,
                        MainSettings.SaveCheckpointsToFile);
            SaveSetting(configuration, readSettings, ConfigurationParameters.RetryCountParameter,
                        MainSettings.RetryCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.RetryTimeoutParameter,
                        MainSettings.RetryTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.TopParameter,
                        MainSettings.TopCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ReceiveTimeoutParameter,
                        MainSettings.ReceiveTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ServerTimeoutParameter,
                        MainSettings.ServerTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.SenderThinkTimeParameter,
                        MainSettings.SenderThinkTime);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ReceiverThinkTimeParameter,
                        MainSettings.ReceiverThinkTime);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.MonitorRefreshIntervalParameter,
                        MainSettings.MonitorRefreshInterval);
            SaveSetting(configuration, readSettings, ConfigurationParameters.PrefetchCountParameter,
                        MainSettings.PrefetchCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.LabelParameter,
                        MainSettings.Label);

            SaveSetting(configuration, readSettings, ConfigurationParameters.MessageParameter,
                        MainSettings.MessageText);
            SaveSetting(configuration, readSettings, ConfigurationParameters.FileParameter,
                        MainSettings.MessageFile);
            SaveSetting(configuration, readSettings, ConfigurationParameters.MessageContentTypeParameter,
                        MainSettings.MessageContentType);

            SaveSetting(configuration, readSettings, ConfigurationParameters.ConnectivityMode,
                        MainSettings.ConnectivityMode);
            SaveSetting(configuration, readSettings, ConfigurationParameters.UseAmqpWebSockets,
                        MainSettings.UseAmqpWebSockets);
            SaveSetting(configuration, readSettings, ConfigurationParameters.Encoding,
                        MainSettings.EncodingType);

            SaveListSetting(configuration, readSettings, ConfigurationParameters.SelectedEntitiesParameter,
                            MainSettings.SelectedEntities);
            SaveListSetting(configuration, readSettings, ConfigurationParameters.SelectedMessageCountsParameter,
                            MainSettings.SelectedMessageCounts);

            SaveSetting(configuration, readSettings, ConfigurationParameters.MessageBodyType,
                        MainSettings.MessageBodyType);

            SaveSetting(configuration, readSettings, ConfigurationParameters.DisableAccidentalDeletionPrevention,
                        MainSettings.DisableAccidentalDeletionPrevention);

            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyOverrideDefault,
                        MainSettings.ProxyOverrideDefault);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyAddress,
                        MainSettings.ProxyAddress);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyBypassList,
                        MainSettings.ProxyBypassList);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyBypassOnLocal,
                        MainSettings.ProxyBypassOnLocal);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyUseDefaultCredentials,
                        MainSettings.ProxyUseDefaultCredentials);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyUserName,
                        MainSettings.ProxyUserName);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ProxyPassword,
                        MainSettings.ProxyPassword);

            SaveSetting(configuration, readSettings, ConfigurationParameters.NodesColors, NodeColorInfo.FormatAll(MainSettings.NodesColors));

            configuration.Save();
        }
Ejemplo n.º 7
0
        void SaveSettings(ConfigFileUse configFileUse)
        {
            var defaultSettings = MainSettings.GetDefault();
            var readSettings    = ConfigurationHelper.GetMainProperties(configFileUse,
                                                                        defaultSettings, writeToLog: null);
            var configuration = TwoFilesConfiguration.Create(configFileUse);

            configuration.SetValue(ConfigurationParameters.ConfigurationConfigFileParameter, configFileUse);

            SaveSetting(configuration, readSettings, ConfigurationParameters.LogFontSize,
                        MainSettings.LogFontSize);
            SaveSetting(configuration, readSettings, ConfigurationParameters.TreeViewFontSize,
                        MainSettings.TreeViewFontSize);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ShowMessageCountParameter,
                        MainSettings.ShowMessageCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.SaveMessageToFileParameter,
                        MainSettings.SaveMessageToFile);
            SaveSetting(configuration, readSettings, ConfigurationParameters.UseAsciiParameter,
                        MainSettings.UseAscii);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.SavePropertiesToFileParameter,
                        MainSettings.SavePropertiesToFile);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.SaveCheckpointsToFileParameter,
                        MainSettings.SaveCheckpointsToFile);
            SaveSetting(configuration, readSettings, ConfigurationParameters.RetryCountParameter,
                        MainSettings.RetryCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.RetryTimeoutParameter,
                        MainSettings.RetryTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.TopParameter,
                        MainSettings.TopCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ReceiveTimeoutParameter,
                        MainSettings.ReceiveTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ServerTimeoutParameter,
                        MainSettings.ServerTimeout);
            SaveSetting(configuration, readSettings, ConfigurationParameters.SenderThinkTimeParameter,
                        MainSettings.SenderThinkTime);
            SaveSetting(configuration, readSettings, ConfigurationParameters.ReceiverThinkTimeParameter,
                        MainSettings.ReceiverThinkTime);
            SaveSetting(configuration, readSettings,
                        ConfigurationParameters.MonitorRefreshIntervalParameter,
                        MainSettings.MonitorRefreshInterval);
            SaveSetting(configuration, readSettings, ConfigurationParameters.PrefetchCountParameter,
                        MainSettings.PrefetchCount);
            SaveSetting(configuration, readSettings, ConfigurationParameters.LabelParameter,
                        MainSettings.Label);

            SaveSetting(configuration, readSettings, ConfigurationParameters.MessageParameter,
                        MainSettings.MessageText);
            SaveSetting(configuration, readSettings, ConfigurationParameters.FileParameter,
                        MainSettings.MessageFile);

            SaveSetting(configuration, readSettings, ConfigurationParameters.ConnectivityMode,
                        MainSettings.ConnectivityMode);
            SaveSetting(configuration, readSettings, ConfigurationParameters.Encoding,
                        MainSettings.EncodingType);

            SaveListSetting(configuration, readSettings, ConfigurationParameters.SelectedEntitiesParameter,
                            MainSettings.SelectedEntities);

            SaveSetting(configuration, readSettings, ConfigurationParameters.MessageBodyType,
                        MainSettings.MessageBodyType);

            configuration.Save();
        }
Ejemplo n.º 8
0
        private static void TestGetNewFilesForInstrument(string testDir, string instrument)
        {
            var logger = new TestLogger();

            // folder to watch
            var folderToWatch = CreateDirectory(testDir, instrument);
            // Create a .sky files
            var skyFile = CreateFile(folderToWatch, "test2_a.sky");

            var config = new AutoQcConfig();

            // 1. Look for files in folderToWatchOnly
            var watcher      = new AutoQCFileSystemWatcher(logger);
            var mainSettings = MainSettings.GetDefault();

            config.MainSettings = mainSettings;

            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.IncludeSubfolders = false;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.ValidateSettings();

            watcher.Init(config);
            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            // Create new files in the folder
            List <string> dataFiles;

            SetupTestFolder(folderToWatch, instrument, out dataFiles);

            // Only one file should have been added to the queue since we are not monitoring sub-folders
            Assert.IsNotNull(watcher.GetFile());
            Assert.IsNull(watcher.GetFile());

            watcher.Stop();

            // 2. Look for files in subfolders
            watcher = new AutoQCFileSystemWatcher(logger);
            // folder to watch
            folderToWatch = CreateDirectory(testDir, instrument + "_2");
            // Create a .sky files
            skyFile = CreateFile(folderToWatch, "test2_b.sky");
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.IncludeSubfolders = true; // watch sub-folders
            mainSettings.ValidateSettings();
            watcher.Init(config);

            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            dataFiles.Clear();
            SetupTestFolder(folderToWatch, instrument, out dataFiles); // Create new files in the folder

            var    files = new List <string>();
            string f;

            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(5, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[1]));
            Assert.IsTrue(files.Contains(dataFiles[2]));
            Assert.IsTrue(files.Contains(dataFiles[3]));
            Assert.IsTrue(files.Contains(dataFiles[4]));

            //  3. Look for files in subfolders matching a pattern
            watcher = new AutoQCFileSystemWatcher(logger);
            // folder to watch
            folderToWatch = CreateDirectory(testDir, instrument + "_3");
            // Create a .sky files
            skyFile = CreateFile(folderToWatch, "test2_c.sky");
            mainSettings.SkylineFilePath   = skyFile;
            mainSettings.InstrumentType    = instrument;
            mainSettings.FolderToWatch     = folderToWatch;
            mainSettings.IncludeSubfolders = true;                                                  // watch sub-folders
            mainSettings.QcFileFilter      = FileFilter.GetFileFilter(ContainsFilter.NAME, "_QC_"); // file name pattern
            mainSettings.ValidateSettings();
            watcher.Init(config);

            watcher.StartWatching();                              // Start watching
            Assert.AreEqual(0, watcher.GetExistingFiles().Count); // No existing files

            dataFiles.Clear();
            SetupTestFolder(folderToWatch, instrument, out dataFiles); // Create new files in the folder

            files = new List <string>();
            while ((f = watcher.GetFile()) != null)
            {
                files.Add(f);
            }
            Assert.AreEqual(2, files.Count);
            Assert.IsTrue(files.Contains(dataFiles[0]));
            Assert.IsTrue(files.Contains(dataFiles[2]));
        }