Class Test_TokenService
Tests for the TokenService class to validate token generation, validation, and handling
Inherited Members
Namespace: OEMS.UnitTests.Application
Assembly: OEMS.UnitTests.dll
Syntax
[TestClass]
public class Test_TokenService
Methods
GenerateTokenAsync_CreatesValidToken()
Tests that token generation creates a valid token and stores it in the repository
Declaration
[TestMethod]
public Task GenerateTokenAsync_CreatesValidToken()
Returns
Type | Description |
---|---|
Task |
MarkTokenAsUsedAsync_WithInvalidToken_ReturnsFalse()
Tests that non-existent tokens can't be marked as used
Declaration
[TestMethod]
public Task MarkTokenAsUsedAsync_WithInvalidToken_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
MarkTokenAsUsedAsync_WithValidToken_MarksTokenUsed()
Tests that tokens can be marked as used successfully
Declaration
[TestMethod]
public Task MarkTokenAsUsedAsync_WithValidToken_MarksTokenUsed()
Returns
Type | Description |
---|---|
Task |
Setup()
Declaration
[TestInitialize]
public void Setup()
ValidateTokenAsync_WithExpiredToken_ReturnsFalse()
Tests that expired tokens are rejected
Declaration
[TestMethod]
public Task ValidateTokenAsync_WithExpiredToken_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
ValidateTokenAsync_WithInvalidToken_ReturnsFalse()
Tests that invalid token strings are rejected
Declaration
[TestMethod]
public Task ValidateTokenAsync_WithInvalidToken_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
ValidateTokenAsync_WithUsedToken_ReturnsFalse()
Tests that used tokens are rejected
Declaration
[TestMethod]
public Task ValidateTokenAsync_WithUsedToken_ReturnsFalse()
Returns
Type | Description |
---|---|
Task |
ValidateTokenAsync_WithValidToken_ReturnsSuccess()
Tests that valid tokens are properly validated and return the expected user data
Declaration
[TestMethod]
public Task ValidateTokenAsync_WithValidToken_ReturnsSuccess()
Returns
Type | Description |
---|---|
Task |