From 63b692863384e54fcd8b3f34d6fb366de08895cf Mon Sep 17 00:00:00 2001 From: Krzysztof Nozderko Date: Fri, 1 Dec 2023 12:28:07 +0100 Subject: [PATCH] added test for empty account --- .../UnitTests/SFSessionPropertyTest.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs b/Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs index a254f8a82..bef1093a8 100644 --- a/Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs +++ b/Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs @@ -43,6 +43,20 @@ public void TestThatItFailsForWrongConnectionParameter(string connectionString, Assert.AreEqual(SFError.INVALID_CONNECTION_PARAMETER_VALUE.GetAttribute().errorCode, exception.ErrorCode); Assert.IsTrue(exception.Message.Contains(expectedErrorMessagePart)); } + + [Test] + [TestCase("ACCOUNT=;USER=testuser;PASSWORD=testpassword")] + [TestCase("USER=testuser;PASSWORD=testpassword")] + public void TestThatItFailsIfNoAccountSpecified(string connectionString) + { + // act + var exception = Assert.Throws( + () => SFSessionProperties.parseConnectionString("ACCOUNT=;USER=testuser;PASSWORD=testpassword", null) + ); + + // assert + Assert.AreEqual(SFError.MISSING_CONNECTION_PROPERTY.GetAttribute().errorCode, exception.ErrorCode); + } public static IEnumerable ConnectionStringTestCases() {