mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-27 09:35:38 -05:00
Language Service diagnostics and autocomplete (#9)
* Merge master to dev (#4) * Misc. clean-ups related to removing unneeded PowerShell Language Service code. * Remove unneeded files and clean up remaining code. * Enable file change tracking with Workspace and EditorSession. * Setup standard src, test folder structure. Add unit test project. * Actually stage the deletes. Update .gitignore * Integrate SqlParser into the onchange diagnostics to provide error messages. * Add tests for the language service diagnostics * Initial implementation for autocomplete. * Switch to using sys.tables for autocomplete Move some code into a better class * Delete unused csproj file. * Add nuget.config to pickup SQL Parser nuget package
This commit is contained in:
60
test/ServiceHost.Test/Connection/ConnectionServiceTests.cs
Normal file
60
test/ServiceHost.Test/Connection/ConnectionServiceTests.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//
|
||||
// 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.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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user