mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-16 17:23:38 -05:00
Added test driver program for service host (#113)
* Added test driver program for service host * Fix typo
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.SqlTools.ServiceLayer.TestDriver.Driver;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
|
||||
{
|
||||
public class ExampleTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Example test that performs a connect, then disconnect.
|
||||
/// All tests must have the same signature of returning an async Task
|
||||
/// and taking in a ServiceTestDriver as a parameter.
|
||||
/// </summary>
|
||||
public async Task ConnectDisconnectTest(ServiceTestDriver driver)
|
||||
{
|
||||
var connectParams = new ConnectParams();
|
||||
connectParams.OwnerUri = "file";
|
||||
connectParams.Connection = new ConnectionDetails();
|
||||
connectParams.Connection.ServerName = "localhost";
|
||||
connectParams.Connection.AuthenticationType = "Integrated";
|
||||
|
||||
var result = await driver.SendRequest(ConnectionRequest.Type, connectParams);
|
||||
if (result)
|
||||
{
|
||||
await driver.WaitForEvent(ConnectionCompleteNotification.Type);
|
||||
|
||||
var disconnectParams = new DisconnectParams();
|
||||
disconnectParams.OwnerUri = "file";
|
||||
var result2 = await driver.SendRequest(DisconnectRequest.Type, disconnectParams);
|
||||
if (result2)
|
||||
{
|
||||
Console.WriteLine("success");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user