Files
sqltoolsservice/test/Microsoft.SqlTools.ManagedBatchParser.IntegrationTests/BatchParser/TestVariableResolver.cs
Karl Burtram f288bee294 Make nullable warnings a per file opt-in (#1842)
* Make nullable warnings a per file opt-in

* Remove unneeded compiler directives

* Remove compiler directive for User Data
2023-02-03 18:10:07 -08:00

36 lines
1.1 KiB
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
#nullable disable
using System.Text;
using Microsoft.SqlTools.ServiceLayer.BatchParser;
using Microsoft.SqlTools.ServiceLayer.BatchParser.ExecutionEngineCode;
namespace Microsoft.SqlTools.ManagedBatchParser.UnitTests.BatchParser
{
internal sealed class TestVariableResolver : IVariableResolver
{
private StringBuilder outputString;
private BatchParserSqlCmd batchParserSqlCmd;
public TestVariableResolver(StringBuilder outputString)
{
this.outputString = outputString;
batchParserSqlCmd = new BatchParserSqlCmd();
}
public string GetVariable(PositionStruct pos, string name)
{
return batchParserSqlCmd.GetVariable(pos, name);
}
public void SetVariable(PositionStruct pos, string name, string value)
{
outputString.AppendFormat("Setting variable {0} to [{1}]\n", name, value);
batchParserSqlCmd.SetVariable(pos, name, value);
}
}
}