Task/batch parser wrapper tests (#314)

* added more batch parser tests

* fixed merge conflicts

* change debug type to portable

* fixed imports according to review
This commit is contained in:
Aditya Bist
2017-04-21 11:59:20 -07:00
committed by GitHub
parent 8206c70994
commit 06eddd57f4
7 changed files with 480 additions and 185 deletions

View File

@@ -1,64 +1,64 @@
{
"name": "Microsoft.SqlTools.Credentials",
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"embed": [
"../Microsoft.SqlTools.ServiceLayer/Localization/sr.es.resx",
"../Microsoft.SqlTools.ServiceLayer/Localization/sr.resx"
]
},
"configurations": {
"Integration": {
"buildOptions": {
"define": [
"WINDOWS_ONLY_BUILD"
],
"emitEntryPoint": true
}
}
},
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"System.Security.SecureString": "4.0.0",
"System.Collections.Specialized": "4.0.1",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Diagnostics.Contracts": "4.0.1",
"System.Diagnostics.TraceSource": "4.0.0",
"NETStandard.Library": "1.6.0",
"Microsoft.NETCore.Runtime.CoreCLR": "1.0.2",
"Microsoft.NETCore.DotNetHostPolicy": "1.0.1",
"Microsoft.DiaSymReader.Native": "1.4.1",
"System.Diagnostics.Process": "4.1.0",
"System.Threading.Thread": "4.0.0",
"System.Runtime.Loader": "4.0.0",
"System.Composition": "1.0.31-beta-24326-02",
"Microsoft.Extensions.DependencyModel": "1.0.0",
"Microsoft.SqlTools.Hosting": {
"target": "project"
}
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
},
"runtimes": {
"win7-x64": {},
"win7-x86": {},
"osx.10.11-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"centos.7-x64": {},
"rhel.7.2-x64": {},
"debian.8-x64": {},
"fedora.23-x64": {},
"opensuse.13.2-x64": {}
}
}
{
"name": "Microsoft.SqlTools.Credentials",
"version": "1.0.0-*",
"buildOptions": {
"debugType": "portable",
"emitEntryPoint": true,
"embed": [
"../Microsoft.SqlTools.ServiceLayer/Localization/sr.es.resx",
"../Microsoft.SqlTools.ServiceLayer/Localization/sr.resx"
]
},
"configurations": {
"Integration": {
"buildOptions": {
"define": [
"WINDOWS_ONLY_BUILD"
],
"emitEntryPoint": true
}
}
},
"dependencies": {
"Newtonsoft.Json": "9.0.1",
"System.Security.SecureString": "4.0.0",
"System.Collections.Specialized": "4.0.1",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Diagnostics.Contracts": "4.0.1",
"System.Diagnostics.TraceSource": "4.0.0",
"NETStandard.Library": "1.6.0",
"Microsoft.NETCore.Runtime.CoreCLR": "1.0.2",
"Microsoft.NETCore.DotNetHostPolicy": "1.0.1",
"Microsoft.DiaSymReader.Native": "1.4.1",
"System.Diagnostics.Process": "4.1.0",
"System.Threading.Thread": "4.0.0",
"System.Runtime.Loader": "4.0.0",
"System.Composition": "1.0.31-beta-24326-02",
"Microsoft.Extensions.DependencyModel": "1.0.0",
"Microsoft.SqlTools.Hosting": {
"target": "project"
}
},
"frameworks": {
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0"
}
},
"imports": "dnxcore50"
}
},
"runtimes": {
"win7-x64": {},
"win7-x86": {},
"osx.10.11-x64": {},
"ubuntu.14.04-x64": {},
"ubuntu.16.04-x64": {},
"centos.7-x64": {},
"rhel.7.2-x64": {},
"debian.8-x64": {},
"fedora.23-x64": {},
"opensuse.13.2-x64": {}
}
}

View File

