Class Test_RoleService
Tests for the RoleService class.
Inherited Members
Namespace: OEMS.UnitTests.Auth
Assembly: OEMS.UnitTests.dll
Syntax
[TestClass]
public sealed class Test_RoleService
Remarks
This test class focuses on verifying the role-based access control functionality provided by the RoleService.
Methods
Cleanup()
Declaration
[TestCleanup]
public void Cleanup()
IsUserAdminAsync_AdminUser_ReturnsTrue()
Tests that IsUserAdminAsync correctly identifies admin users.
Declaration
[TestMethod]
public Task IsUserAdminAsync_AdminUser_ReturnsTrue()
Returns
Type | Description |
---|---|
Task |
IsUserAdminAsync_MissingUserIdClaim_ReturnsNull()
Tests that IsUserAdminAsync handles missing user ID claim.
Declaration
[TestMethod]
public Task IsUserAdminAsync_MissingUserIdClaim_ReturnsNull()
Returns
Type | Description |
---|---|
Task |
IsUserAdminAsync_NonAdminUser_ReturnsFalse()
Tests that IsUserAdminAsync correctly identifies non-admin users.
Declaration
[TestMethod]
public Task IsUserAdminAsync_NonAdminUser_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
IsUserAdminAsync_UnauthenticatedUser_ReturnsNull()
Tests that IsUserAdminAsync returns null for unauthenticated users.
Declaration
[TestMethod]
public Task IsUserAdminAsync_UnauthenticatedUser_ReturnsNull()
Returns
Type | Description |
---|---|
Task |
IsUserAdminAsync_UserServiceThrowsException_ReturnsFalse()
Tests that IsUserAdminAsync handles user service exceptions gracefully.
Declaration
[TestMethod]
public Task IsUserAdminAsync_UserServiceThrowsException_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
IsUserOrgAdminAsync_OrgAdminUser_ReturnsTrue()
Tests that IsUserOrgAdminAsync correctly identifies organization admins.
Declaration
[TestMethod]
public Task IsUserOrgAdminAsync_OrgAdminUser_ReturnsTrue()
Returns
Type | Description |
---|---|
Task |
SetUp()
Initializes the test environment before each test run.
Declaration
[TestInitialize]
public void SetUp()