Skip to content

Commit

Permalink
Improve the test
Browse files Browse the repository at this point in the history
  • Loading branch information
howryu committed May 25, 2018
1 parent ea48b6f commit de5d945
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions Snowflake.Data.Tests/SFDbDataReaderIT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ public void testGetGuid()
}

[Test]
public void TestCopyWithZeroFiles()
public void TestCopyCmdUpdateCount()
{
using (IDbConnection conn = new SnowflakeDbConnection())
{
Expand All @@ -609,19 +609,26 @@ public void TestCopyWithZeroFiles()
cmd.CommandText = "create or replace stage emptyStage";
cmd.ExecuteNonQuery();

cmd.CommandText = "create or replace table testZeroCopy (cola string)";
cmd.CommandText = "create or replace table testCopy (cola string)";
cmd.ExecuteNonQuery();

cmd.CommandText = "copy into testZeroCopy from @emptyStage";

cmd.CommandText = "copy into testCopy from @emptyStage";
int updateCount = cmd.ExecuteNonQuery();
Assert.AreEqual(0, updateCount);

// test rows_loaded exists
cmd.CommandText = "copy into @%testcopy from (select 'test_string')";
cmd.ExecuteNonQuery();

cmd.CommandText = "copy into testcopy";
updateCount = cmd.ExecuteNonQuery();
Assert.AreEqual(1, updateCount);

// clean up
cmd.CommandText = "drop stage emptyStage";
cmd.ExecuteNonQuery();

cmd.CommandText = "drop table testZeroCopy";
cmd.CommandText = "drop table testCopy";
cmd.ExecuteNonQuery();

conn.Close();
Expand Down

0 comments on commit de5d945

Please sign in to comment.