@@ -23,6 +23,7 @@ using Microsoft.SqlTools.Utility;
using ConnectionType = Microsoft.SqlTools.ServiceLayer.Connection.ConnectionType;
using Location = Microsoft.SqlTools.ServiceLayer.Workspace.Contracts.Location;
namespace Microsoft.SqlTools.ServiceLayer.Scripting
{
internal partial class Scripter
@@ -151,6 +152,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
}
StringComparison caseSensitivity = this.Database.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase;
// if declarationItem matches the selected token, script SMO using that type
if (declarationItem.Title.Equals(tokenText, caseSensitivity))
{
return GetDefinitionUsingDeclarationType(declarationItem.Type, declarationItem.DatabaseQualifiedName, tokenText, schemaName);

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="TestLocalizationConstant" xml:space="preserve">
<value>ES_LOCALIZATION</value>
</data>
</root>

View File

@@ -1,65 +1,120 @@
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using Microsoft.SqlTools.ServiceLayer.BatchParser;
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
{
public class BatchParserSqlCmdTests : IDisposable
{
private BatchParserSqlCmd bpcmd;
private PositionStruct testPOS;
public BatchParserSqlCmdTests()
{
bpcmd = new BatchParserSqlCmd();
testPOS = new PositionStruct();
bpcmd.SetVariable(testPOS, "variable1", "test1");
bpcmd.SetVariable(testPOS, "variable2", "test2");
bpcmd.SetVariable(testPOS, "variable3", "test3");
}
public void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (disposing)
{
if (bpcmd != null)
{
bpcmd = null;
}
}
}
[Fact]
public void CheckSetVariable()
{
Assert.Equal(bpcmd.InternalVariables.Count, 3);
bpcmd.SetVariable(testPOS, "variable4", "test4");
bpcmd.SetVariable(testPOS, "variable5", "test5");
bpcmd.SetVariable(testPOS, "variable6", "test6");
Assert.Equal(bpcmd.InternalVariables.Count, 6);
}
[Fact]
public void CheckGetVariable()
{
string value = bpcmd.GetVariable(testPOS, "variable1");
Assert.Equal("test1", value);
value = bpcmd.GetVariable(testPOS, "variable2");
Assert.Equal("test2", value);
value = bpcmd.GetVariable(testPOS, "variable3");
Assert.Equal("test3", value);
}
}
}
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using System;
using System.IO;
using Microsoft.SqlTools.ServiceLayer.BatchParser;
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
using Moq;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
{
public class BatchParserSqlCmdTests : IDisposable
{
private BatchParserSqlCmd bpcmd;
private PositionStruct testPOS;
public BatchParserSqlCmdTests()
{
bpcmd = new BatchParserSqlCmd();
testPOS = new PositionStruct();
bpcmd.SetVariable(testPOS, "variable1", "test1");
bpcmd.SetVariable(testPOS, "variable2", "test2");
bpcmd.SetVariable(testPOS, "variable3", "test3");
}
public void Dispose()
{
Dispose(true);
}
private void Dispose(bool disposing)
{
if (disposing)
{
if (bpcmd != null)
{
bpcmd = null;
}
}
}
[Fact]
public void CheckSetVariable()
{
Assert.Equal(bpcmd.InternalVariables.Count, 3);
bpcmd.SetVariable(testPOS, "variable4", "test4");
bpcmd.SetVariable(testPOS, "variable5", "test5");
bpcmd.SetVariable(testPOS, "variable6", "test6");
Assert.Equal(bpcmd.InternalVariables.Count, 6);
bpcmd.SetVariable(testPOS, "variable1", null);
}
[Fact]
public void CheckSetNullValueVariable()
{
bpcmd.SetVariable(testPOS, "variable6", null);
Assert.Equal(bpcmd.InternalVariables.Count, 5);
}
[Fact]
public void CheckGetVariable()
{
string value = bpcmd.GetVariable(testPOS, "variable1");
Assert.Equal("test1", value);
value = bpcmd.GetVariable(testPOS, "variable2");
Assert.Equal("test2", value);
value = bpcmd.GetVariable(testPOS, "variable3");
Assert.Equal("test3", value);
}
[Fact]
public void CheckGetNullVariable()
{
Assert.Null(bpcmd.GetVariable(testPOS, "variable6"));
}
[Fact]
public void CheckInclude()
{
TextReader textReader = null;
string outString = "out";
var result = bpcmd.Include(null, out textReader, out outString);
Assert.Equal(result, BatchParserAction.Abort);
}
[Fact]
public void CheckOnError()
{
var errorActionChanged = bpcmd.ErrorActionChanged;
var action = new OnErrorAction();
var result = bpcmd.OnError(null, action);
Assert.Equal(result, BatchParserAction.Continue);
bpcmd.ErrorActionChanged = null;
result = bpcmd.OnError(null, action);
Assert.NotEqual(result, BatchParserAction.Continue);
}
[Fact]
public void CheckConnectionChangedDelegate()
{
var initial = bpcmd.ConnectionChanged;
bpcmd.ConnectionChanged = null;
Assert.Null(bpcmd.ConnectionChanged);
}
[Fact]
public void CheckVariableSubstitutionDisabled()
{
bpcmd.DisableVariableSubstitution();
bpcmd.SetVariable(testPOS, "variable1", "test");
var result = bpcmd.GetVariable(testPOS, "variable1");
Assert.Null(result);
}
}
}

View File

