public async Task ServiceReturnsSyntaxErrors() { // Send the 'didOpen' event await this.SendOpenFileEvent("TestFiles\\SimpleSyntaxError.ps1", false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = this.WaitForEvent(PublishDiagnosticsNotification.Type); // Was there a syntax error? Assert.NotEqual(0, diagnostics.Diagnostics.Length); Assert.False( string.IsNullOrEmpty(diagnostics.Diagnostics[0].Message)); }
public async Task ServiceReturnsNoErrorsForUsingRelativeModulePaths() { // Send the 'didOpen' event await this.SendOpenFileEvent("TestFiles\\Module.psm1", false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = await this.WaitForEvent( PublishDiagnosticsNotification.Type); // Was there a syntax error? Assert.Equal(0, diagnostics.Diagnostics.Length); }
public async Task ServiceReturnsNoErrorsForUsingRelativeModulePaths() { // Send the 'didOpen' event await this.SendOpenFileEvent(TestUtilities.NormalizePath("TestFiles/Module.psm1"), false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = await this.WaitForEvent( PublishDiagnosticsNotification.Type); // Was there a syntax error? Assert.Empty(diagnostics.Diagnostics); }
public async Task ServiceReturnsSemanticMarkers() { // Send the 'didOpen' event await this.SendOpenFileEvent("TestFiles\\SimpleSemanticError.ps1", false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = await this.WaitForEvent( PublishDiagnosticsNotification.Type); // Was there a semantic error? Assert.NotEqual(0, diagnostics.Diagnostics.Length); Assert.Contains("unapproved", diagnostics.Diagnostics[0].Message); }
public async Task ServiceReturnsSemanticMarkers() { // Send the 'didOpen' event await this.SendOpenFileEvent(TestUtilities.NormalizePath("TestFiles/SimpleSemanticError.ps1"), false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = await this.WaitForEvent( PublishDiagnosticsNotification.Type); // Was there a semantic error? Assert.NotEmpty(diagnostics.Diagnostics); Assert.Contains("unapproved", diagnostics.Diagnostics[0].Message); }
private Task HandlePublishDiagnosticsEvent( PublishDiagnosticsNotification diagnostics, EventContext eventContext) { string normalizedPath = diagnostics.Uri.ToLower(); this.cachedDiagnostics[normalizedPath] = diagnostics.Diagnostics .Select(GetMarkerFromDiagnostic) .ToArray(); this.OnDiagnosticsReceived(normalizedPath); return(Task.FromResult(true)); }
public async Task ServiceReturnsSyntaxErrors() { // Send the 'didOpen' event await this.SendOpenFileEvent(TestUtilities.NormalizePath("TestFiles/SimpleSyntaxError.ps1"), false); // Wait for the diagnostic event PublishDiagnosticsNotification diagnostics = await this.WaitForEvent( PublishDiagnosticsNotification.Type); // Was there a syntax error? Assert.NotEmpty(diagnostics.Diagnostics); Assert.False( string.IsNullOrEmpty(diagnostics.Diagnostics[0].Message)); }
private bool ValidateNotification(PublishDiagnosticsNotification notif, int errors, ref int countOfValidationCalls) { countOfValidationCalls++; Assert.True(notif.Diagnostics.Length == errors, $"Notification errors {notif.Diagnostics.Length} are not as expected {errors}"); return(true); }