mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -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 * 3278 Minor refactors in ConnectionInfo, BindingQueue, DiagnosticsHelper, MetadataService, and HostLoader. Changed AssemblyInfo to only allow Kusto Unit Tests for internal access. Added lots of unit tests. * 3278 Commented out bindingContext.IsConnected in AddConnectionContext_Sets_BindingContext * 3278 Reversed order of unit tests in ConnectedBindingQueueTests and added throw to Catch block. * 3278 Reverted change to ConnectedBindingQueue. Removed unit test from AddConnectionContext for NeedsMetaData True Co-authored-by: Jorge Berumen <52225468+joberume@users.noreply.github.com> Co-authored-by: joberume <jberumen3@miners.utep.edu>
45 lines
1.8 KiB
C#
45 lines
1.8 KiB
C#
using System;
|
|
using System.Threading;
|
|
using Microsoft.Kusto.ServiceLayer.LanguageServices;
|
|
using Microsoft.Kusto.ServiceLayer.LanguageServices.Contracts;
|
|
using NUnit.Framework;
|
|
|
|
namespace Microsoft.Kusto.ServiceLayer.UnitTests.LanguageServices
|
|
{
|
|
public class BindingQueueTests
|
|
{
|
|
[Test]
|
|
public void QueueBindingOperation_Returns_Null_For_NullBindOperation()
|
|
{
|
|
var bindingQueue = new BindingQueue<ConnectedBindingContext>();
|
|
var queueItem = bindingQueue.QueueBindingOperation("", null);
|
|
Assert.IsNull(queueItem);
|
|
}
|
|
|
|
[Test]
|
|
public void QueueBindingOperation_Returns_QueueItem()
|
|
{
|
|
var key = "key";
|
|
var bindOperation = new Func<IBindingContext, CancellationToken, object>((context, token) => new Hover());
|
|
Func<IBindingContext, object> timeoutOperation = (context) => LanguageService.HoverTimeout;
|
|
Func<Exception, object> errorHandler = exception => new Exception();
|
|
var bindingTimeout = 30;
|
|
var waitForLockTimeout = 45;
|
|
|
|
var bindingQueue = new BindingQueue<ConnectedBindingContext>();
|
|
var queueItem = bindingQueue.QueueBindingOperation(key,
|
|
bindOperation,
|
|
timeoutOperation,
|
|
errorHandler,
|
|
bindingTimeout,
|
|
waitForLockTimeout);
|
|
|
|
Assert.AreEqual(key, queueItem.Key);
|
|
Assert.AreEqual(bindOperation, queueItem.BindOperation);
|
|
Assert.AreEqual(timeoutOperation, queueItem.TimeoutOperation);
|
|
Assert.AreEqual(errorHandler, queueItem.ErrorHandler);
|
|
Assert.AreEqual(bindingTimeout, queueItem.BindingTimeout);
|
|
Assert.AreEqual(waitForLockTimeout, queueItem.WaitForLockTimeout);
|
|
}
|
|
}
|
|
} |