Renamed test projects

This commit is contained in:
2024-12-10 16:39:28 +01:00
parent 4d91ce1819
commit ee7bf1e204
21 changed files with 31 additions and 27 deletions

View File

@@ -0,0 +1,59 @@
using HopFrame.Database;
namespace HopFrame.Tests.Database;
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);
}
}