Moved test project to correct folder

This commit is contained in:
2024-11-24 12:47:23 +01:00
parent b7eca1937c
commit da45a84f61
7 changed files with 2 additions and 1 deletions

View File

@@ -0,0 +1,57 @@
namespace HopFrame.Database.Tests;
public class PermissionValidatorTests {
[Fact]
public void IncludesPermission_Returns_True_For_ExactPermission() {
// Arrange
var permissions = new [] { "test.permission", "test.permission.exact" };
var permission = "test.permission.exact";
// Act
var hasPermission = PermissionValidator.IncludesPermission(permission, permissions);
// Assert
Assert.True(hasPermission);
}
[Fact]
public void IncludesPermission_Returns_True_For_GroupPermission() {
// Arrange
var permissions = new [] { "test.permission.*", "test.permission.exact" };
var permission = "test.permission.exact.other";
// Act
var hasPermission = PermissionValidator.IncludesPermission(permission, permissions);
// Assert
Assert.True(hasPermission);
}
[Fact]
public void IncludesPermission_Returns_True_For_StarPermission() {
// Arrange
var permissions = new [] { "test.permission", "test.permission.exact", "*" };
var permission = "test.permission.exact.other";
// Act
var hasPermission = PermissionValidator.IncludesPermission(permission, permissions);
// Assert
Assert.True(hasPermission);
}
[Fact]
public void IncludesPermission_Returns_False() {
// Arrange
var permissions = new [] { "test.permission", "test.permission.exact" };
var permission = "test.permission.exact.other";
// Act
var hasPermission = PermissionValidator.IncludesPermission(permission, permissions);
// Assert
Assert.False(hasPermission);
}
}