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

            var logger = new TestLogger();
            var mainSettings = new MainSettings()
            {
                SkylineFilePath = skyFile,
                ResultsWindowString = MainSettings.ACCUM_TIME_WINDOW.ToString()
            };

            var mainSettingsTab = new MainSettingsTab(null, logger)
            {
                Settings = mainSettings
            };

            var accumulationWindow = MainSettingsTab.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 = mainSettingsTab.SkylineRunnerArgs(importContext);
            Assert.AreEqual(expected, args.Trim());
        }
Esempio 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 logger = new TestLogger();
            var mainSettings = new MainSettings()
            {
                SkylineFilePath = skyFile,
                ResultsWindowString = MainSettings.ACCUM_TIME_WINDOW.ToString()
            };

            var mainSettingsTab = new MainSettingsTab(null, logger)
            {
                Settings = mainSettings
            };

            // 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 = mainSettingsTab.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 = mainSettingsTab.SkylineRunnerArgs(importContext);
            Assert.AreEqual(expected, args.Trim());

            Assert.IsNull(importContext.GetNextFile());
        }