Add unit test for the MapChar method

This commit is contained in:
BDisp
2025-09-16 13:33:31 +01:00
parent 5be7cefc3c
commit 759462e490

View File

@@ -1538,6 +1538,22 @@ public class EscSeqUtilsTests
Assert.Equal (expected, actual);
}
[Theory]
[InlineData ('\u001B', KeyCode.Esc)]
[InlineData ('\r', KeyCode.Enter)]
[InlineData ('1', KeyCode.D1)]
[InlineData ('!', (KeyCode)'!')]
[InlineData ('a', KeyCode.A)]
[InlineData ('A', KeyCode.A | KeyCode.ShiftMask)]
public void MapChar_Returns_Modifiers_If_Needed (char ch, KeyCode keyCode)
{
ConsoleKeyInfo cki = EscSeqUtils.MapChar (ch);
Key key = EscSeqUtils.MapKey (cki);
Key expectedKey = keyCode;
Assert.Equal (key, expectedKey);
}
private void ClearAll ()
{
EscSeqRequests.Clear ();