Add additional test cases (#125)

Test-only changes for code coverage.  Please review the comment and I'll include the changes in the next iteration.

* Add more tests

* Add some more additional test cases
This commit is contained in:
Karl Burtram
2016-10-28 20:33:32 -07:00
committed by GitHub
parent 931235c604
commit f46fc0c787
9 changed files with 732 additions and 106 deletions

View File

@@ -10,12 +10,52 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.SqlTools.ServiceLayer.TestDriver.Utility;
using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
{
public class QueryExecutionTests : TestBase
{
[Fact]
public async Task ExecuteBasicQueryTest()
{
try
{
string ownerUri = System.IO.Path.GetTempFileName();
bool connected = await Connect(ownerUri, ConnectionTestUtils.LocalhostConnection);
Assert.True(connected, "Connection is successful");
Thread.Sleep(500);
string query = "SELECT * FROM sys.objects";
DidOpenTextDocumentNotification openParams = new DidOpenTextDocumentNotification()
{
TextDocument = new TextDocumentItem()
{
Uri = ownerUri,
LanguageId = "enu",
Version = 1,
Text = query
}
};
await RequestOpenDocumentNotification(openParams);
var queryResult = await RunQuery(ownerUri, query);
Assert.NotNull(queryResult);
Assert.NotNull(queryResult.BatchSummaries);
await Disconnect(ownerUri);
}
finally
{
WaitForExit();
}
}
//[Fact]
public async Task TestQueryingAfterCompletionRequests()
{
@@ -27,7 +67,6 @@ namespace Microsoft.SqlTools.ServiceLayer.TestDriver.Tests
await Connect(ownerUri, ConnectionTestUtils.AzureTestServerConnection);
Enumerable.Range(0, 10).ToList().ForEach(arg => tasks.Add(RequestCompletion(ownerUri, query, 0, 10)));
var queryTask = RunQuery(ownerUri, query);
tasks.Add(queryTask);