test(inbound): add namespace + Query() coverage for InboundDatabaseHelper

This commit is contained in:
Joseph Doherty
2026-06-16 21:40:52 -04:00
parent 90ac746fdc
commit 16fc62bfa0
@@ -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<string>("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);
}
}