本文整理汇总了C#中VisualStudioApp类的典型用法代码示例。如果您正苦于以下问题:C# VisualStudioApp类的具体用法?C# VisualStudioApp怎么用?C# VisualStudioApp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisualStudioApp类属于命名空间,在下文中一共展示了VisualStudioApp类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestPublishToWebSite
private void TestPublishToWebSite(
string templateName,
string projectName,
string moduleName,
string textInResponse,
string pythonVersion,
int publishTimeout,
string packageName = null
) {
using (var app = new VisualStudioApp()) {
var pyProj = app.CreateProject(
PythonVisualStudioApp.TemplateLanguageName,
templateName,
TestData.GetTempPath(),
projectName
).GetPythonProject();
var factory = WebProjectTests.CreateVirtualEnvironment(pythonVersion, app, pyProj);
WebProjectTests.InstallWebFramework(app, moduleName, packageName ?? moduleName, factory);
_webSiteToDelete = Guid.NewGuid().ToString("N");
var siteUri = app.PublishToAzureWebSite(_webSiteToDelete, publishSettingsFilePath);
app.WaitForBuildComplete(publishTimeout);
string text = WebDownloadUtility.GetString(siteUri);
Console.WriteLine("Response from {0}", siteUri);
Console.WriteLine(text);
Assert.IsTrue(text.Contains(textInResponse), text);
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:32,代码来源:AzureWebSiteTests.cs
示例2: AddCloudProject
public void AddCloudProject() {
using (var app = new VisualStudioApp()) {
var project = app.CreateProject(
PythonVisualStudioApp.TemplateLanguageName,
PythonVisualStudioApp.DjangoWebProjectTemplate,
TestData.GetTempPath(),
"AddCloudProject"
);
app.SolutionExplorerTreeView.SelectProject(project);
try {
app.ExecuteCommand("Project.ConverttoMicrosoftAzureCloudServiceProject");
} catch (Exception ex1) {
try {
app.ExecuteCommand("Project.ConverttoWindowsAzureCloudServiceProject");
} catch (Exception ex2) {
Console.WriteLine("Unable to execute Project.ConverttoWindowsAzureCloudServiceProject.\r\n{0}", ex2);
try {
app.ExecuteCommand("Project.AddWindowsAzureCloudServiceProject");
} catch (Exception ex3) {
Console.WriteLine("Unable to execute Project.AddWindowsAzureCloudServiceProject.\r\n{0}", ex3);
throw ex1;
}
}
}
var res = app.SolutionExplorerTreeView.WaitForItem(
"Solution '" + app.Dte.Solution.Projects.Item(1).Name + "' (2 projects)",
app.Dte.Solution.Projects.Item(1).Name + ".Azure"
);
Assert.IsNotNull(res);
}
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:33,代码来源:DjangoAzureTests.cs
示例3: InteractiveWindow
public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app)
: base(null, element) {
_app = app;
_title = title;
var compModel = _app.GetService<IComponentModel>(typeof(SComponentModel));
var replWindowProvider = compModel.GetService<InteractiveWindowProvider>();
_replWindow = replWindowProvider
#if DEV14_OR_LATER
.GetReplToolWindows()
#else
.GetReplWindows()
#endif
.OfType<ToolWindowPane>()
.FirstOrDefault(p => p.Caption.Equals(title, StringComparison.CurrentCulture));
#if DEV14_OR_LATER
_interactive = ((IVsInteractiveWindow)_replWindow).InteractiveWindow;
#else
_interactive = (IReplWindow)_replWindow;
#endif
_replWindowInfo = _replWindows.GetValue(_replWindow, window => {
var info = new InteractiveWindowInfo();
_interactive.ReadyForInput += new Action(info.OnReadyForInput);
return info;
});
}
开发者ID:omnimark,项目名称:PTVS,代码行数:27,代码来源:InteractiveWindow.cs
示例4: TestPublishToWebRole
private void TestPublishToWebRole(
string languageName,
string templateName,
string projectName,
string expectedProjectItem,
string textInResponse,
int publishTimeout
) {
using (var app = new VisualStudioApp()) {
AzureWebSiteTests.CreateProject(
app,
languageName,
templateName,
TestData.GetTempPath(),
projectName,
expectedProjectItem
);
app.Dte.ExecuteCommand("Project.ConverttoWindowsAzureCloudServiceProject");
_cloudServiceToDelete = Guid.NewGuid().ToString("N");
var siteUri = app.PublishToAzureCloudService(_cloudServiceToDelete, publishSettingsFilePath);
app.WaitForBuildComplete(publishTimeout);
app.AzureActivityLog.WaitForPublishComplete(_cloudServiceToDelete, publishTimeout);
string text = WebDownloadUtility.GetString(siteUri);
Console.WriteLine("Response from {0}", siteUri);
Console.WriteLine(text);
Assert.IsTrue(text.Contains(textInResponse), text);
}
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:32,代码来源:AzureWebRoleTests.cs
示例5: ObjectBrowserBasicTest
public void ObjectBrowserBasicTest() {
using (var app = new VisualStudioApp()) {
var project = app.OpenProject(@"TestData\Outlining.sln");
System.Threading.Thread.Sleep(1000);
app.OpenObjectBrowser();
var objectBrowser = app.ObjectBrowser;
System.Threading.Thread.Sleep(1000);
int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
System.Threading.Thread.Sleep(1000);
nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());
AssertNodes(objectBrowser,
new NodeInfo("Outlining", "Outlining"),
new NodeInfo("BadForStatement.py", "BadForStatement.py"),
new NodeInfo("NestedFuncDef.py", "NestedFuncDef.py", new[] { "f()" }),
new NodeInfo("Program.py", "Program.py", new[] { "f()" }));
app.Dte.Solution.Close(false);
System.Threading.Thread.Sleep(1000);
nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:31,代码来源:ObjectBrowserTest.cs
示例6: NavigateTo
public void NavigateTo()
{
using (var app = new VisualStudioApp()) {
app.OpenProject(@"TestData\Navigation.sln");
using (var dialog = app.OpenNavigateTo()) {
dialog.SearchTerm = "Class";
Assert.AreEqual(4, dialog.WaitForNumberOfResults(4));
}
using (var dialog = app.OpenNavigateTo()) {
dialog.SearchTerm = "cls";
Assert.AreEqual(4, dialog.WaitForNumberOfResults(4));
}
using (var dialog = app.OpenNavigateTo()) {
dialog.SearchTerm = "func";
Assert.AreEqual(8, dialog.WaitForNumberOfResults(8));
}
using (var dialog = app.OpenNavigateTo()) {
dialog.SearchTerm = "fn";
Assert.AreEqual(8, dialog.WaitForNumberOfResults(8));
}
}
}
开发者ID:,项目名称:,代码行数:26,代码来源:
示例7: FromDte
public static NewAppDialog FromDte(VisualStudioApp app) {
return new NewAppDialog(
app,
AutomationElement.FromHandle(
app.OpenDialogWithDteExecuteCommand("ProjectandSolutionContextMenus.Project.Add.Djangoapp")
)
);
}
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:NewAppDialog.cs
示例8: DebugPythonProject
public void DebugPythonProject() {
using (var app = new VisualStudioApp()) {
StartHelloWorldAndBreak(app);
app.Dte.Debugger.Go(WaitForBreakOrEnd: true);
Assert.AreEqual(dbgDebugMode.dbgDesignMode, app.Dte.Debugger.CurrentMode);
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:8,代码来源:DebugProject.cs
示例9: VisualStudioInstance
public VisualStudioInstance(SolutionFile solution) {
_solution = solution;
_app = new VisualStudioApp();
Project = _app.OpenProject(solution.Filename);
ThreadHelper.Generic.Invoke(Keyboard.Reset);
_solutionExplorer = _app.OpenSolutionExplorer();
SelectSolutionNode();
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:9,代码来源:VisualStudioInstance.cs
示例10: VerifyTemplateDirectories
public void VerifyTemplateDirectories() {
var languageName = RConstants.TemplateLanguageName;
using (var app = new VisualStudioApp()) {
var sln = (Solution2)app.Dte.Solution;
var paths = (new[] { RConstants.ProjectTemplate_EmptyProject })
.Select(n => sln.GetProjectTemplate(n, languageName));
var existingPaths = paths.Where(templatePath => File.Exists(templatePath) || Directory.Exists(templatePath));
existingPaths.Should().BeEquivalentTo(paths);
}
}
开发者ID:AlexanderSher,项目名称:RTVS-Old,代码行数:10,代码来源:UITests.cs
示例11: DebugDjangoProject
public void DebugDjangoProject() {
using (var app = new VisualStudioApp()) {
DebuggerUITests.DebugProject.OpenProjectAndBreak(
app,
TestData.GetPath(@"TestData\DjangoDebugProject.sln"),
@"TestApp\views.py",
5,
false);
}
}
开发者ID:RussBaz,项目名称:PTVS,代码行数:10,代码来源:DjangoDebugProjectTests.cs
示例12: ActivateInteractiveWindow
public override ToolWindowPane ActivateInteractiveWindow(VisualStudioApp app, string executionMode) {
string description = null;
if (Version.IsCPython) {
description = string.Format("{0} {1}",
Version.Isx64 ? CPythonInterpreterFactoryConstants.Description64 : CPythonInterpreterFactoryConstants.Description32,
Version.Version.ToVersion()
);
} else if (Version.IsIronPython) {
description = string.Format("{0} {1}",
Version.Isx64 ? "IronPython 64-bit" : "IronPython",
Version.Version.ToVersion()
);
}
Assert.IsNotNull(description, "Unknown interpreter");
var automation = (IVsPython)app.Dte.GetObject("VsPython");
var options = (IPythonOptions)automation;
var replOptions = options.GetInteractiveOptions(description);
Assert.IsNotNull(replOptions, "Could not find options for " + description);
replOptions.InlinePrompts = InlinePrompts;
replOptions.UseInterpreterPrompts = UseInterpreterPrompts;
replOptions.PrimaryPrompt = PrimaryPrompt;
replOptions.SecondaryPrompt = SecondaryPrompt;
replOptions.EnableAttach = EnableAttach;
var oldExecutionMode = replOptions.ExecutionMode;
app.OnDispose(() => replOptions.ExecutionMode = oldExecutionMode);
replOptions.ExecutionMode = executionMode;
var oldAddNewLineAtEndOfFullyTypedWord = options.Intellisense.AddNewLineAtEndOfFullyTypedWord;
app.OnDispose(() => options.Intellisense.AddNewLineAtEndOfFullyTypedWord = oldAddNewLineAtEndOfFullyTypedWord);
options.Intellisense.AddNewLineAtEndOfFullyTypedWord = AddNewLineAtEndOfFullyTypedWord;
bool success = false;
for (int retries = 1; retries < 20; ++retries) {
try {
app.ExecuteCommand("Python.Interactive", "/e:\"" + description + "\"");
success = true;
break;
} catch (AggregateException) {
}
app.DismissAllDialogs();
app.SetFocus();
Thread.Sleep(retries * 100);
}
Assert.IsTrue(success, "Unable to open " + description + " through DTE");
var interpreters = app.ComponentModel.GetService<IInterpreterOptionsService>();
var replId = PythonReplEvaluatorProvider.GetReplId(
interpreters.FindInterpreter(Version.Id, Version.Version.ToVersion())
);
var provider = app.ComponentModel.GetService<InteractiveWindowProvider>();
return (ToolWindowPane)provider.FindReplWindow(replId);
}
开发者ID:wenh123,项目名称:PTVS,代码行数:55,代码来源:PythonReplWindowProxySettings.cs
示例13: AddDifferentFileType
public void AddDifferentFileType() {
using (var app = new VisualStudioApp()) {
var project = app.OpenProject(@"TestData\HelloWorld.sln");
string fullPath = TestData.GetPath(@"TestData\HelloWorld.sln");
// "Python Environments", "References", "Search Paths", "Program.py"
Assert.AreEqual(4, project.ProjectItems.Count);
var item = project.ProjectItems.AddFromFileCopy(TestData.GetPath(@"TestData\Xaml\EmptyXName.xaml"));
Assert.AreEqual("EmptyXName.xaml", item.Properties.Item("FileName").Value);
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:12,代码来源:NugetTests.cs
示例14: MoveFolderWithItem
// Currently Fails: https://pytools.codeplex.com/workitem/2609
public void MoveFolderWithItem() {
using (var app = new VisualStudioApp()) {
// close any projects before switching source control...
app.Dte.Solution.Close();
app.SelectSourceControlProvider("Test Source Provider");
ExpectSourceControl();
foreach (var projectType in ProjectTypes) {
var testDef = new ProjectDefinition("SourceControl", projectType,
PropertyGroup(
Property("SccProjectName", "HelloWorld"),
Property("SccLocalPath", "LocalPath"),
Property("SccAuxPath", "AuxPath"),
Property("SccProvider", "TestProvider")
),
ItemGroup(
Folder("Fob"),
Folder("Fob\\Oar"),
Compile("Program"),
Compile("Fob\\Oar\\Quox")
)
);
using (var solution = testDef.Generate()) {
TestSccProvider.DocumentEvents.Clear();
var project = app.OpenProject(solution.Filename);
var window = app.OpenSolutionExplorer();
var folder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl", "Fob", "Oar");
var point = folder.GetClickablePoint();
Mouse.MoveTo(point);
Mouse.Down(MouseButton.Left);
var destFolder = window.WaitForItem("Solution 'SourceControl' (1 project)", "SourceControl");
Mouse.MoveTo(destFolder.GetClickablePoint());
Mouse.Up(MouseButton.Left);
window.AssertFileExists(Path.GetDirectoryName(solution.Filename), "Solution 'SourceControl' (1 project)", "SourceControl", "Oar", "Quox" + projectType.CodeExtension);
var projectDir = Path.GetDirectoryName(project.FullName);
AssertDocumentEvents(projectDir,
OnQueryRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSQUERYRENAMEFILEFLAGS_NoFlags),
OnQueryRenameFiles("Fob\\Oar\\", "Oar", VSQUERYRENAMEFILEFLAGS_Directory),
OnAfterRenameFiles(projectType.Code("Fob\\Oar\\Quox"), projectType.Code("Oar\\Quox"), VSRENAMEFILEFLAGS_NoFlags),
OnAfterRenameFiles("Fob\\Oar\\", "Oar", VSRENAMEFILEFLAGS_Directory)
);
}
}
}
}
开发者ID:lioaphy,项目名称:nodejstools,代码行数:54,代码来源:SourceControl.cs
示例15: LoadNodejsProject
public void LoadNodejsProject() {
using (var app = new VisualStudioApp()) {
app.OpenProject(@"TestData\HelloWorld.sln");
Assert.IsTrue(app.Dte.Solution.IsOpen, "The solution is not open");
Assert.IsTrue(app.Dte.Solution.Projects.Count == 1, String.Format("Loading project resulted in wrong number of loaded projects, expected 1, received {0}", app.Dte.Solution.Projects.Count));
var iter = app.Dte.Solution.Projects.GetEnumerator();
iter.MoveNext();
Project project = (Project)iter.Current;
Assert.AreEqual("HelloWorld.njsproj", Path.GetFileName(project.FileName), "Wrong project file name");
}
}
开发者ID:sramos30,项目名称:ntvsiot,代码行数:13,代码来源:BasicProjectTests.cs
示例16: DebugPythonProjectSubFolderStartupFileSysPath
public void DebugPythonProjectSubFolderStartupFileSysPath() {
using (var app = new VisualStudioApp()) {
app.OpenProject(TestData.GetPath(@"TestData\SysPath.sln"));
ClearOutputWindowDebugPaneText();
app.Dte.ExecuteCommand("Debug.Start");
WaitForMode(app, dbgDebugMode.dbgDesignMode);
// sys.path should point to the startup file directory, not the project directory.
// this matches the behavior of start without debugging.
// Note: backslashes are escaped in the output
string testDataPath = TestData.GetPath("TestData\\SysPath\\Sub'").Replace("\\", "\\\\");
WaitForDebugOutput(text => text.Contains(testDataPath));
}
}
开发者ID:omnimark,项目名称:PTVS,代码行数:15,代码来源:DebugProject.cs
示例17: CloseAll
public static void CloseAll(VisualStudioApp app = null) {
IComponentModel compModel;
if (app != null) {
compModel = app.GetService<IComponentModel>(typeof(SComponentModel));
} else {
compModel = (IComponentModel)VSTestContext.ServiceProvider.GetService(typeof(SComponentModel));
}
var replWindowProvider = compModel.GetService<IReplWindowProvider>();
foreach (var frame in replWindowProvider.GetReplWindows()
.OfType<ReplWindow>()
.Select(r => r.Frame)
.OfType<IVsWindowFrame>()) {
frame.Hide();
}
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:15,代码来源:InteractiveWindow.cs
示例18: LoadRelativeProjects
public void LoadRelativeProjects() {
using (var app = new VisualStudioApp()) {
string fullPath = TestData.GetPath(@"TestData\ProjectHomeProjects.sln");
app.OpenProject(@"TestData\ProjectHomeProjects.sln", expectedProjects: 9);
foreach (var project in app.Dte.Solution.Projects.OfType<Project>()) {
var name = Path.GetFileName(project.FileName);
if (name.StartsWith("ProjectA")) {
// Should have ProgramA.py, Subfolder\ProgramB.py and Subfolder\Subsubfolder\ProgramC.py
var programA = project.ProjectItems.Item("ProgramA.py");
Assert.IsNotNull(programA);
var subfolder = project.ProjectItems.Item("Subfolder");
var programB = subfolder.ProjectItems.Item("ProgramB.py");
Assert.IsNotNull(programB);
var subsubfolder = subfolder.ProjectItems.Item("Subsubfolder");
var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
Assert.IsNotNull(programC);
} else if (name.StartsWith("ProjectB")) {
// Should have ProgramB.py and Subsubfolder\ProgramC.py
var programB = project.ProjectItems.Item("ProgramB.py");
Assert.IsNotNull(programB);
var subsubfolder = project.ProjectItems.Item("Subsubfolder");
var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
Assert.IsNotNull(programC);
} else if (name.StartsWith("ProjectSln")) {
// Should have ProjectHomeProjects\ProgramA.py,
// ProjectHomeProjects\Subfolder\ProgramB.py and
// ProjectHomeProjects\Subfolder\Subsubfolder\ProgramC.py
var projectHome = project.ProjectItems.Item("ProjectHomeProjects");
var programA = projectHome.ProjectItems.Item("ProgramA.py");
Assert.IsNotNull(programA);
var subfolder = projectHome.ProjectItems.Item("Subfolder");
var programB = subfolder.ProjectItems.Item("ProgramB.py");
Assert.IsNotNull(programB);
var subsubfolder = subfolder.ProjectItems.Item("Subsubfolder");
var programC = subsubfolder.ProjectItems.Item("ProgramC.py");
Assert.IsNotNull(programC);
} else {
Assert.Fail("Wrong project file name", name);
}
}
}
}
开发者ID:wenh123,项目名称:PTVS,代码行数:48,代码来源:ProjectHomeTests.cs
示例19: GlobalIntellisense
public void GlobalIntellisense() {
using (var app = new VisualStudioApp()) {
Window window;
var openFile = OpenProjectItem(app, "server.js", out window);
openFile.MoveCaret(6, 1);
Keyboard.Type("process.");
using (var session = openFile.WaitForSession<ICompletionSession>()) {
var completions = session.Session.CompletionSets.First().Completions.Select(x => x.InsertionText);
Assert.IsTrue(completions.Contains("abort"));
Assert.IsTrue(completions.Contains("chdir"));
}
}
}
开发者ID:sramos30,项目名称:ntvsiot,代码行数:16,代码来源:ProjectTests.cs
示例20: InteractiveWindow
public InteractiveWindow(string title, AutomationElement element, VisualStudioApp app)
: base(null, element) {
_app = app;
_title = title;
var compModel = _app.GetService<IComponentModel>(typeof(SComponentModel));
var replWindowProvider = compModel.GetService<IReplWindowProvider>();
_replWindow = replWindowProvider.GetReplWindows()
.OfType<ReplWindow>()
.FirstOrDefault(p => p.Title.Equals(title, StringComparison.CurrentCulture));
_replWindowInfo = _replWindows.GetValue(_replWindow, window => {
var info = new ReplWindowInfo();
window.ReadyForInput += new Action(info.OnReadyForInput);
return info;
});
}
开发者ID:CforED,项目名称:Node.js-Tools-for-Visual-Studio,代码行数:17,代码来源:InteractiveWindow.cs
注:本文中的VisualStudioApp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论