diff --git a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs index 27d233a5..5b1fad16 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/QueryExecution/ResultOnlyContext.cs @@ -15,10 +15,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution /// public class ResultOnlyContext : IEventSender { - private readonly RequestContext origContext; + private readonly RequestContext OrigContext; public ResultOnlyContext(RequestContext context) { - origContext = context; + OrigContext = context; } public virtual Task SendEvent(EventType eventType, TParams eventParams) @@ -27,5 +27,10 @@ namespace Microsoft.SqlTools.ServiceLayer.QueryExecution // in the future this could be used to roll up events and send them back in the result return Task.FromResult(true); } + + public virtual Task SendError(string errorMessage, int errorCode = 0) + { + return OrigContext.SendError(errorMessage, errorCode); + } } } \ No newline at end of file diff --git a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs index 802373da..67efcadd 100644 --- a/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs +++ b/test/Microsoft.SqlTools.ServiceLayer.UnitTests/QueryExecution/Execution/ServiceIntegrationTests.cs @@ -486,16 +486,10 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.QueryExecution.Execution await Task.WhenAll(queryService.ActiveSimpleExecuteRequests.Values); - var queries = queryService.ActiveQueries.Values.Take(2).ToArray(); - Query q1 = queries[0]; - Query q2 = queries[1]; - - Assert.NotNull(q1); - Assert.NotNull(q2); - - // wait on the task to finish - q1.ExecutionTask.Wait(); - q2.ExecutionTask.Wait(); + var queries = queryService.ActiveQueries.Values.ToArray(); + var queryTasks = queries.Select(query => query.ExecutionTask); + + await Task.WhenAll(queryTasks); efv1.Validate(); efv2.Validate();