mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Fix the OE service where returns database as the root node for database connection (#322)
* Fix the OE service where retuns database as the root node if the connection contains database name * Fix OE tests * addressed the comments * addresses comment * fix OE test and add more tests * fix VerifyAdventureWorksDatabaseObjects test
This commit is contained in:
@@ -75,10 +75,49 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.ObjectExplorer
|
||||
|
||||
|
||||
[Fact]
|
||||
public async Task CreateSessionRequestReturnsSuccessAndNodeInfo()
|
||||
public async Task CreateSessionRequestWithMasterConnectionReturnsServerSuccessAndNodeInfo()
|
||||
{
|
||||
// Given the connection service fails to connect
|
||||
ConnectionDetails details = TestObjects.GetTestConnectionDetails();
|
||||
ConnectionDetails details = new ConnectionDetails()
|
||||
{
|
||||
UserName = "user",
|
||||
Password = "password",
|
||||
DatabaseName = "master",
|
||||
ServerName = "serverName"
|
||||
};
|
||||
await CreateSessionRequestAndVerifyServerNodeHelper(details);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateSessionRequestWithEmptyConnectionReturnsServerSuccessAndNodeInfo()
|
||||
{
|
||||
// Given the connection service fails to connect
|
||||
ConnectionDetails details = new ConnectionDetails()
|
||||
{
|
||||
UserName = "user",
|
||||
Password = "password",
|
||||
DatabaseName = "",
|
||||
ServerName = "serverName"
|
||||
};
|
||||
await CreateSessionRequestAndVerifyServerNodeHelper(details);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateSessionRequestWithMsdbConnectionReturnsServerSuccessAndNodeInfo()
|
||||
{
|
||||
// Given the connection service fails to connect
|
||||
ConnectionDetails details = new ConnectionDetails()
|
||||
{
|
||||
UserName = "user",
|
||||
Password = "password",
|
||||
DatabaseName = "msdb",
|
||||
ServerName = "serverName"
|
||||
};
|
||||
await CreateSessionRequestAndVerifyServerNodeHelper(details);
|
||||
}
|
||||
|
||||
private async Task CreateSessionRequestAndVerifyServerNodeHelper(ConnectionDetails details)
|
||||
{
|
||||
serviceHostMock.AddEventHandling(ConnectionCompleteNotification.Type, null);
|
||||
|
||||
connectionServiceMock.Setup(c => c.Connect(It.IsAny<ConnectParams>()))
|
||||
|
||||
Reference in New Issue
Block a user