Class Test_UserService
Tests for the UserService class.
Inherited Members
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()