Commit
This commit is contained in:
		
							parent
							
								
									8b61ca41fa
								
							
						
					
					
						commit
						17883e16e1
					
				
					 41 changed files with 3173 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -0,0 +1,109 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Microsoft.VsSDK.IntegrationTestLibrary;
 | 
			
		||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
 | 
			
		||||
using EnvDTE;
 | 
			
		||||
using System.IO;
 | 
			
		||||
 | 
			
		||||
namespace VSPackageInstall_IntegrationTests.IntegrationTests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class CPPProjectTests
 | 
			
		||||
    {
 | 
			
		||||
        #region fields
 | 
			
		||||
        private delegate void ThreadInvoker();
 | 
			
		||||
        private TestContext _testContext;
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region properties
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///Gets or sets the test context which provides
 | 
			
		||||
        ///information about and functionality for the current test run.
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        public TestContext TestContext
 | 
			
		||||
        {
 | 
			
		||||
            get { return _testContext; }
 | 
			
		||||
            set { _testContext = value; }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region ctors
 | 
			
		||||
        public CPPProjectTests()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Additional test attributes
 | 
			
		||||
        //
 | 
			
		||||
        // You can use the following additional attributes as you write your tests:
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassInitialize to run code before running the first test in the class
 | 
			
		||||
        // [ClassInitialize()]
 | 
			
		||||
        // public static void MyClassInitialize(TestContext testContext) { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassCleanup to run code after all tests in a class have run
 | 
			
		||||
        // [ClassCleanup()]
 | 
			
		||||
        // public static void MyClassCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestInitialize to run code before running each test 
 | 
			
		||||
        // [TestInitialize()]
 | 
			
		||||
        // public void MyTestInitialize() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestCleanup to run code after each test has run
 | 
			
		||||
        // [TestCleanup()]
 | 
			
		||||
        // public void MyTestCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        [HostType("VS IDE")]
 | 
			
		||||
        [TestMethod]
 | 
			
		||||
        public void CPPWinformsApplication()
 | 
			
		||||
        {
 | 
			
		||||
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
 | 
			
		||||
            {
 | 
			
		||||
                //Solution and project creation parameters
 | 
			
		||||
                string solutionName = "CPPWinApp";
 | 
			
		||||
                string projectName = "CPPWinApp";
 | 
			
		||||
 | 
			
		||||
                //Template parameters
 | 
			
		||||
                string projectType = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";
 | 
			
		||||
                string projectTemplateName = Path.Combine("vcNet", "mc++appwiz.vsz");
 | 
			
		||||
 | 
			
		||||
                string itemTemplateName = "newc++file.cpp";
 | 
			
		||||
                string newFileName = "Test.cpp";
 | 
			
		||||
 | 
			
		||||
                DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
 | 
			
		||||
 | 
			
		||||
                TestUtils testUtils = new TestUtils();
 | 
			
		||||
 | 
			
		||||
                testUtils.CreateEmptySolution(TestContext.TestDir, solutionName);
 | 
			
		||||
                Assert.AreEqual<int>(0, testUtils.ProjectCount());
 | 
			
		||||
 | 
			
		||||
                //Add new CPP Windows application project to existing solution
 | 
			
		||||
                string solutionDirectory = Directory.GetParent(dte.Solution.FullName).FullName;
 | 
			
		||||
                string projectDirectory = TestUtils.GetNewDirectoryName(solutionDirectory, projectName);
 | 
			
		||||
                string projectTemplatePath = Path.Combine(dte.Solution.get_TemplatePath(projectType), projectTemplateName);
 | 
			
		||||
                Assert.IsTrue(File.Exists(projectTemplatePath), string.Format("Could not find template file: {0}", projectTemplatePath));
 | 
			
		||||
                dte.Solution.AddFromTemplate(projectTemplatePath, projectDirectory, projectName, false);
 | 
			
		||||
 | 
			
		||||
                //Verify that the new project has been added to the solution
 | 
			
		||||
                Assert.AreEqual<int>(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
 | 
			
		||||
                string newItemTemplatePath = Path.Combine(dte.Solution.ProjectItemsTemplatePath(projectType), itemTemplateName);
 | 
			
		||||
                Assert.IsTrue(File.Exists(newItemTemplatePath));
 | 
			
		||||
                ProjectItem item = project.ProjectItems.AddFromTemplate(newItemTemplatePath, newFileName);
 | 
			
		||||
                Assert.IsNotNull(item);
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,83 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Microsoft.VsSDK.IntegrationTestLibrary;
 | 
			
		||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
 | 
			
		||||
 | 
			
		||||
namespace VSPackageInstall_IntegrationTests.IntegrationTests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class CSharpProjectTests
 | 
			
		||||
    {
 | 
			
		||||
        #region fields
 | 
			
		||||
        private delegate void ThreadInvoker();
 | 
			
		||||
        private TestContext _testContext;
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region properties
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///Gets or sets the test context which provides
 | 
			
		||||
        ///information about and functionality for the current test run.
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        public TestContext TestContext
 | 
			
		||||
        {
 | 
			
		||||
            get { return _testContext; }
 | 
			
		||||
            set { _testContext = value; }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region ctors
 | 
			
		||||
        public CSharpProjectTests()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Additional test attributes
 | 
			
		||||
        //
 | 
			
		||||
        // You can use the following additional attributes as you write your tests:
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassInitialize to run code before running the first test in the class
 | 
			
		||||
        // [ClassInitialize()]
 | 
			
		||||
        // public static void MyClassInitialize(TestContext testContext) { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassCleanup to run code after all tests in a class have run
 | 
			
		||||
        // [ClassCleanup()]
 | 
			
		||||
        // public static void MyClassCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestInitialize to run code before running each test 
 | 
			
		||||
        // [TestInitialize()]
 | 
			
		||||
        // public void MyTestInitialize() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestCleanup to run code after each test has run
 | 
			
		||||
        // [TestCleanup()]
 | 
			
		||||
        // public void MyTestCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        [TestMethod]
 | 
			
		||||
        [HostType("VS IDE")]
 | 
			
		||||
        public void WinformsApplication()
 | 
			
		||||
        {
 | 
			
		||||
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
 | 
			
		||||
            {
 | 
			
		||||
                TestUtils testUtils = new TestUtils();
 | 
			
		||||
 | 
			
		||||
                testUtils.CreateEmptySolution(TestContext.TestDir, "CSWinApp");
 | 
			
		||||
                Assert.AreEqual<int>(0, testUtils.ProjectCount());
 | 
			
		||||
 | 
			
		||||
                //Create Winforms application project
 | 
			
		||||
                //TestUtils.CreateProjectFromTemplate("MyWindowsApp", "Windows Application", "CSharp", false);
 | 
			
		||||
                //Assert.AreEqual<int>(1, TestUtils.ProjectCount());
 | 
			
		||||
 | 
			
		||||
                //TODO Verify that we can debug launch the application
 | 
			
		||||
 | 
			
		||||
                //TODO Set Break point and verify that will hit
 | 
			
		||||
 | 
			
		||||
                //TODO Verify Adding new project item to project
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,55 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.VisualStudio.Shell.Interop;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
 | 
			
		||||
using EnvDTE;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using Microsoft.VsSDK.IntegrationTestLibrary;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
namespace VSPackageInstall_IntegrationTests.IntegrationTests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class SolutionTests
 | 
			
		||||
    {
 | 
			
		||||
        #region fields
 | 
			
		||||
        private delegate void ThreadInvoker();
 | 
			
		||||
        private TestContext _testContext;
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region properties
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///Gets or sets the test context which provides
 | 
			
		||||
        ///information about and functionality for the current test run.
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        public TestContext TestContext
 | 
			
		||||
        {
 | 
			
		||||
            get { return _testContext; }
 | 
			
		||||
            set { _testContext = value; }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        #region ctors
 | 
			
		||||
        public SolutionTests()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        [TestMethod]
 | 
			
		||||
        [HostType("VS IDE")]
 | 
			
		||||
        public void CreateEmptySolution()
 | 
			
		||||
        {
 | 
			
		||||
            UIThreadInvoker.Invoke((ThreadInvoker)delegate()
 | 
			
		||||
            {
 | 
			
		||||
                TestUtils testUtils = new TestUtils();
 | 
			
		||||
                testUtils.CloseCurrentSolution(__VSSLNSAVEOPTIONS.SLNSAVEOPT_NoSave);
 | 
			
		||||
                testUtils.CreateEmptySolution(TestContext.TestDir, "EmptySolution");
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,101 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Text;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
 | 
			
		||||
using Microsoft.VsSDK.IntegrationTestLibrary;
 | 
			
		||||
using Microsoft.VSSDK.Tools.VsIdeTesting;
 | 
			
		||||
using EnvDTE;
 | 
			
		||||
 | 
			
		||||
namespace VSPackageInstall_IntegrationTests.IntegrationTests
 | 
			
		||||
{
 | 
			
		||||
    [TestClass]
 | 
			
		||||
    public class VisualBasicProjectTests
 | 
			
		||||
    {
 | 
			
		||||
        #region fields
 | 
			
		||||
        private delegate void ThreadInvoker();
 | 
			
		||||
        private TestContext _testContext;
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region properties
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        ///Gets or sets the test context which provides
 | 
			
		||||
        ///information about and functionality for the current test run.
 | 
			
		||||
        ///</summary>
 | 
			
		||||
        public TestContext TestContext
 | 
			
		||||
        {
 | 
			
		||||
            get { return _testContext; }
 | 
			
		||||
            set { _testContext = value; }
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region ctors
 | 
			
		||||
        public VisualBasicProjectTests()
 | 
			
		||||
        {
 | 
			
		||||
        }
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region Additional test attributes
 | 
			
		||||
        //
 | 
			
		||||
        // You can use the following additional attributes as you write your tests:
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassInitialize to run code before running the first test in the class
 | 
			
		||||
        // [ClassInitialize()]
 | 
			
		||||
        // public static void MyClassInitialize(TestContext testContext) { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use ClassCleanup to run code after all tests in a class have run
 | 
			
		||||
        // [ClassCleanup()]
 | 
			
		||||
        // public static void MyClassCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestInitialize to run code before running each test 
 | 
			
		||||
        // [TestInitialize()]
 | 
			
		||||
        // public void MyTestInitialize() { }
 | 
			
		||||
        //
 | 
			
		||||
        // Use TestCleanup to run code after each test has run
 | 
			
		||||
        // [TestCleanup()]
 | 
			
		||||
        // public void MyTestCleanup() { }
 | 
			
		||||
        //
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        [HostType("VS IDE")]
 | 
			
		||||
        [TestMethod]
 | 
			
		||||
        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";
 | 
			
		||||
 | 
			
		||||
                DTE dte = (DTE)VsIdeTestHostContext.ServiceProvider.GetService(typeof(DTE));
 | 
			
		||||
 | 
			
		||||
                TestUtils 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
 | 
			
		||||
                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");
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue