Search Results for

    Show / Hide Table of Contents

    Class Test_UserService

    Tests for the UserService class.

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

    This test class focuses on verifying the behavior of the UserService, especially regarding the mapping of admin status from domain entities to DTOs.

    Methods

    GetUserByIdAsync_AdminUser_MapsIsAdminCorrectly()

    Tests that GetUserByIdAsync maps the IsAdmin property correctly for admin users.

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

    GetUserByIdAsync_NonAdminUser_MapsIsAdminCorrectly()

    Tests that GetUserByIdAsync maps the IsAdmin property correctly for non-admin users.

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

    GetUserByIdAsync_NonExistentUser_ThrowsKeyNotFoundException()

    Tests that GetUserByIdAsync throws KeyNotFoundException for non-existent users.

    Declaration
    [TestMethod]
    [ExpectedException(typeof(KeyNotFoundException))]
    public Task GetUserByIdAsync_NonExistentUser_ThrowsKeyNotFoundException()
    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