Acl parser + unit tests
This commit is contained in:
parent
b846a60f25
commit
9a5feb9d54
6 changed files with 181 additions and 0 deletions
17
pgLabII.PgUtils.Tests/Acls/AclParserTests.cs
Normal file
17
pgLabII.PgUtils.Tests/Acls/AclParserTests.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
25
pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj
Normal file
25
pgLabII.PgUtils.Tests/pgLabII.PgUtils.Tests.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net9.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" />
|
||||
<PackageReference Include="xunit" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\pgLabII.PgUtils\pgLabII.PgUtils.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue