Support Object Explorer FindNodes request (#589)

This commit is contained in:
Matt Irvine
2018-03-15 10:47:52 -07:00
committed by GitHub
parent d36efb578c
commit 365fe2282e
8 changed files with 584 additions and 33 deletions

View File

@@ -243,6 +243,26 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
connectionServiceMock.Verify(c => c.Disconnect(It.IsAny<DisconnectParams>()));
}
[Fact]
public async Task FindNodesReturnsMatchingNode()
{
var session = await CreateSession();
var foundNodes = service.FindNodes(session.SessionId, "Server", null, null, null);
Assert.Equal(1, foundNodes.Count);
Assert.Equal("Server", foundNodes[0].NodeType);
Assert.Equal(session.RootNode.NodePath, foundNodes[0].ToNodeInfo().NodePath);
}
[Fact]
public async Task FindNodesReturnsEmptyListForNoMatch()
{
var session = await CreateSession();
var foundNodes = service.FindNodes(session.SessionId, "Table", "testSchema", "testTable", "testDatabase");
Assert.Equal(0, foundNodes.Count);
}
private async Task<SessionCreatedParameters> CreateSession()
{
SessionCreatedParameters sessionResult = null;