Skip to content

Commit

Permalink
Split test case into positive/negative cases
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Mar 25, 2024
1 parent 470907c commit d49d83d
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions Snowflake.Data.Tests/UnitTests/SFStatementTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@ public void TestTrimSqlLineCommentWithClosingNewline()
}

[Test]
[TestCase("UNKNOWN", QueryStatus.Unknown)]
[TestCase("RANDOM_STATUS", QueryStatus.Unknown)]
[TestCase("aBcZyX", QueryStatus.Unknown)]
[TestCase("running", QueryStatus.Running)]
[TestCase("RUNNING", QueryStatus.Running)]
[TestCase("resuming_warehouse", QueryStatus.ResumingWarehouse)]
Expand All @@ -154,18 +151,19 @@ public void TestTrimSqlLineCommentWithClosingNewline()
[TestCase("RESTARTED", QueryStatus.Restarted)]
[TestCase("blocked", QueryStatus.Blocked)]
[TestCase("BLOCKED", QueryStatus.Blocked)]
public void TestGetQueryStatusByStringValue(string status, QueryStatus expectedStatus)
public void TestGetQueryStatusByStringValue(string stringValue, QueryStatus expectedStatus)
{
if (expectedStatus == QueryStatus.Unknown)
{
var thrown = Assert.Throws<Exception>(() => QueryStatusExtensions.GetQueryStatusByStringValue(status));
Assert.IsTrue(thrown.Message.Contains("The query status returned by the server is not recognized"));
}
else
{
var actualStatus = QueryStatusExtensions.GetQueryStatusByStringValue(status);
Assert.AreEqual(expectedStatus, actualStatus);
}
Assert.AreEqual(expectedStatus, QueryStatusExtensions.GetQueryStatusByStringValue(stringValue));
}

[Test]
[TestCase("UNKNOWN")]
[TestCase("RANDOM_STATUS")]
[TestCase("aBcZyX")]
public void TestGetQueryStatusByStringValueThrowsErrorForUnknownStatus(string stringValue)
{
var thrown = Assert.Throws<Exception>(() => QueryStatusExtensions.GetQueryStatusByStringValue(stringValue));
Assert.IsTrue(thrown.Message.Contains("The query status returned by the server is not recognized"));
}

[Test]
Expand Down

0 comments on commit d49d83d

Please sign in to comment.