// // Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // using Microsoft.SqlTools.ServiceLayer.LanguageServices; using Microsoft.SqlTools.ServiceLayer.LanguageServices.Completion; using Microsoft.SqlTools.ServiceLayer.Workspace.Contracts; using Xunit; namespace Microsoft.SqlTools.ServiceLayer.Test.Completion { public class ScriptDocumentInfoTest { [Fact] public void MetricsShouldGetSortedGivenUnSortedArray() { TextDocumentPosition doc = new TextDocumentPosition() { TextDocument = new TextDocumentIdentifier { Uri = "script file" }, Position = new Position() { Line = 1, Character = 14 } }; ScriptFile scriptFile = new ScriptFile() { Contents = "Select * from sys.all_objects" }; ScriptParseInfo scriptParseInfo = new ScriptParseInfo(); ScriptDocumentInfo docInfo = new ScriptDocumentInfo(doc, scriptFile, scriptParseInfo); Assert.Equal(docInfo.StartLine, 1); Assert.Equal(docInfo.ParserLine, 2); Assert.Equal(docInfo.StartColumn, 44); Assert.Equal(docInfo.EndColumn, 14); Assert.Equal(docInfo.ParserColumn, 15); } } }