diff --git a/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs b/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs index 3d35f74d0..95b4e596e 100644 --- a/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs +++ b/Snowflake.Data.Tests/UnitTests/Session/SessionPoolTest.cs @@ -1,7 +1,10 @@ using System.Net; using System.Text.RegularExpressions; using NUnit.Framework; +using Snowflake.Data.Client; +using Snowflake.Data.Core; using Snowflake.Data.Core.Session; +using Snowflake.Data.Tests.Util; namespace Snowflake.Data.Tests.UnitTests.Session { @@ -86,6 +89,20 @@ public void TestPoolIdentificationBasedOnConnectionString(string connectionStrin Assert.AreEqual(expectedPoolIdentification, poolIdentification); } + [Test] + public void TestRetrievePoolFailureForInvalidConnectionString() + { + // arrange + var invalidConnectionString = "account=someAccount;db=someDb;host=someHost;user=SomeUser;port=443"; // invalid because password is not provided + + // act + var exception = Assert.Throws(() => SessionPool.CreateSessionPool(invalidConnectionString, null)); + + // assert + SnowflakeDbExceptionAssert.HasErrorCode(exception, SFError.MISSING_CONNECTION_PROPERTY); + Assert.IsTrue(exception.Message.Contains("Required property PASSWORD is not provided")); + } + [Test] public void TestPoolIdentificationBasedOnInternalId() {