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:
Karl Burtram
2016-12-14 13:49:42 -08:00
committed by GitHub
parent e9398f7182
commit dd41e0545a
29 changed files with 921 additions and 99 deletions

View File

@@ -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>