[System.Data] Call SqlConnection.ClearAllPools() only when we had a connection
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 19 Apr 2017 12:40:10 +0000 (14:40 +0200)
committerAlexander Köplinger <alex.koeplinger@outlook.com>
Wed, 19 Apr 2017 12:40:10 +0000 (14:40 +0200)
commitf11c25c42608d093e47bb2c3c638ae80b92d61ba
tree7e7b0751e8112b5634d5fc0bde6777a07a27211c
parent1a77e8727c5523edb85a7c45485d45bd4d8f8eec
[System.Data] Call SqlConnection.ClearAllPools() only when we had a connection

When ConnectionManager.Instance.Sql.ConnectionString throws in
SetUp() we'd still call SqlConnection.ClearAllPools() in the TearDown()
which happens for example when the connection string environment
variable is not set.

This is a problem on WatchOS since SqlConnection.ClearAllPools()
throws PlatformNotSupportedException there, making the tests fail.
Instead we now check whether the connectionString is set and only
call the method in that case.
mcs/class/System.Data/Test/ProviderTests/System.Data.SqlClient/SqlConnectionTest.cs