UserInfoControllerTests¶
Namespace: UnitTests.Controllers
Unit tests for the UserInfoController class, verifying user management functionality.
Inheritance Object → UserInfoControllerTests
Constructors¶
UserInfoControllerTests()¶
Methods¶
ChangePassword_WithException_ShouldReturnInternalServerError()¶
Tests that ChangePassword returns InternalServerError when service throws exception.
Returns¶
ChangePassword_WithInvalidModelState_ShouldLogWarning()¶
Tests that ChangePassword logs warning when model state is invalid.
Returns¶
ChangePassword_WithInvalidModelState_ShouldReturnBadRequest()¶
Tests that ChangePassword returns BadRequest when model state is invalid.
Returns¶
ChangePassword_WithNonExistentUser_ShouldReturnNotFound()¶
Tests that ChangePassword returns NotFound when user does not exist.
Returns¶
ChangePassword_WithValidData_ShouldReturnOk()¶
Tests that ChangePassword returns OK when password is changed successfully.
Returns¶
ChangeUser_WithException_ShouldReturnInternalServerError()¶
Tests that ChangeUser returns InternalServerError when service throws exception.
Returns¶
ChangeUser_WithInvalidModelState_ShouldReturnBadRequest()¶
Tests that ChangeUser returns BadRequest when model state is invalid.
Returns¶
ChangeUser_WithValidData_ShouldReturnOk()¶
Tests that ChangeUser returns OK when user is updated successfully.
Returns¶
Constructor_WithValidParameters_ShouldCreateInstance()¶
Tests that the constructor creates a valid instance when provided with valid parameters.
DeleteUser_WhenDeletionFails_ShouldReturnInternalServerError()¶
Tests that DeleteUser returns InternalServerError when deletion fails.
Returns¶
DeleteUser_WithException_ShouldReturnInternalServerError()¶
Tests that DeleteUser returns InternalServerError when service throws exception.
Returns¶
DeleteUser_WithExistingUser_ShouldReturnOk()¶
Tests that DeleteUser returns OK when user is deleted successfully.
Returns¶
DeleteUser_WithNonExistentUser_ShouldReturnNotFound()¶
Tests that DeleteUser returns NotFound when user does not exist.
Returns¶
GetAllUsers_ShouldLogInformation()¶
Tests that GetAllUsers logs information when fetching users.
Returns¶
GetAllUsers_WithException_ShouldReturnInternalServerError()¶
Tests that GetAllUsers returns InternalServerError when service throws exception.
Returns¶
GetAllUsers_WithValidData_ShouldReturnOkWithUsers()¶
Tests that GetAllUsers returns OK with users when service returns data.
Returns¶
GetUserById_ShouldLogInformation()¶
Tests that GetUserById logs information when fetching a user.
Returns¶
GetUserById_WithException_ShouldReturnInternalServerError()¶
Tests that GetUserById returns InternalServerError when service throws exception.
Returns¶
GetUserById_WithExistingUser_ShouldReturnOkWithUser()¶
Tests that GetUserById returns OK with user when user exists.
Returns¶
GetUserById_WithNonExistentUser_ShouldReturnNotFound()¶
Tests that GetUserById returns NotFound when user does not exist.
Returns¶
Setup()¶
Sets up test fixtures and initializes mocks before each test execution.