Use MemoryStream instead of stdout for outgoing messages during integration tests (#1696)

* filter

* test

* run all

* Redirect to memorystream

* revert temp changes
This commit is contained in:
Charles Gagnon
2022-09-16 15:38:53 -07:00
committed by GitHub
parent 006ac60923
commit 019481e8db
6 changed files with 24 additions and 15 deletions

View File

@@ -40,6 +40,7 @@ using Microsoft.SqlTools.ServiceLayer.ModelManagement;
using Microsoft.SqlTools.ServiceLayer.TableDesigner;
using Microsoft.SqlTools.ServiceLayer.AzureBlob;
using Microsoft.SqlTools.ServiceLayer.ExecutionPlan;
using System.IO;
namespace Microsoft.SqlTools.ServiceLayer
{
@@ -52,7 +53,7 @@ namespace Microsoft.SqlTools.ServiceLayer
private static object lockObject = new object();
private static bool isLoaded;
internal static ServiceHost CreateAndStartServiceHost(SqlToolsContext sqlToolsContext)
internal static ServiceHost CreateAndStartServiceHost(SqlToolsContext sqlToolsContext, Stream? inputStream = null, Stream? outputStream = null)
{
ServiceHost serviceHost = ServiceHost.Instance;
lock (lockObject)
@@ -60,7 +61,7 @@ namespace Microsoft.SqlTools.ServiceLayer
if (!isLoaded)
{
// Grab the instance of the service host
serviceHost.Initialize();
serviceHost.Initialize(inputStream, outputStream);
InitializeRequestHandlersAndServices(serviceHost, sqlToolsContext);