mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-07 01:25:41 -05:00
Output verbose logging during tests (#1698)
* Output verbose logging during tests * fix compile
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -17,6 +18,7 @@ using Microsoft.SqlTools.ServiceLayer.ObjectExplorer;
|
||||
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||
using Microsoft.SqlTools.ServiceLayer.SqlContext;
|
||||
using Microsoft.SqlTools.ServiceLayer.Workspace;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
@@ -85,7 +87,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a query by calling the services directly (not using the test driver)
|
||||
/// Runs a query by calling the services directly (not using the test driver)
|
||||
/// </summary>
|
||||
public void RunQuery(TestServerType serverType, string databaseName, string queryText, bool throwOnError = false)
|
||||
{
|
||||
@@ -94,7 +96,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Runs a query by calling the services directly (not using the test driver)
|
||||
/// Runs a query by calling the services directly (not using the test driver)
|
||||
/// </summary>
|
||||
public async Task RunQueryAsync(TestServerType serverType, string databaseName, string queryText, bool throwOnError = false)
|
||||
{
|
||||
@@ -185,13 +187,18 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Common
|
||||
const string hostProfileId = "SQLToolsTestService";
|
||||
Version hostVersion = new Version(1, 0);
|
||||
|
||||
// set up the host details and profile paths
|
||||
// set up the host details and profile paths
|
||||
var hostDetails = new HostDetails(hostName, hostProfileId, hostVersion);
|
||||
SqlToolsContext sqlToolsContext = new SqlToolsContext(hostDetails);
|
||||
|
||||
// Initialize the ServiceHost, using a MemoryStream for the output stream so that we don't fill up the logs
|
||||
// with a bunch of outgoing messages (which aren't used for anything during tests)
|
||||
ServiceHost serviceHost = HostLoader.CreateAndStartServiceHost(sqlToolsContext, null, new MemoryStream());
|
||||
|
||||
// Set up our logger to write to Console for tests to help debug issues
|
||||
Logger.Initialize(autoFlush: true);
|
||||
Logger.TracingLevel = System.Diagnostics.SourceLevels.All;
|
||||
Logger.TraceSource.Listeners.Add(new ConsoleTraceListener());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user