From 16fc62bfa0dc0f57a07c6b30d71cb590b2f2c1c7 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Tue, 16 Jun 2026 21:40:52 -0400 Subject: [PATCH] test(inbound): add namespace + Query() coverage for InboundDatabaseHelper --- .../InboundDatabaseHelperTests.cs | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/ZB.MOM.WW.ScadaBridge.InboundAPI.Tests/InboundDatabaseHelperTests.cs b/tests/ZB.MOM.WW.ScadaBridge.InboundAPI.Tests/InboundDatabaseHelperTests.cs index e50becd6..4a54a9bd 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.InboundAPI.Tests/InboundDatabaseHelperTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.InboundAPI.Tests/InboundDatabaseHelperTests.cs @@ -5,6 +5,8 @@ using ZB.MOM.WW.ScadaBridge.Commons.Types; using ZB.MOM.WW.ScadaBridge.InboundAPI; using Xunit; +namespace ZB.MOM.WW.ScadaBridge.InboundAPI.Tests; + public class InboundDatabaseHelperTests { private sealed class SqliteGateway : IDatabaseGateway @@ -44,4 +46,23 @@ public class InboundDatabaseHelperTests var code = helper.QuerySingle("BTDB", "SELECT Code FROM Machine WHERE SAPID=@s", new { s = "999999" }); Assert.Null(code); } + + [Fact] + public void Query_returns_row_with_case_insensitive_keys() + { + var helper = new InboundDatabaseHelper(SeededGateway(), CancellationToken.None); + var rows = helper.Query("BTDB", "SELECT Code, SAPID FROM Machine WHERE SAPID=@s", new { s = "131453" }); + Assert.Single(rows); + var row = rows[0]; + Assert.Equal("Z28061A", row["code"]); + Assert.Equal("Z28061A", row["CODE"]); + } + + [Fact] + public void Query_returns_empty_list_when_no_rows_match() + { + var helper = new InboundDatabaseHelper(SeededGateway(), CancellationToken.None); + var rows = helper.Query("BTDB", "SELECT Code, SAPID FROM Machine WHERE SAPID=@s", new { s = "999999" }); + Assert.Empty(rows); + } }