Permissions: Protect GetIdsFromPathReversed against invalid program exception (#20930)

* Updates to protect GetIdsFromPathReversed against invalid program exception.

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Andy Butland
2025-11-24 10:19:37 +01:00
committed by GitHub
parent 04f98a758d
commit 12611942ff
2 changed files with 14 additions and 5 deletions

View File

@@ -389,9 +389,11 @@ public class StringExtensionsTests
}
}
[TestCase(null, "")]
[TestCase("", "")]
[TestCase("1,2,3,4,5", "5,4,3,2,1")]
[TestCase("1,2,x,4,5", "5,4,2,1")]
public void GetIdsFromPathReversed(string input, string expected)
public void GetIdsFromPathReversed_ReturnsExpectedResult(string input, string expected)
{
var ids = input.GetIdsFromPathReversed();
Assert.AreEqual(expected, string.Join(",", ids));