private static void TestToolAdd() { ImmediateWindow immediateWindow = ShowDialog <ImmediateWindow>(SkylineWindow.ShowImmediateWindow); const string exePath = "example.exe"; //Not L10N RunUI(() => { immediateWindow.Clear(); int countStart = Settings.Default.ToolList.Count; const string addToolCommand = "--tool-add=ImToolAdded --tool-command=" + exePath; //Not L10N immediateWindow.WriteLine(addToolCommand); immediateWindow.RunLine(immediateWindow.LineCount - 1); AssertEx.AreComparableStrings(Resources.CommandLine_ImportTool__0__was_added_to_the_Tools_Menu_, immediateWindow.TextContent, 1); //Not L10N will be when command line stuff is localized. SkylineWindow.PopulateToolsMenu(); Assert.AreEqual("ImToolAdded", SkylineWindow.GetToolText(countStart)); immediateWindow.Clear(); // Write the title of the tool and then run it from the immediate window. immediateWindow.WriteLine("ImToolAdded"); }); RunDlg <MessageDlg>(() => immediateWindow.RunLine(0), messageDlg => { AssertEx.Contains(messageDlg.Message, Resources.ToolDescription_RunTool_Please_check_the_command_location_is_correct_for_this_tool_); messageDlg.OkDialog(); }); RunUI(immediateWindow.Dispose); }
private void TestArgCollector() { string path1 = TestFilesDir.GetTestPath("TestArgCollector.zip"); string argsCollector = string.Empty; RunDlg <ConfigureToolsDlg>(SkylineWindow.ShowConfigureToolsDlg, configureToolsDlg => { configureToolsDlg.RemoveAllTools(); configureToolsDlg.InstallZipTool(path1); Assert.AreEqual("TestArgCollector", configureToolsDlg.textTitle.Text); Assert.AreEqual("$(ToolDir)\\ArgstoOut.exe", configureToolsDlg.textCommand.Text); Assert.AreEqual("SomeArgs $(CollectedArgs) SomeMoreArgs", configureToolsDlg.textArguments.Text); Assert.AreEqual(string.Empty, configureToolsDlg.textInitialDirectory.Text); Assert.AreEqual(CheckState.Checked, configureToolsDlg.cbOutputImmediateWindow.CheckState); Assert.AreEqual(string.Empty, configureToolsDlg.comboReport.SelectedItem); string toolDir = configureToolsDlg.ToolDir; Assert.IsTrue(Directory.Exists(toolDir)); argsCollector = configureToolsDlg.ArgsCollectorPath; string argscollectorCall = configureToolsDlg.ArgsCollectorType; Assert.IsTrue(File.Exists(Path.Combine(toolDir, argsCollector))); Assert.IsTrue(File.Exists(Path.Combine(toolDir, "ArgstoOut.exe"))); Assert.AreEqual("TestArgCollector.dll", Path.GetFileName(argsCollector)); Assert.AreEqual("TestArgCollector.ArgCollector", argscollectorCall); configureToolsDlg.OkDialog(); }); WaitForCondition(3 * 1000, () => File.Exists(argsCollector)); RunUI(() => { SkylineWindow.PopulateToolsMenu(); string toolText = SkylineWindow.GetToolText(0); Assert.AreEqual("TestArgCollector", toolText); // Not L10N SkylineWindow.RunTool(0); }); const string toolOutput = "SomeArgs test args collector SomeMoreArgs"; // Not L10N WaitForConditionUI(3 * 1000, () => SkylineWindow.ImmediateWindow.TextContent.Contains(toolOutput)); RunUI(() => { Assert.IsTrue(SkylineWindow.ImmediateWindow.TextContent.Contains(toolOutput)); SkylineWindow.ImmediateWindow.Clear(); SkylineWindow.ImmediateWindow.Cleanup(); SkylineWindow.ImmediateWindow.Close(); }); }