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