Skip to content

Commit

Permalink
added test for empty account
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-knozderko committed Dec 1, 2023
1 parent a6a0ee4 commit 63b6928
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ public void TestThatItFailsForWrongConnectionParameter(string connectionString,
Assert.AreEqual(SFError.INVALID_CONNECTION_PARAMETER_VALUE.GetAttribute<SFErrorAttr>().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<SnowflakeDbException>(
() => SFSessionProperties.parseConnectionString("ACCOUNT=;USER=testuser;PASSWORD=testpassword", null)
);

// assert
Assert.AreEqual(SFError.MISSING_CONNECTION_PROPERTY.GetAttribute<SFErrorAttr>().errorCode, exception.ErrorCode);
}

public static IEnumerable<TestCase> ConnectionStringTestCases()
{
Expand Down

0 comments on commit 63b6928

Please sign in to comment.