OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2009 The Native Client Authors. All rights reserved. | |
3 * Use of this source code is governed by a BSD-style license that can | |
4 * be found in the LICENSE file. | |
5 */ | |
6 using System; | |
7 using EnvDTE; | |
8 using Microsoft.VisualStudio.TestTools.UnitTesting; | |
9 using Microsoft.VsSDK.IntegrationTestLibrary; | |
10 using Microsoft.VSSDK.Tools.VsIdeTesting; | |
11 | |
12 namespace IntegrationTests { | |
13 [TestClass] | |
14 public class VisualBasicProjectTests { | |
15 #region fields | |
16 | |
17 private delegate void ThreadInvoker(); | |
18 | |
19 #endregion | |
20 | |
21 #region properties | |
22 | |
23 /// <summary> | |
24 ///Gets or sets the test context which provides | |
25 ///information about and functionality for the current test run. | |
26 ///</summary> | |
27 public TestContext TestContext { get; set; } | |
28 | |
29 #endregion | |
30 | |
31 #region ctors | |
32 | |
33 #endregion | |
34 | |
35 #region Additional test attributes | |
36 | |
37 // | |
38 // You can use the following additional attributes as you write your tests: | |
39 // | |
40 // Use ClassInitialize to run code before running the first test in the clas
s | |
41 // [ClassInitialize()] | |
42 // public static void MyClassInitialize(TestContext testContext) { } | |
43 // | |
44 // Use ClassCleanup to run code after all tests in a class have run | |
45 // [ClassCleanup()] | |
46 // public static void MyClassCleanup() { } | |
47 // | |
48 // Use TestInitialize to run code before running each test | |
49 // [TestInitialize()] | |
50 // public void MyTestInitialize() { } | |
51 // | |
52 // Use TestCleanup to run code after each test has run | |
53 // [TestCleanup()] | |
54 // public void MyTestCleanup() { } | |
55 // | |
56 | |
57 #endregion | |
58 | |
59 [TestMethod] | |
60 public void VBWinformsApplication() { | |
61 UIThreadInvoker.Invoke((ThreadInvoker) delegate { | |
62 //Solution and project creation p
arameters | |
63 string solutionName = | |
64 "CreateVBWinformsApplication"
; | |
65 string projectName = | |
66 "VBWindowsApp"; | |
67 | |
68 //Template parameters | |
69 string language = "VisualBasic"; | |
70 string projectTemplateName = | |
71 "WindowsApplication.Zip"; | |
72 string itemTemplateName = | |
73 "CodeFile.zip"; | |
74 string newFileName = "Test.vb"; | |
75 | |
76 var dte = | |
77 (DTE) | |
78 VsIdeTestHostContext. | |
79 ServiceProvider. | |
80 GetService(typeof (DTE)); | |
81 | |
82 var testUtils = new TestUtils(); | |
83 | |
84 testUtils.CreateEmptySolution( | |
85 TestContext.TestDir, | |
86 solutionName); | |
87 Assert.AreEqual(0, | |
88 testUtils. | |
89 ProjectCount(
)); | |
90 | |
91 //Add new Windows application pr
oject to existing solution | |
92 testUtils. | |
93 CreateProjectFromTemplate( | |
94 projectName, | |
95 projectTemplateName, | |
96 language, | |
97 false); | |
98 | |
99 //Verify that the new project has
been added to the solution | |
100 Assert.AreEqual(1, | |
101 testUtils. | |
102 ProjectCount(
)); | |
103 | |
104 //Get the project | |
105 Project project = | |
106 dte.Solution.Item(1); | |
107 Assert.IsNotNull(project); | |
108 Assert.IsTrue( | |
109 string.Compare(project.Name, | |
110 projectName, | |
111 StringComparis
on | |
112 . | |
113 InvariantC
ultureIgnoreCase) == | |
114 0); | |
115 | |
116 //Verify Adding new code file to
project | |
117 ProjectItem newCodeFileItem = | |
118 testUtils. | |
119 AddNewItemFromVsTemplate( | |
120 project.ProjectItems, | |
121 itemTemplateName, | |
122 language, | |
123 newFileName); | |
124 Assert.IsNotNull( | |
125 newCodeFileItem, | |
126 "Could not create new project
item"); | |
127 }); | |
128 } | |
129 } | |
130 } | |
OLD | NEW |