@@ -20,12 +20,12 @@ public class ScenarioTests : IDisposable
2020 {
2121 private int messageId = 0 ;
2222
23- private LanguageServiceManager languageServiceManager =
23+ private LanguageServiceManager languageServiceManager =
2424 new LanguageServiceManager ( ) ;
2525
26- private MessageReader MessageReader
27- {
28- get { return this . languageServiceManager . MessageReader ; }
26+ private MessageReader MessageReader
27+ {
28+ get { return this . languageServiceManager . MessageReader ; }
2929 }
3030
3131 private MessageWriter MessageWriter
@@ -109,7 +109,7 @@ await this.SendRequest(
109109 Assert . Equal ( "string" , consoleFileNameItem . Detail ) ;
110110 }
111111
112- [ Fact ( Skip = "Skipped until variable documentation gathering is added back." ) ]
112+ [ Fact ( Skip = "Skipped until variable documentation gathering is added back." ) ]
113113 public async Task CompletesDetailOnVariableDocSuggestion ( )
114114 {
115115 //await this.SendOpenFileEvent("TestFiles\\CompleteFunctionName.ps1");
@@ -429,51 +429,62 @@ await this.SendRequestWithoutWait(
429429 Assert . Equal ( "stdout" , outputEvent . Category ) ;
430430 }
431431
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+
432443 [ Fact ] //(Skip = "Choice prompt functionality is currently in transition to a new model.")]
433444 public async Task ServiceExecutesReplCommandAndReceivesChoicePrompt ( )
434445 {
435446 // TODO: This test is removed until a new choice prompt strategy is determined.
436447
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);
473484 }
474485
475486 private async Task < TResult > SendRequest < TParams , TResult , TError > (
476- RequestType < TParams , TResult , TError > requestType ,
487+ RequestType < TParams , TResult , TError > requestType ,
477488 TParams requestParams )
478489 {
479490 await this . SendRequestWithoutWait ( requestType , requestParams ) ;
@@ -491,7 +502,7 @@ await this.MessageWriter.WriteMessage(
491502 this . messageId . ToString ( ) ,
492503 requestType . TypeName ,
493504 JToken . FromObject ( requestParams ) ) ) ;
494- }
505+ }
495506
496507 private async Task SendEvent < TParams > ( EventType < TParams > eventType , TParams eventParams )
497508 {
@@ -506,9 +517,9 @@ private async Task SendOpenFileEvent(string filePath, bool waitForDiagnostics =
506517 string fileContents = string . Join ( Environment . NewLine , File . ReadAllLines ( filePath ) ) ;
507518
508519 await this . SendEvent (
509- DidOpenTextDocumentNotification . Type ,
510- new DidOpenTextDocumentNotification ( )
511- {
520+ DidOpenTextDocumentNotification . Type ,
521+ new DidOpenTextDocumentNotification ( )
522+ {
512523 Uri = filePath ,
513524 Text = fileContents
514525 } ) ;
@@ -535,7 +546,7 @@ private TParams WaitForEvent<TParams>(EventType<TParams> eventType)
535546 }
536547
537548 private TResult WaitForResponse < TParams , TResult , TError > (
538- RequestType < TParams , TResult , TError > requestType ,
549+ RequestType < TParams , TResult , TError > requestType ,
539550 int expectedId )
540551 {
541552 // TODO: Integrate timeout!
0 commit comments