mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Fixed a few minor errors from the last commit
This commit is contained in:
@@ -3,12 +3,13 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
|
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.Hosting.Protocol;
|
||||||
using Microsoft.SqlTools.Test.Utility;
|
using Microsoft.SqlTools.Test.Utility;
|
||||||
using Moq;
|
using Moq;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
||||||
@@ -27,11 +28,11 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
|||||||
{
|
{
|
||||||
// connect to a database instance
|
// connect to a database instance
|
||||||
string ownerUri = "file://my/sample/file.sql";
|
string ownerUri = "file://my/sample/file.sql";
|
||||||
var connectionResult =
|
var connectionResult =
|
||||||
TestObjects.GetTestConnectionService()
|
TestObjects.GetTestConnectionService()
|
||||||
.Connect(new ConnectParams()
|
.Connect(new ConnectParams()
|
||||||
{
|
{
|
||||||
OwnerUri = ownerUri,
|
OwnerUri = ownerUri,
|
||||||
Connection = TestObjects.GetTestConnectionDetails()
|
Connection = TestObjects.GetTestConnectionDetails()
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -64,42 +65,42 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
|||||||
}
|
}
|
||||||
|
|
||||||
//[Fact]
|
//[Fact]
|
||||||
//public void TestConnectRequestRegistersOwner()
|
//public void TestConnectRequestRegistersOwner()
|
||||||
//{
|
//{
|
||||||
// // Given a request to connect to a database
|
// // Given a request to connect to a database
|
||||||
// var service = new ConnectionService(new TestSqlConnectionFactory());
|
// var service = new ConnectionService(new TestSqlConnectionFactory());
|
||||||
// ConnectionDetails connectionDetails = TestObjects.GetTestConnectionDetails();
|
// ConnectionDetails connectionDetails = TestObjects.GetTestConnectionDetails();
|
||||||
// var connectParams = new ConnectParams()
|
// var connectParams = new ConnectParams()
|
||||||
// {
|
// {
|
||||||
// OwnerUri = "file://path/to/my.sql",
|
// OwnerUri = "file://path/to/my.sql",
|
||||||
// Connection = connectionDetails
|
// Connection = connectionDetails
|
||||||
// };
|
// };
|
||||||
|
|
||||||
// var endpoint = new Mock<IProtocolEndpoint>();
|
// var endpoint = new Mock<IProtocolEndpoint>();
|
||||||
// Func<ConnectParams, RequestContext<ConnectResponse>, Task> connectRequestHandler = null;
|
// Func<ConnectParams, RequestContext<ConnectResponse>, Task> connectRequestHandler = null;
|
||||||
// endpoint.Setup(e => e.SetRequestHandler(ConnectionRequest.Type, It.IsAny<Func<ConnectParams, RequestContext<ConnectResponse>, Task>>()))
|
// endpoint.Setup(e => e.SetRequestHandler(ConnectionRequest.Type, It.IsAny<Func<ConnectParams, RequestContext<ConnectResponse>, Task>>()))
|
||||||
// .Callback<Func<ConnectParams, RequestContext<ConnectResponse>, Task>>(handler => connectRequestHandler = handler);
|
// .Callback<Func<ConnectParams, RequestContext<ConnectResponse>, Task>>(handler => connectRequestHandler = handler);
|
||||||
|
|
||||||
// // when I initialize the service
|
// // when I initialize the service
|
||||||
// service.InitializeService(endpoint.Object);
|
// service.InitializeService(endpoint.Object);
|
||||||
|
|
||||||
// // then I expect the handler to be captured
|
// // then I expect the handler to be captured
|
||||||
// Assert.NotNull(connectRequestHandler);
|
// Assert.NotNull(connectRequestHandler);
|
||||||
|
|
||||||
// // when I call the service
|
// // when I call the service
|
||||||
// var requestContext = new Mock<RequestContext<ConnectResponse>>();
|
// var requestContext = new Mock<RequestContext<ConnectResponse>>();
|
||||||
|
|
||||||
// connectRequestHandler(connectParams, requestContext);
|
// connectRequestHandler(connectParams, requestContext);
|
||||||
// // then I should get a live connection
|
// // then I should get a live connection
|
||||||
|
|
||||||
// // and then I should have
|
// // and then I should have
|
||||||
// // connect to a database instance
|
// // connect to a database instance
|
||||||
// var connectionResult =
|
// var connectionResult =
|
||||||
// TestObjects.GetTestConnectionService()
|
// TestObjects.GetTestConnectionService()
|
||||||
// .Connect(TestObjects.GetTestConnectionDetails());
|
// .Connect(TestObjects.GetTestConnectionDetails());
|
||||||
|
|
||||||
// // verify that a valid connection id was returned
|
// // verify that a valid connection id was returned
|
||||||
// Assert.True(connectionResult.ConnectionId > 0);
|
// Assert.True(connectionResult.ConnectionId > 0);
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,13 +3,8 @@
|
|||||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||||
//
|
//
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
=======
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
|
||||||
>>>>>>> a40180bcb1203cfafc908e7a1e26e673f53393ac
|
|
||||||
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
using Microsoft.SqlTools.ServiceLayer.LanguageServices;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
|
||||||
using Microsoft.SqlTools.Test.Utility;
|
using Microsoft.SqlTools.Test.Utility;
|
||||||
|
|||||||
Reference in New Issue
Block a user