mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Fix OE and Binding Queue reliability bugs (#702)
This commit is contained in:
@@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Threading;
|
||||
using Microsoft.SqlServer.Management.Common;
|
||||
using Microsoft.SqlServer.Management.Smo;
|
||||
using Microsoft.SqlTools.Extensibility;
|
||||
@@ -400,7 +401,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
|
||||
ServerNode node = SetupServerNodeWithServer(smoServer);
|
||||
|
||||
// When I populate its children
|
||||
IList<TreeNode> children = node.Expand();
|
||||
IList<TreeNode> children = node.Expand(new CancellationToken());
|
||||
|
||||
// Then I expect it to contain server-level folders
|
||||
Assert.Equal(3, children.Count);
|
||||
@@ -409,7 +410,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
|
||||
VerifyTreeNode<FolderNode>(children[2], "Folder", SR.SchemaHierarchy_ServerObjects);
|
||||
// And the database is contained under it
|
||||
TreeNode databases = children[0];
|
||||
IList<TreeNode> dbChildren = databases.Expand();
|
||||
IList<TreeNode> dbChildren = databases.Expand(new CancellationToken());
|
||||
Assert.Equal(2, dbChildren.Count);
|
||||
Assert.Equal(SR.SchemaHierarchy_SystemDatabases, dbChildren[0].NodeValue);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.SqlTools.Hosting.Protocol;
|
||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||
@@ -52,6 +53,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
|
||||
connectedBindingContext.ServerConnection = new ServerConnection(new SqlConnection(fakeConnectionString));
|
||||
connectedBindingQueue = new ConnectedBindingQueue(false);
|
||||
connectedBindingQueue.BindingContextMap.Add($"{details.ServerName}_{details.DatabaseName}_{details.UserName}_NULL", connectedBindingContext);
|
||||
connectedBindingQueue.BindingContextTasks.Add(connectedBindingContext, Task.Run(() => null));
|
||||
mockConnectionOpener = new Mock<SqlConnectionOpener>();
|
||||
connectedBindingQueue.SetConnectionOpener(mockConnectionOpener.Object);
|
||||
service.ConnectedBindingQueue = connectedBindingQueue;
|
||||
@@ -271,7 +273,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
|
||||
public void FindNodeCanExpandParentNodes()
|
||||
{
|
||||
var mockTreeNode = new Mock<TreeNode>();
|
||||
object[] populateChildrenArguments = { ItExpr.Is<bool>(x => x == false), ItExpr.IsNull<string>() };
|
||||
object[] populateChildrenArguments = { ItExpr.Is<bool>(x => x == false), ItExpr.IsNull<string>(), new CancellationToken() };
|
||||
mockTreeNode.Protected().Setup("PopulateChildren", populateChildrenArguments);
|
||||
mockTreeNode.Object.IsAlwaysLeaf = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user