本文整理匯總了C#中Microsoft.VsSDK.IntegrationTestLibrary.TestUtils.CreateProjectFromTemplate方法的典型用法代碼示例。如果您正苦於以下問題:C# TestUtils.CreateProjectFromTemplate方法的具體用法?C# TestUtils.CreateProjectFromTemplate怎麽用?C# TestUtils.CreateProjectFromTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Microsoft.VsSDK.IntegrationTestLibrary.TestUtils
的用法示例。
在下文中一共展示了TestUtils.CreateProjectFromTemplate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: VBWinformsApplication
public void VBWinformsApplication() {
UIThreadInvoker.Invoke((ThreadInvoker) delegate() {
//Solution and project creation parameters
var solutionName = "VBWinApp";
var projectName = "VBWinApp";
//Template parameters
var language = "VisualBasic";
var projectTemplateName = "WindowsApplication.Zip";
var itemTemplateName = "CodeFile.zip";
var newFileName = "Test.vb";
var dte = (DTE) VsIdeTestHostContext.ServiceProvider.GetService(typeof (DTE));
var testUtils = new TestUtils();
testUtils.CreateEmptySolution(TestContext.TestDir, solutionName);
Assert.AreEqual<int>(0, testUtils.ProjectCount());
//Add new Windows application project to existing solution
testUtils.CreateProjectFromTemplate(projectName, projectTemplateName, language, false);
//Verify that the new project has been added to the solution
Assert.AreEqual<int>(1, testUtils.ProjectCount());
//Get the project
var project = dte.Solution.Item(1);
Assert.IsNotNull(project);
Assert.IsTrue(string.Compare(project.Name, projectName, StringComparison.InvariantCultureIgnoreCase) == 0);
//Verify Adding new code file to project
var newCodeFileItem = testUtils.AddNewItemFromVsTemplate(project.ProjectItems, itemTemplateName, language, newFileName);
Assert.IsNotNull(newCodeFileItem, "Could not create new project item");
});
}