Fix UdiRange.Parse() throwing ArgumentException for valid value (#16788)

* Add test to assert UdiRange can round-trip all selectors

* Fix parsing UdiRange without a selector
This commit is contained in:
Ronald Barendse
2024-07-24 14:28:19 +02:00
committed by GitHub
parent 7e444e5604
commit 2f78d1a8f3
2 changed files with 30 additions and 7 deletions

View File

@@ -201,6 +201,21 @@ public class UdiTests
Assert.Throws<ArgumentException>(() => new UdiRange(guidUdi, "x"));
}
[Test]
[TestCase(Constants.DeploySelector.This)]
[TestCase(Constants.DeploySelector.ThisAndChildren)]
[TestCase(Constants.DeploySelector.ThisAndDescendants)]
[TestCase(Constants.DeploySelector.ChildrenOfThis)]
[TestCase(Constants.DeploySelector.DescendantsOfThis)]
[TestCase(Constants.DeploySelector.EntitiesOfType)]
public void RangeParseTest(string selector)
{
var expected = new UdiRange(Udi.Create(Constants.UdiEntityType.AnyGuid, Guid.NewGuid()), selector);
var actual = UdiRange.Parse(expected.ToString());
Assert.AreEqual(expected, actual);
}
[Test]
public void TryParseTest()
{