@@ -20,12 +20,12 @@ public class ScenarioTests : IDisposable
20
20
{
21
21
private int messageId = 0 ;
22
22
23
- private LanguageServiceManager languageServiceManager =
23
+ private LanguageServiceManager languageServiceManager =
24
24
new LanguageServiceManager ( ) ;
25
25
26
- private MessageReader MessageReader
27
- {
28
- get { return this . languageServiceManager . MessageReader ; }
26
+ private MessageReader MessageReader
27
+ {
28
+ get { return this . languageServiceManager . MessageReader ; }
29
29
}
30
30
31
31
private MessageWriter MessageWriter
@@ -109,7 +109,7 @@ await this.SendRequest(
109
109
Assert . Equal ( "string" , consoleFileNameItem . Detail ) ;
110
110
}
111
111
112
- [ Fact ( Skip = "Skipped until variable documentation gathering is added back." ) ]
112
+ [ Fact ( Skip = "Skipped until variable documentation gathering is added back." ) ]
113
113
public async Task CompletesDetailOnVariableDocSuggestion ( )
114
114
{
115
115
//await this.SendOpenFileEvent("TestFiles\\CompleteFunctionName.ps1");
@@ -429,51 +429,62 @@ await this.SendRequestWithoutWait(
429
429
Assert . Equal ( "stdout" , outputEvent . Category ) ;
430
430
}
431
431
432
+ [ Fact ]
433
+ public async Task ServiceExpandsAliases ( )
434
+ {
435
+ string expandedText =
436
+ await this . SendRequest (
437
+ ExpandAliasRequest . Type ,
438
+ "gci\r \n pwd" ) ;
439
+
440
+ Assert . Equal ( "Get-ChildItem\r \n Get-Location" , expandedText ) ;
441
+ }
442
+
432
443
[ Fact ] //(Skip = "Choice prompt functionality is currently in transition to a new model.")]
433
444
public async Task ServiceExecutesReplCommandAndReceivesChoicePrompt ( )
434
445
{
435
446
// TODO: This test is removed until a new choice prompt strategy is determined.
436
447
437
- // string choiceScript =
438
- // @"
439
- // $caption = ""Test Choice"";
440
- // $message = ""Make a selection"";
441
- // $choiceA = new-Object System.Management.Automation.Host.ChoiceDescription ""&A"",""A"";
442
- // $choiceB = new-Object System.Management.Automation.Host.ChoiceDescription ""&B"",""B"";
443
- // $choices = [System.Management.Automation.Host.ChoiceDescription[]]($choiceA,$choiceB);
444
- // $response = $host.ui.PromptForChoice($caption, $message, $choices, 1)
445
- // $response";
446
-
447
- // await this.MessageWriter.WriteMessage(
448
- // new ReplExecuteRequest
449
- // {
450
- // Arguments = new ReplExecuteArgs
451
- // {
452
- // CommandString = choiceScript
453
- // }
454
- // });
455
-
456
- // // Wait for the choice prompt event and check expected values
457
- // ReplPromptChoiceEvent replPromptChoiceEvent = this.WaitForMessage<ReplPromptChoiceEvent>();
458
- // Assert.Equal(1, replPromptChoiceEvent.Body.DefaultChoice);
459
-
460
- // // Respond to the prompt event
461
- // await this.MessageWriter.WriteMessage(
462
- // new ReplPromptChoiceResponse
463
- // {
464
- // Body = new ReplPromptChoiceResponseBody
465
- // {
466
- // Choice = 0
467
- // }
468
- // });
469
-
470
- // // Wait for the selection to appear as output
471
- // ReplWriteOutputEvent replWriteLineEvent = this.WaitForMessage<ReplWriteOutputEvent>();
472
- // Assert.Equal("0", replWriteLineEvent.Body.LineContents);
448
+ // string choiceScript =
449
+ // @"
450
+ // $caption = ""Test Choice"";
451
+ // $message = ""Make a selection"";
452
+ // $choiceA = new-Object System.Management.Automation.Host.ChoiceDescription ""&A"",""A"";
453
+ // $choiceB = new-Object System.Management.Automation.Host.ChoiceDescription ""&B"",""B"";
454
+ // $choices = [System.Management.Automation.Host.ChoiceDescription[]]($choiceA,$choiceB);
455
+ // $response = $host.ui.PromptForChoice($caption, $message, $choices, 1)
456
+ // $response";
457
+
458
+ // await this.MessageWriter.WriteMessage(
459
+ // new ReplExecuteRequest
460
+ // {
461
+ // Arguments = new ReplExecuteArgs
462
+ // {
463
+ // CommandString = choiceScript
464
+ // }
465
+ // });
466
+
467
+ // // Wait for the choice prompt event and check expected values
468
+ // ReplPromptChoiceEvent replPromptChoiceEvent = this.WaitForMessage<ReplPromptChoiceEvent>();
469
+ // Assert.Equal(1, replPromptChoiceEvent.Body.DefaultChoice);
470
+
471
+ // // Respond to the prompt event
472
+ // await this.MessageWriter.WriteMessage(
473
+ // new ReplPromptChoiceResponse
474
+ // {
475
+ // Body = new ReplPromptChoiceResponseBody
476
+ // {
477
+ // Choice = 0
478
+ // }
479
+ // });
480
+
481
+ // // Wait for the selection to appear as output
482
+ // ReplWriteOutputEvent replWriteLineEvent = this.WaitForMessage<ReplWriteOutputEvent>();
483
+ // Assert.Equal("0", replWriteLineEvent.Body.LineContents);
473
484
}
474
485
475
486
private async Task < TResult > SendRequest < TParams , TResult , TError > (
476
- RequestType < TParams , TResult , TError > requestType ,
487
+ RequestType < TParams , TResult , TError > requestType ,
477
488
TParams requestParams )
478
489
{
479
490
await this . SendRequestWithoutWait ( requestType , requestParams ) ;
@@ -491,7 +502,7 @@ await this.MessageWriter.WriteMessage(
491
502
this . messageId . ToString ( ) ,
492
503
requestType . TypeName ,
493
504
JToken . FromObject ( requestParams ) ) ) ;
494
- }
505
+ }
495
506
496
507
private async Task SendEvent < TParams > ( EventType < TParams > eventType , TParams eventParams )
497
508
{
@@ -506,9 +517,9 @@ private async Task SendOpenFileEvent(string filePath, bool waitForDiagnostics =
506
517
string fileContents = string . Join ( Environment . NewLine , File . ReadAllLines ( filePath ) ) ;
507
518
508
519
await this . SendEvent (
509
- DidOpenTextDocumentNotification . Type ,
510
- new DidOpenTextDocumentNotification ( )
511
- {
520
+ DidOpenTextDocumentNotification . Type ,
521
+ new DidOpenTextDocumentNotification ( )
522
+ {
512
523
Uri = filePath ,
513
524
Text = fileContents
514
525
} ) ;
@@ -535,7 +546,7 @@ private TParams WaitForEvent<TParams>(EventType<TParams> eventType)
535
546
}
536
547
537
548
private TResult WaitForResponse < TParams , TResult , TError > (
538
- RequestType < TParams , TResult , TError > requestType ,
549
+ RequestType < TParams , TResult , TError > requestType ,
539
550
int expectedId )
540
551
{
541
552
// TODO: Integrate timeout!
0 commit comments