Files
sqltoolsservice/test/Microsoft.SqlTools.ServiceLayer.Test/Connection/ConnectionServiceTests.cs
Benjamin Russell e83d2704b9 Fixing project names to fix VS bugs
For whatever reason, Visual Studio throws a fit if a referenced project has a name
and the folder name (which is used to reference the project) is different than that name.
To solve this issue, I've renamed all the projects and folders to match their project
names as stated in the project.json.
2016-07-29 16:55:44 -07:00

61 lines
1.9 KiB
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System.Threading.Tasks;
using Microsoft.SqlTools.Test.Utility;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
{
/// <summary>
/// Tests for the ServiceHost Connection Service tests
/// </summary>
public class ConnectionServiceTests
{
#region "Connection tests"
/// <summary>
/// Verify that the SQL parser correctly detects errors in text
/// </summary>
[Fact]
public void ConnectToDatabaseTest()
{
// connect to a database instance
var connectionResult =
TestObjects.GetTestConnectionService()
.Connect(TestObjects.GetTestConnectionDetails());
// verify that a valid connection id was returned
Assert.True(connectionResult.ConnectionId > 0);
}
/// <summary>
/// Verify that the SQL parser correctly detects errors in text
/// </summary>
[Fact]
public void OnConnectionCallbackHandlerTest()
{
bool callbackInvoked = false;
// setup connection service with callback
var connectionService = TestObjects.GetTestConnectionService();
connectionService.RegisterOnConnectionTask(
(sqlConnection) => {
callbackInvoked = true;
return Task.FromResult(true);
}
);
// connect to a database instance
var connectionResult = connectionService.Connect(TestObjects.GetTestConnectionDetails());
// verify that a valid connection id was returned
Assert.True(callbackInvoked);
}
#endregion
}
}