public void TestValidatePanoramaSettings() { var logger = new TestLogger(); var settings = new PanoramaSettings(); var mainControl = new TestAppControl(); mainControl.SetUIPanoramaSettings(settings); var panoramaSettingsTab = new PanoramaSettingsTab(mainControl, logger); Assert.IsTrue(panoramaSettingsTab.ValidateSettings()); var log = logger.GetLog(); Assert.IsTrue(log.Contains("Will NOT publish Skyline documents to Panorama.")); settings.PublishToPanorama = true; logger.Clear(); panoramaSettingsTab.Settings = settings; Assert.IsFalse(panoramaSettingsTab.ValidateSettings()); log = logger.GetLog(); Assert.IsTrue(log.Contains("Please specify a Panorama server URL.")); Assert.IsTrue(log.Contains("Please specify a Panorama login name.")); Assert.IsTrue(log.Contains("Please specify a Panorama user password.")); Assert.IsTrue(log.Contains("Please specify a folder on the Panorama server.")); }
public void SetUIPanoramaSettings(PanoramaSettings panoramaSettings) { _panoramaSettings = panoramaSettings; }
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+", "")); }