mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-15 09:35:37 -05:00
Add tests to improve code coverage (#187)
* DbColumn and ReliableConnection tests * More retry connection tests * More tests * Fix broken peek definition integration tests * Fix test bug * Add a couple batch tests * Add some more tests * More tests for code coverage. * Validation and Diagnostic tests * A few more tests * A few mote test changes. * Update file path tests to run on Windows only
This commit is contained in:
@@ -536,6 +536,17 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
||||
Assert.True(connectionString.Contains(connectionStringMarker));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Build connection string with an invalid auth type
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void BuildConnectionStringWithInvalidAuthType()
|
||||
{
|
||||
ConnectionDetails details = TestObjects.GetTestConnectionDetails();
|
||||
details.AuthenticationType = "NotAValidAuthType";
|
||||
Assert.Throws<ArgumentException>(() => ConnectionService.BuildConnectionString(details));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify that a connection changed event is fired when the database context changes.
|
||||
/// </summary>
|
||||
@@ -892,6 +903,29 @@ namespace Microsoft.SqlTools.ServiceLayer.Test.Connection
|
||||
});
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Test that cancel connection with a null connection parameter
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestCancelConnectionNullParam()
|
||||
{
|
||||
var service = TestObjects.GetTestConnectionService();
|
||||
Assert.False(service.CancelConnect(null));
|
||||
}
|
||||
|
||||
// <summary>
|
||||
/// Test that cancel connection with a null connection parameter
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void TestListDatabasesInvalidParams()
|
||||
{
|
||||
var service = TestObjects.GetTestConnectionService();
|
||||
var listParams = new ListDatabasesParams();
|
||||
Assert.Throws<ArgumentException>(() => service.ListDatabases(listParams));
|
||||
listParams.OwnerUri = "file://notmyfile.sql";
|
||||
Assert.Throws<Exception>(() => service.ListDatabases(listParams));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test that the connection complete notification type can be created.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user