@@ -1,51 +1,54 @@
using Microsoft.SqlTools.ServiceLayer.BatchParser;
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
{
public class BatchParserWrapperTests
{
private BatchParserWrapper parserWrapper;
public BatchParserWrapperTests()
{
parserWrapper = new BatchParserWrapper();
}
[Fact]
public void CheckSimpleSingleSQLBatchStatement()
{
string sqlScript = "select * from sys.objects";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(1, batches.Count);
BatchDefinition batch = batches[0];
Assert.Equal(sqlScript, batch.BatchText);
Assert.Equal(1, batch.StartLine);
Assert.Equal(1, batch.StartColumn);
Assert.Equal(2, batch.EndLine);
Assert.Equal(sqlScript.Length, batch.EndColumn);
}
[Fact]
public void CheckComment()
{
string sqlScript = "-- this is a comment --";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(1, batches.Count);
BatchDefinition batch = batches[0];
Assert.Equal(sqlScript, batch.BatchText);
Assert.Equal(1, batch.StartLine);
Assert.Equal(1, batch.StartColumn);
Assert.Equal(2, batch.EndLine);
Assert.Equal(sqlScript.Length, batch.EndColumn);
}
[Fact]
public void CheckNoOps()
{
string sqlScript = "GO";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(0, batches.Count);
}
}
}
using Microsoft.SqlTools.ServiceLayer.BatchParser;
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.BatchParser
{
public class BatchParserWrapperTests
{
[Fact]
public void CheckSimpleSingleSQLBatchStatement()
{
using (BatchParserWrapper parserWrapper = new BatchParserWrapper())
{
string sqlScript = "select * from sys.objects";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(1, batches.Count);
BatchDefinition batch = batches[0];
Assert.Equal(sqlScript, batch.BatchText);
Assert.Equal(1, batch.StartLine);
Assert.Equal(1, batch.StartColumn);
Assert.Equal(2, batch.EndLine);
Assert.Equal(sqlScript.Length, batch.EndColumn);
}
}
[Fact]
public void CheckComment()
{
using (BatchParserWrapper parserWrapper = new BatchParserWrapper())
{
string sqlScript = "-- this is a comment --";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(1, batches.Count);
BatchDefinition batch = batches[0];
Assert.Equal(sqlScript, batch.BatchText);
Assert.Equal(1, batch.StartLine);
Assert.Equal(1, batch.StartColumn);
Assert.Equal(2, batch.EndLine);
Assert.Equal(sqlScript.Length, batch.EndColumn);
}
}
[Fact]
public void CheckNoOps()
{
using (BatchParserWrapper parserWrapper = new BatchParserWrapper())
{
string sqlScript = "GO";
var batches = parserWrapper.GetBatches(sqlScript);
Assert.Equal(0, batches.Count);
}
}
}
}

View File

