mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-17 02:51:45 -05:00
Stub files for tests for query execution
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution.Contracts
|
namespace Microsoft.SqlTools.ServiceLayer.QueryExecution
|
||||||
{
|
{
|
||||||
public class ResultSet
|
public class ResultSet
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||||
|
{
|
||||||
|
public class DisposeTests
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Microsoft.SqlServer.Management.SqlParser.MetadataProvider;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.Connection.Contracts;
|
||||||
|
using Microsoft.SqlTools.ServiceLayer.QueryExecution;
|
||||||
|
using Microsoft.SqlTools.Test.Utility;
|
||||||
|
using Moq;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||||
|
{
|
||||||
|
public class ExecuteTests
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void QueryCreationTest()
|
||||||
|
{
|
||||||
|
// If I create a new query...
|
||||||
|
Query query = new Query("NO OP", CreateTestConnectionInfo());
|
||||||
|
|
||||||
|
// Then:
|
||||||
|
// ... It should not have executed
|
||||||
|
Assert.False(query.HasExecuted, "The query should not have executed.");
|
||||||
|
|
||||||
|
// ... The results should be empty
|
||||||
|
Assert.Empty(query.ResultSets);
|
||||||
|
Assert.Empty(query.ResultSummary);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static ConnectionInfo CreateTestConnectionInfo()
|
||||||
|
{
|
||||||
|
// Create connection info
|
||||||
|
ConnectionDetails connDetails = new ConnectionDetails
|
||||||
|
{
|
||||||
|
UserName = "sa",
|
||||||
|
Password = "Yukon900",
|
||||||
|
DatabaseName = "AdventureWorks2016CTP3_2",
|
||||||
|
ServerName = "sqltools11"
|
||||||
|
};
|
||||||
|
|
||||||
|
#if !USE_LIVE_CONNECTION
|
||||||
|
// Use the mock db connection factory
|
||||||
|
ISqlConnectionFactory factory = new TestSqlConnectionFactory();
|
||||||
|
#else
|
||||||
|
// Use a real db connection factory
|
||||||
|
ISqlConnectionFactory factory = new SqlConnectionFactory();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return new ConnectionInfo(factory, "test://test", connDetails);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Microsoft.SqlTools.ServiceLayer.Test.QueryExecution
|
||||||
|
{
|
||||||
|
public class SubsetTests
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user