Files
pos-system/services/iam-service-net/tests/IamService.UnitTests/Domain/UserStatusTests.cs
Ho Ngoc Hai 079b24f683 feat(api): Enhance OAuth2 token endpoint and debugging capabilities
- Added debug middleware for /connect/* endpoints to log request and response details for better troubleshooting.
- Updated OAuth2 configuration to include "offline_access" scope and disabled access token encryption for development.
- Improved DbContext registration in tests by removing all related registrations and ensuring in-memory database setup for testing purposes.
- Addressed issues with the /connect/token endpoint not responding, outlining next steps for debugging and fixing the OpenIddict configuration.
2026-01-12 18:22:47 +07:00

58 lines
1.6 KiB
C#

using Xunit;
using IamService.Domain.AggregatesModel.UserAggregate;
namespace IamService.UnitTests.Domain;
/// <summary>
/// EN: Unit tests for UserStatus enumeration.
/// VI: Unit tests cho UserStatus enumeration.
/// </summary>
public class UserStatusTests
{
[Fact]
public void UserStatus_Active_ShouldHaveCorrectIdAndName()
{
// Assert
Assert.Equal(1, UserStatus.Active.Id);
Assert.Equal("Active", UserStatus.Active.Name);
}
[Fact]
public void UserStatus_Locked_ShouldHaveCorrectIdAndName()
{
// Assert
Assert.Equal(2, UserStatus.Locked.Id);
Assert.Equal("Locked", UserStatus.Locked.Name);
}
[Fact]
public void UserStatus_Disabled_ShouldHaveCorrectIdAndName()
{
// Assert
Assert.Equal(3, UserStatus.Disabled.Id);
Assert.Equal("Disabled", UserStatus.Disabled.Name);
}
[Fact]
public void UserStatus_PendingVerification_ShouldHaveCorrectIdAndName()
{
// Assert
Assert.Equal(4, UserStatus.PendingVerification.Id);
Assert.Equal("PendingVerification", UserStatus.PendingVerification.Name);
}
[Fact]
public void GetAll_ShouldReturnAllStatuses()
{
// Act
var statuses = UserStatus.GetAll().ToList();
// Assert
Assert.Equal(4, statuses.Count);
Assert.Contains(UserStatus.Active, statuses);
Assert.Contains(UserStatus.Locked, statuses);
Assert.Contains(UserStatus.Disabled, statuses);
Assert.Contains(UserStatus.PendingVerification, statuses);
}
}