diff --git a/SmokeTests/DynamicSyntax.cs b/SmokeTests/DynamicSyntax.cs index 20f1296..4c4bf1a 100644 --- a/SmokeTests/DynamicSyntax.cs +++ b/SmokeTests/DynamicSyntax.cs @@ -704,6 +704,26 @@ Tuple ExecuteBinarySync(IDbConnection db) return Tuple.Create(true, ""); } + [SmokeTest("Dynamic Syntax Empty Binary ResultSet")] + Tuple ExecutEmptyBinarySync(IDbConnection db) + { + byte[] res = db.Execute(Program.timeout).usp_GetEmptyBinary(@includeResults: false); + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + } + + [SmokeTest("Dynamic Syntax NULL Binary ResultSet")] + Tuple ExecutNullBinarySync(IDbConnection db) + { + byte[] res = db.Execute(Program.timeout).usp_GetEmptyBinary(@includeResults: true); + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + } + [SmokeTest("Dynamic Syntax Binary ResultSet (await)")] async Task> ExecuteBinaryAsync(IDbConnection db) { @@ -717,6 +737,26 @@ async Task> ExecuteBinaryAsync(IDbConnection db) return Tuple.Create(true, ""); } + [SmokeTest("Dynamic Syntax Empty Binary ResultSet (await)")] + async Task> ExecutEmptyBinaryAsync(IDbConnection db) + { + byte[] res = await db.ExecuteAsync(Program.timeout).usp_GetEmptyBinary(@includeResults: false); + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + } + + [SmokeTest("Dynamic Syntax NULL Binary ResultSet (await)")] + async Task> ExecutNullBinaryAsync(IDbConnection db) + { + byte[] res = await db.ExecuteAsync(Program.timeout).usp_GetEmptyBinary(@includeResults: true); + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + } + [SmokeTest("Dynamic Syntax Binary ResultSet (task)")] Task> ExecuteBinaryTask(IDbConnection db) { @@ -737,6 +777,36 @@ Task> ExecuteBinaryTask(IDbConnection db) }); } + [SmokeTest("Dynamic Syntax Empty Binary ResultSet (task)")] + Task> ExecutEmptyBinaryTask(IDbConnection db) + { + Task t = db.ExecuteAsync(Program.timeout).usp_GetEmptyBinary(@includeResults: false); + + return t.ContinueWith(r => + { + var res = t.Result; + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + }); + } + + [SmokeTest("Dynamic Syntax NULL Binary ResultSet (task)")] + Task> ExecutNullBinaryTask(IDbConnection db) + { + Task t = db.ExecuteAsync(Program.timeout).usp_GetEmptyBinary(@includeResults: true); + + return t.ContinueWith(r => + { + var res = t.Result; + if (res != null) + return Tuple.Create(false, "The stored procedure returned an empty result set, so should not have a value"); + + return Tuple.Create(true, ""); + }); + } + [SmokeTest("Dynamic Syntax Binary Parameter")] Tuple ExecuteBinaryParameter(IDbConnection db) { diff --git a/SmokeTests/FluentSyntax.cs b/SmokeTests/FluentSyntax.cs index c3da00e..feffbc1 100644 --- a/SmokeTests/FluentSyntax.cs +++ b/SmokeTests/FluentSyntax.cs @@ -977,6 +977,36 @@ Tuple ExecuteBinarySync(IDbConnection db) return Tuple.Create(true, ""); } + [SmokeTest("Fluent Syntax Empty Binary ResultSet")] + Tuple ExecuteEmptyBinarySync(IDbConnection db) + { + byte[] res = StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", false) + .WithResults() + .Execute(db, Program.timeout) + .SingleOrDefault(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + } + + [SmokeTest("Fluent Syntax NULL Binary ResultSet")] + Tuple ExecuteNullBinarySync(IDbConnection db) + { + byte[] res = StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", true) + .WithResults() + .Execute(db, Program.timeout) + .Single(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + } + [SmokeTest("Fluent Syntax Binary ResultSet (await)")] async Task> ExecuteBinaryAsync(IDbConnection db) { @@ -994,6 +1024,36 @@ async Task> ExecuteBinaryAsync(IDbConnection db) return Tuple.Create(true, ""); } + [SmokeTest("Fluent Syntax Empty Binary ResultSet (await)")] + async Task> ExecuteEmptyBinaryAsync(IDbConnection db) + { + byte[] res = (await StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", false) + .WithResults() + .ExecuteAsync(db, Program.timeout)) + .SingleOrDefault(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + } + + [SmokeTest("Fluent Syntax NULL Binary ResultSet (await)")] + async Task> ExecuteNullBinaryAsync(IDbConnection db) + { + byte[] res = (await StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", true) + .WithResults() + .ExecuteAsync(db, Program.timeout)) + .Single(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + } + [SmokeTest("Fluent Syntax Binary ResultSet (task)")] Task> ExecuteBinaryTask(IDbConnection db) { @@ -1017,6 +1077,44 @@ Task> ExecuteBinaryTask(IDbConnection db) }); } + [SmokeTest("Fluent Syntax Empty Binary ResultSet (task)")] + Task> ExecuteEmptyBinaryTask(IDbConnection db) + { + var t = StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", false) + .WithResults() + .ExecuteAsync(db, Program.timeout); + + return t.ContinueWith(r => + { + var res = r.Result.SingleOrDefault(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + }); + } + + [SmokeTest("Fluent Syntax NULL Binary ResultSet")] + Task> ExecuteNullBinaryTask(IDbConnection db) + { + var t = StoredProcedure.Create("usp_GetEmptyBinary") + .WithParameter("includeResults", true) + .WithResults() + .ExecuteAsync(db, Program.timeout); + + return t.ContinueWith(r => + { + var res = r.Result.Single(); + + if (res != null) + return Tuple.Create(false, "The bytes returned from the stored procedure were not null"); + + return Tuple.Create(true, ""); + }); + } + [SmokeTest("Fluent Syntax Binary Parameter")] Tuple ExecuteBinaryParameter(IDbConnection db) { diff --git a/SmokeTests/Smoke.mdf b/SmokeTests/Smoke.mdf index d7bbb4f..c4656f8 100644 Binary files a/SmokeTests/Smoke.mdf and b/SmokeTests/Smoke.mdf differ diff --git a/SmokeTests/Smoke_log.ldf b/SmokeTests/Smoke_log.ldf index ff10dec..cdcecf9 100644 Binary files a/SmokeTests/Smoke_log.ldf and b/SmokeTests/Smoke_log.ldf differ