mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:35:43 -05:00
* 3278 Added unit tests in MetadataFactoryTests and Microsoft.Kusto.ServiceLayer.UnitTests project * 3278 Removed todo and changed unit test to validate megabytes * 3278 Added file and unit tests in AutoCompleteHelperTests.cs * 3278 Removed unused functions from Kusto > ScriptAsScriptingOperation * 3278 Added unit tests for DataSourceFactory * 3278 Refactored AdminService to pass in ConnectionService rather than through instance variable. Added unit test for AdminServiceTests * 3278 Refactored DataSourceFactory to not have static functions for future unit tests * 3278 Re-added properties that were flagged as unused but are being used by ADS in ReliableDataSourceConnection.cs * 3278 Re-added properties that were flagged as unused but are being used by ADS in ReliableDataSourceConnection.cs * adding pipeline to execute tests (#1062) * 3278 Converted GetDefaultAutoComplete and GetDefaultSemanticMarkers to static functions in DataSourceFactory. Removed unused constructor in ScriptFile. Added positive unit tests for both functions * undoing release version bump * adding additional configs * adressing feedback * Correcting path in csproj Co-authored-by: Jorge Berumen <52225468+joberume@users.noreply.github.com> Co-authored-by: joberume <jberumen3@miners.utep.edu>
78 lines
3.1 KiB
C#
78 lines
3.1 KiB
C#
using System.Linq;
|
|
using Microsoft.Kusto.ServiceLayer.LanguageServices;
|
|
using Microsoft.Kusto.ServiceLayer.LanguageServices.Contracts;
|
|
using NUnit.Framework;
|
|
|
|
namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
|
|
{
|
|
public class AutoCompleteHelperTests
|
|
{
|
|
[Test]
|
|
public void CreateCompletionItem_Returns_CompletionItem()
|
|
{
|
|
string label = "";
|
|
string detail = "";
|
|
string insertText = "";
|
|
var itemKind = CompletionItemKind.Method;
|
|
int row = 1;
|
|
int startColumn = 2;
|
|
int endColumn = 3;
|
|
|
|
var completionItem = AutoCompleteHelper.CreateCompletionItem(label, detail, insertText, itemKind, row, startColumn, endColumn);
|
|
|
|
Assert.IsNotNull(completionItem);
|
|
Assert.AreEqual(label, completionItem.Label);
|
|
Assert.AreEqual(itemKind, completionItem.Kind);
|
|
Assert.AreEqual(detail, completionItem.Detail);
|
|
Assert.AreEqual(insertText, completionItem.InsertText);
|
|
|
|
Assert.IsNotNull(completionItem.TextEdit);
|
|
Assert.AreEqual(insertText, completionItem.TextEdit.NewText);
|
|
|
|
Assert.IsNotNull(completionItem.TextEdit.Range);
|
|
|
|
Assert.IsNotNull(completionItem.TextEdit.Range.Start);
|
|
Assert.AreEqual(row, completionItem.TextEdit.Range.Start.Line);
|
|
Assert.AreEqual(startColumn, completionItem.TextEdit.Range.Start.Character);
|
|
|
|
Assert.IsNotNull(completionItem.TextEdit.Range.End);
|
|
Assert.AreEqual(row, completionItem.TextEdit.Range.End.Line);
|
|
Assert.AreEqual(endColumn, completionItem.TextEdit.Range.End.Character);
|
|
}
|
|
|
|
[Test]
|
|
public void ConvertQuickInfoToHover_Returns_Null_For_Null_QuickInfoText()
|
|
{
|
|
var hover = AutoCompleteHelper.ConvertQuickInfoToHover(null, "", 0, 0, 0);
|
|
Assert.IsNull(hover);
|
|
}
|
|
|
|
[Test]
|
|
public void ConvertQuickInfoToHover_Returns_Hover()
|
|
{
|
|
string quickInfoText = "";
|
|
string language = "";
|
|
int row = 0;
|
|
int startColumn = 0;
|
|
int endColumn = 0;
|
|
|
|
var hover = AutoCompleteHelper.ConvertQuickInfoToHover(quickInfoText, language, row, startColumn, endColumn);
|
|
|
|
Assert.IsNotNull(hover);
|
|
|
|
Assert.AreEqual(1, hover.Contents.Length);
|
|
var content = hover.Contents.First();
|
|
Assert.AreEqual(language, content.Language);
|
|
Assert.AreEqual(quickInfoText, content.Value);
|
|
|
|
Assert.IsNotNull(hover.Range);
|
|
Assert.IsNotNull(hover.Range.Value.Start);
|
|
Assert.AreEqual(row, hover.Range.Value.Start.Line);
|
|
Assert.AreEqual(startColumn, hover.Range.Value.Start.Character);
|
|
|
|
Assert.IsNotNull(hover.Range.Value.End);
|
|
Assert.AreEqual(row, hover.Range.Value.End.Line);
|
|
Assert.AreEqual(endColumn, hover.Range.Value.End.Character);
|
|
}
|
|
}
|
|
} |