11using System . Collections . Generic ;
22using Microsoft . Test . Apex . Editor ;
3- using Microsoft . Test . Apex . VisualStudio . Solution ;
43using Microsoft . VisualStudio . TestTools . UnitTesting ;
54
65namespace Microsoft . Web . LibraryManager . IntegrationTest
76{
87 [ TestClass ]
98 public class LibmanCompletionTests : VisualStudioLibmanHostTest
109 {
11- ProjectItemTestExtension _libManConfig ;
12-
13- [ TestInitialize ( ) ]
14- public void initialize ( )
15- {
16- string projectName = "TestProjectCore20" ;
17-
18- ProjectTestExtension webProject = Solution . ProjectsRecursive [ projectName ] ;
19- _libManConfig = webProject . Find ( SolutionItemFind . FileName , "libman.json" ) ;
20- }
21-
2210 [ TestMethod ]
2311 public void LibmanCompletion_Destination ( )
2412 {
25- _libManConfig . Open ( ) ;
13+ _libmanConfig . Open ( ) ;
2614 string [ ] expectedCompletionEntries = new [ ] {
2715 "Properties/" ,
2816 "wwwroot/" ,
2917 } ;
3018
3119 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
32- Editor . Caret . MoveDown ( 2 ) ;
20+ Editor . Caret . MoveDown ( 1 ) ;
21+ Editor . KeyboardCommands . Type ( "{" ) ;
22+ Editor . KeyboardCommands . Enter ( ) ;
3323 Editor . KeyboardCommands . Type ( "\" destination\" :" ) ;
3424
3525 Helpers . Completion . WaitForCompletionEntries ( Editor , expectedCompletionEntries , caseInsensitive : true ) ;
@@ -38,7 +28,7 @@ public void LibmanCompletion_Destination()
3828 [ TestMethod ]
3929 public void LibmanCompletion_Provider ( )
4030 {
41- _libManConfig . Open ( ) ;
31+ _libmanConfig . Open ( ) ;
4232
4333 string [ ] expectedCompletionEntries = new [ ] {
4434 "cdnjs" ,
@@ -47,7 +37,9 @@ public void LibmanCompletion_Provider()
4737 } ;
4838
4939 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
50- Editor . Caret . MoveDown ( 2 ) ;
40+ Editor . Caret . MoveDown ( 1 ) ;
41+ Editor . KeyboardCommands . Type ( "{" ) ;
42+ Editor . KeyboardCommands . Enter ( ) ;
5143 Editor . KeyboardCommands . Type ( "\" provider\" :" ) ;
5244
5345 Helpers . Completion . WaitForCompletionEntries ( Editor , expectedCompletionEntries , caseInsensitive : true ) ;
@@ -56,7 +48,7 @@ public void LibmanCompletion_Provider()
5648 [ TestMethod ]
5749 public void LibmanCompletion_DefaultProvider ( )
5850 {
59- _libManConfig . Open ( ) ;
51+ _libmanConfig . Open ( ) ;
6052
6153 string [ ] expectedCompletionEntries = new [ ] {
6254 "cdnjs" ,
@@ -75,7 +67,7 @@ public void LibmanCompletion_DefaultProvider()
7567 [ TestMethod ]
7668 public void LibmanCompletion_DefaultDestination ( )
7769 {
78- _libManConfig . Open ( ) ;
70+ _libmanConfig . Open ( ) ;
7971 string [ ] expectedCompletionEntries = new [ ] {
8072 "Properties/" ,
8173 "wwwroot/" ,
@@ -92,13 +84,15 @@ public void LibmanCompletion_DefaultDestination()
9284 [ TestMethod ]
9385 public void LibmanCompletion_LibraryForCdnjs ( )
9486 {
95- _libManConfig . Open ( ) ;
87+ _libmanConfig . Open ( ) ;
9688 string [ ] expectedCompletionEntries = new [ ] {
9789 "jquery" ,
9890 } ;
9991
10092 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
101- Editor . Caret . MoveDown ( 2 ) ;
93+ Editor . Caret . MoveDown ( 1 ) ;
94+ Editor . KeyboardCommands . Type ( "{" ) ;
95+ Editor . KeyboardCommands . Enter ( ) ;
10296 Editor . KeyboardCommands . Type ( "\" provider\" : \" cdnjs\" ," ) ;
10397 Editor . KeyboardCommands . Enter ( ) ;
10498
@@ -109,10 +103,12 @@ public void LibmanCompletion_LibraryForCdnjs()
109103 [ TestMethod ]
110104 public void LibmanCompletion_LibraryVersionForCdnjs ( )
111105 {
112- _libManConfig . Open ( ) ;
106+ _libmanConfig . Open ( ) ;
113107
114108 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
115- Editor . Caret . MoveDown ( 2 ) ;
109+ Editor . Caret . MoveDown ( 1 ) ;
110+ Editor . KeyboardCommands . Type ( "{" ) ;
111+ Editor . KeyboardCommands . Enter ( ) ;
116112 Editor . KeyboardCommands . Type ( "\" provider\" : \" cdnjs\" ," ) ;
117113 Editor . KeyboardCommands . Enter ( ) ;
118114
@@ -126,14 +122,16 @@ public void LibmanCompletion_LibraryVersionForCdnjs()
126122 [ TestMethod ]
127123 public void LibmanCompletion_LibraryForFilesystem ( )
128124 {
129- _libManConfig . Open ( ) ;
125+ _libmanConfig . Open ( ) ;
130126 string [ ] expectedCompletionEntries = new [ ] {
131127 "Properties/" ,
132128 "wwwroot/" ,
133129 } ;
134130
135131 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
136- Editor . Caret . MoveDown ( 2 ) ;
132+ Editor . Caret . MoveDown ( 1 ) ;
133+ Editor . KeyboardCommands . Type ( "{" ) ;
134+ Editor . KeyboardCommands . Enter ( ) ;
137135 Editor . KeyboardCommands . Type ( "\" provider\" : \" filesystem\" ," ) ;
138136 Editor . KeyboardCommands . Enter ( ) ;
139137
@@ -144,28 +142,34 @@ public void LibmanCompletion_LibraryForFilesystem()
144142 [ TestMethod ]
145143 public void LibmanCompletion_LibraryForUnpkg ( )
146144 {
147- _libManConfig . Open ( ) ;
148- string [ ] expectedCompletionEntries = new [ ] {
149- "bootstrap" ,
150- "jquery" ,
151- } ;
145+ // This test needs to be updated once we fix https://github.com/aspnet/LibraryManager/issues/221
146+ _libmanConfig . Open ( ) ;
152147
153148 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
154- Editor . Caret . MoveDown ( 2 ) ;
149+ Editor . Caret . MoveDown ( 1 ) ;
150+ Editor . KeyboardCommands . Type ( "{" ) ;
151+ Editor . KeyboardCommands . Enter ( ) ;
155152 Editor . KeyboardCommands . Type ( "\" provider\" : \" unpkg\" ," ) ;
156153 Editor . KeyboardCommands . Enter ( ) ;
157154
158155 Editor . KeyboardCommands . Type ( "\" library\" :" ) ;
159- Helpers . Completion . WaitForCompletionEntries ( Editor , expectedCompletionEntries , caseInsensitive : true , timeout : 5000 ) ;
156+ Editor . KeyboardCommands . Type ( "bootstr" ) ;
157+ Helpers . Completion . WaitForCompletionEntries ( Editor , new [ ] { "bootstrap" } , caseInsensitive : true , timeout : 5000 ) ;
158+
159+ Editor . KeyboardCommands . Backspace ( 7 ) ;
160+ Editor . KeyboardCommands . Type ( "jqu" ) ;
161+ Helpers . Completion . WaitForCompletionEntries ( Editor , new [ ] { "jquery" } , caseInsensitive : true , timeout : 5000 ) ;
160162 }
161163
162164 [ TestMethod ]
163165 public void LibmanCompletion_CompletionForBackSpace ( )
164166 {
165- _libManConfig . Open ( ) ;
167+ _libmanConfig . Open ( ) ;
166168
167169 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
168- Editor . Caret . MoveDown ( 2 ) ;
170+ Editor . Caret . MoveDown ( 1 ) ;
171+ Editor . KeyboardCommands . Type ( "{" ) ;
172+ Editor . KeyboardCommands . Enter ( ) ;
169173 Editor . KeyboardCommands . Type ( "\" provider\" : \" cdnjs\" ," ) ;
170174 Editor . KeyboardCommands . Enter ( ) ;
171175
@@ -179,10 +183,12 @@ public void LibmanCompletion_CompletionForBackSpace()
179183 [ TestMethod ]
180184 public void LibmanCompletion_VersionCompletionInDescendingOrder ( )
181185 {
182- _libManConfig . Open ( ) ;
186+ _libmanConfig . Open ( ) ;
183187
184188 Editor . Caret . MoveToExpression ( "\" libraries\" " ) ;
185- Editor . Caret . MoveDown ( 2 ) ;
189+ Editor . Caret . MoveDown ( 1 ) ;
190+ Editor . KeyboardCommands . Type ( "{" ) ;
191+ Editor . KeyboardCommands . Enter ( ) ;
186192 Editor . KeyboardCommands . Type ( "\" provider\" : \" unpkg\" ," ) ;
187193 Editor . KeyboardCommands . Enter ( ) ;
188194
@@ -200,7 +206,7 @@ public void LibmanCompletion_VersionCompletionInDescendingOrder()
200206 semanticVersions . Add ( SemanticVersion . Parse ( item . Text ) ) ;
201207 }
202208
203- for ( int i = 1 ; i < semanticVersions . Count ; ++ i )
209+ for ( int i = 1 ; i < semanticVersions . Count ; ++ i )
204210 {
205211 Assert . IsTrue ( semanticVersions [ i ] . CompareTo ( semanticVersions [ i - 1 ] ) <= 0 ) ;
206212 }
0 commit comments