@@ -12,8 +12,10 @@ using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
using Microsoft.SqlTools.ServiceLayer.Connection;
using Microsoft.SqlTools.ServiceLayer.IntegrationTests.Utility;
using Microsoft.SqlTools.ServiceLayer.Test.Common;
using Moq;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
{
/// <summary>
@@ -297,6 +299,14 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
Assert.True(CompareTwoStringLists(executor.ErrorMessageQueue, expErrorMessage));
Assert.True(CompareTwoIntLists(executor.ResultCountQueue, expResultCounts));
}
[Fact]
public void ExecutionEngineTest_DiscardConnection()
{
ExecutionEngine engine = new ExecutionEngine();
Assert.True(ConnectionDiscardWrapper(engine));
}
#endregion
#region Different execution conditions
@@ -456,6 +466,29 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
// However since that gets mapped to Failure anyhow, consider "Failure" as acceptable here
Assert.True(executor.ExecutionResult.HasFlag(ScriptExecutionResult.Failure), "Expected failure when invalid connection is present" );
}
/// <summary>
/// Test with multiple conditions true
/// </summary>
[Fact]
public void TestExecutionEngineConditions()
{
string sqlStatement = "select * from sys.databases\ngo\nselect name from sys.databases\ngo\nprint 'test'\ngo";
ExecutionEngineConditions conditions = new ExecutionEngineConditions();
conditions.IsNoExec = true;
conditions.IsStatisticsIO = true;
conditions.IsStatisticsTime = true;
conditions.IsEstimatedShowPlan = true;
TestExecutor executor = new TestExecutor(sqlStatement, connection, conditions, false);
executor.Run();
//Get the expected values
List<string> batchScripts = executor.BatchScripts;
ExecuteSqlBatch(batchScripts, connection);
Assert.Equal(ScriptExecutionResult.Success, executor.ExecutionResult);
Assert.True(CompareTwoIntLists(executor.ResultCountQueue, expResultCounts));
}
#endregion
#region SQL Commands
@@ -491,9 +524,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
{
TestExecutor executor = new TestExecutor(stmt, connection, conditions);
executor.Run();
//Assert.AreEqual(ScriptExecutionResult.Failure, executor.ExecutionResult);
//Assert.IsTrue(executor.ResultCountQueue.Count == 0);
Assert.True(executor.ResultCountQueue.Count == 0);
}
}
@@ -501,7 +532,7 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
#region Threading
/// <summary>
/// Test synchous cancel
/// Test synchronous cancel
/// </summary>
[Fact]
public void ExecutionEngineTest_SyncCancel()
@@ -657,6 +688,69 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
#endregion
#region Get/Set Methods
[Fact]
public void TestShowStatements()
{
Assert.NotNull(ExecutionEngineConditions.ShowPlanXmlStatement(true));
Assert.NotNull(ExecutionEngineConditions.ShowPlanAllStatement(true));
Assert.NotNull(ExecutionEngineConditions.ShowPlanTextStatement(true));
Assert.NotNull(ExecutionEngineConditions.StatisticsXmlStatement(true));
Assert.NotNull(ExecutionEngineConditions.StatisticsProfileStatement(true));
Assert.NotNull(ExecutionEngineConditions.ParseOnlyStatement(true));
Assert.NotNull(ExecutionEngineConditions.NoExecStatement(true));
Assert.NotNull(ExecutionEngineConditions.StatisticsIOStatement(true));
Assert.NotNull(ExecutionEngineConditions.StatisticsTimeStatement(true));
Assert.NotNull(ExecutionEngineConditions.ResetStatement);
}
[Fact]
public void TestExecutionEngineConditionsSetMethods()
{
ExecutionEngineConditions conditions = new ExecutionEngineConditions();
bool getValue = conditions.IsScriptExecutionTracked;
conditions.IsScriptExecutionTracked = !getValue;
Assert.Equal(conditions.IsScriptExecutionTracked, !getValue);
getValue = conditions.IsEstimatedShowPlan;
conditions.IsEstimatedShowPlan = !getValue;
Assert.Equal(conditions.IsEstimatedShowPlan, !getValue);
getValue = conditions.IsActualShowPlan;
conditions.IsActualShowPlan = !getValue;
Assert.Equal(conditions.IsActualShowPlan, !getValue);
getValue = conditions.IsSuppressProviderMessageHeaders;
conditions.IsSuppressProviderMessageHeaders = !getValue;
Assert.Equal(conditions.IsSuppressProviderMessageHeaders, !getValue);
getValue = conditions.IsNoExec;
conditions.IsNoExec = !getValue;
Assert.Equal(conditions.IsNoExec, !getValue);
getValue = conditions.IsStatisticsIO;
conditions.IsStatisticsIO = !getValue;
Assert.Equal(conditions.IsStatisticsIO, !getValue);
getValue = conditions.IsShowPlanText;
conditions.IsShowPlanText = !getValue;
Assert.Equal(conditions.IsShowPlanText, !getValue);
getValue = conditions.IsStatisticsTime;
conditions.IsStatisticsTime = !getValue;
Assert.Equal(conditions.IsStatisticsTime, !getValue);
getValue = conditions.IsSqlCmd;
conditions.IsSqlCmd = !getValue;
Assert.Equal(conditions.IsSqlCmd, !getValue);
conditions.BatchSeparator = "GO";
Assert.Equal(conditions.BatchSeparator, "GO");
}
#endregion
#region Private methods
/// <summary>
/// Connection to a database
@@ -782,6 +876,21 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
return isSame;
}
/// <summary>
/// Wrapper to test the Close method in ExecutionEngine
/// </summary>
/// <param name="engine"></param>
/// <returns></returns>
private bool ConnectionDiscardWrapper(ExecutionEngine engine)
{
if (engine == null)
{
return false;
}
engine.Close(false, true, true);
return true;
}
#endregion
}
}

View File

@@ -219,7 +219,10 @@ namespace Microsoft.SqlTools.ServiceLayer.IntegrationTests.TSQLExecutionEngine
sqlStatement = batch;
conditions.IsHaltOnError = exeCondition.IsHaltOnError;
conditions.IsParseOnly = exeCondition.IsParseOnly;
conditions.IsTransactionWrapped = exeCondition.IsTransactionWrapped;
conditions.IsTransactionWrapped = exeCondition.IsTransactionWrapped;
conditions.IsNoExec = exeCondition.IsNoExec;
conditions.IsStatisticsIO = exeCondition.IsStatisticsIO;
conditions.IsStatisticsTime = exeCondition.IsStatisticsTime;
_cancel = cancelExecution;
connection = conn;