Acl parser + unit tests

This commit is contained in:
eelke 2024-11-24 12:46:21 +01:00
parent b846a60f25
commit 9a5feb9d54
6 changed files with 181 additions and 0 deletions

View file

@ -0,0 +1,17 @@
namespace pgLabII.PgUtils.Tests;
public class AclParserTests
{
[Theory]
[InlineData("foo=rw/postgres", "foo", "rw", "postgres")]
[InlineData("\"Test\"\"=\"=rw/postgres", "Test\"=", "rw", "postgres")]
[InlineData("foo=rw/\"Test\"\"=\"", "foo", "rw", "Test\"=")]
public void Test1(string aclString, string expectedGrantee, string expectedRights, string expectedGrantor)
{
AclParser parser = new();
Acl acl = parser.Parse(aclString);
Assert.Equal(expectedGrantee, acl.Grantee);
Assert.Equal(expectedRights, acl.Rights);
Assert.Equal(expectedGrantor, acl.Grantor);
}
}