mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 09:59:48 -05:00
* Add linting for copyright and unused usings * Add one more + comment * Enforce in build and fix errors * Fix build
50 lines
2.0 KiB
C#
50 lines
2.0 KiB
C#
//
|
|
// 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.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);
|
|
}
|
|
}
|
|
} |