Skip to content

UserInfoControllerTests

Namespace: UnitTests.Controllers

Unit tests for the UserInfoController class, verifying user management functionality.

public class UserInfoControllerTests

Inheritance ObjectUserInfoControllerTests

Constructors

UserInfoControllerTests()

public UserInfoControllerTests()

Methods

ChangePassword_WithException_ShouldReturnInternalServerError()

Tests that ChangePassword returns InternalServerError when service throws exception.

public Task ChangePassword_WithException_ShouldReturnInternalServerError()

Returns

Task

ChangePassword_WithInvalidModelState_ShouldLogWarning()

Tests that ChangePassword logs warning when model state is invalid.

public Task ChangePassword_WithInvalidModelState_ShouldLogWarning()

Returns

Task

ChangePassword_WithInvalidModelState_ShouldReturnBadRequest()

Tests that ChangePassword returns BadRequest when model state is invalid.

public Task ChangePassword_WithInvalidModelState_ShouldReturnBadRequest()

Returns

Task

ChangePassword_WithNonExistentUser_ShouldReturnNotFound()

Tests that ChangePassword returns NotFound when user does not exist.

public Task ChangePassword_WithNonExistentUser_ShouldReturnNotFound()

Returns

Task

ChangePassword_WithValidData_ShouldReturnOk()

Tests that ChangePassword returns OK when password is changed successfully.

public Task ChangePassword_WithValidData_ShouldReturnOk()

Returns

Task

ChangeUser_WithException_ShouldReturnInternalServerError()

Tests that ChangeUser returns InternalServerError when service throws exception.

public Task ChangeUser_WithException_ShouldReturnInternalServerError()

Returns

Task

ChangeUser_WithInvalidModelState_ShouldReturnBadRequest()

Tests that ChangeUser returns BadRequest when model state is invalid.

public Task ChangeUser_WithInvalidModelState_ShouldReturnBadRequest()

Returns

Task

ChangeUser_WithValidData_ShouldReturnOk()

Tests that ChangeUser returns OK when user is updated successfully.

public Task ChangeUser_WithValidData_ShouldReturnOk()

Returns

Task

Constructor_WithValidParameters_ShouldCreateInstance()

Tests that the constructor creates a valid instance when provided with valid parameters.

public void Constructor_WithValidParameters_ShouldCreateInstance()

DeleteUser_WhenDeletionFails_ShouldReturnInternalServerError()

Tests that DeleteUser returns InternalServerError when deletion fails.

public Task DeleteUser_WhenDeletionFails_ShouldReturnInternalServerError()

Returns

Task

DeleteUser_WithException_ShouldReturnInternalServerError()

Tests that DeleteUser returns InternalServerError when service throws exception.

public Task DeleteUser_WithException_ShouldReturnInternalServerError()

Returns

Task

DeleteUser_WithExistingUser_ShouldReturnOk()

Tests that DeleteUser returns OK when user is deleted successfully.

public Task DeleteUser_WithExistingUser_ShouldReturnOk()

Returns

Task

DeleteUser_WithNonExistentUser_ShouldReturnNotFound()

Tests that DeleteUser returns NotFound when user does not exist.

public Task DeleteUser_WithNonExistentUser_ShouldReturnNotFound()

Returns

Task

GetAllUsers_ShouldLogInformation()

Tests that GetAllUsers logs information when fetching users.

public Task GetAllUsers_ShouldLogInformation()

Returns

Task

GetAllUsers_WithException_ShouldReturnInternalServerError()

Tests that GetAllUsers returns InternalServerError when service throws exception.

public Task GetAllUsers_WithException_ShouldReturnInternalServerError()

Returns

Task

GetAllUsers_WithValidData_ShouldReturnOkWithUsers()

Tests that GetAllUsers returns OK with users when service returns data.

public Task GetAllUsers_WithValidData_ShouldReturnOkWithUsers()

Returns

Task

GetUserById_ShouldLogInformation()

Tests that GetUserById logs information when fetching a user.

public Task GetUserById_ShouldLogInformation()

Returns

Task

GetUserById_WithException_ShouldReturnInternalServerError()

Tests that GetUserById returns InternalServerError when service throws exception.

public Task GetUserById_WithException_ShouldReturnInternalServerError()

Returns

Task

GetUserById_WithExistingUser_ShouldReturnOkWithUser()

Tests that GetUserById returns OK with user when user exists.

public Task GetUserById_WithExistingUser_ShouldReturnOkWithUser()

Returns

Task

GetUserById_WithNonExistentUser_ShouldReturnNotFound()

Tests that GetUserById returns NotFound when user does not exist.

public Task GetUserById_WithNonExistentUser_ShouldReturnNotFound()

Returns

Task

Setup()

Sets up test fixtures and initializes mocks before each test execution.

public void Setup()