Search Results for

    Show / Hide Table of Contents

    Class Test_RoleServiceAdminAccess

    Comprehensive tests for the admin access control functionality in RoleService.

    Inheritance
    object
    Test_RoleServiceAdminAccess
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: OEMS.UnitTests.UI.Auth
    Assembly: OEMS.UnitTests.dll
    Syntax
    [TestClass]
    public sealed class Test_RoleServiceAdminAccess
    Remarks

    This test class focuses specifically on the IsUserAdminAsync method of the RoleService, ensuring it correctly determines admin status under various conditions.

    Methods

    Cleanup()

    Declaration
    [TestCleanup]
    public void Cleanup()

    IsUserAdminAsync_AuthProviderThrowsException_ReturnsFalse()

    Tests behavior when AuthenticationStateProvider throws exception.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_AuthProviderThrowsException_ReturnsFalse()
    Returns
    Type Description
    Task

    IsUserAdminAsync_EmptyAuthState_ReturnsNull()

    Tests behavior with completely empty authentication state.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_EmptyAuthState_ReturnsNull()
    Returns
    Type Description
    Task

    IsUserAdminAsync_InactiveAdminUser_ReturnsTrue()

    Tests behavior with inactive user account.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_InactiveAdminUser_ReturnsTrue()
    Returns
    Type Description
    Task

    IsUserAdminAsync_MalformedUserIdClaim_ReturnsNull()

    Tests behavior with malformed user ID claim.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_MalformedUserIdClaim_ReturnsNull()
    Returns
    Type Description
    Task

    IsUserAdminAsync_UserServiceThrowsKeyNotFoundException_ReturnsFalse()

    Tests behavior when UserService throws a KeyNotFoundException.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_UserServiceThrowsKeyNotFoundException_ReturnsFalse()
    Returns
    Type Description
    Task

    IsUserAdminAsync_WithMultipleClaims_ExtractsCorrectClaim()

    Tests handling of auth state with multiple claims.

    Declaration
    [TestMethod]
    public Task IsUserAdminAsync_WithMultipleClaims_ExtractsCorrectClaim()
    Returns
    Type Description
    Task

    SetUp()

    Initializes the test environment before each test run.

    Declaration
    [TestInitialize]
    public void SetUp()
    In this article
    Back to top Generated by DocFX