Skip to content

Commit

Permalink
Updated test names to match other validator tests. Sorted Valid above…
Browse files Browse the repository at this point in the history
… Invalid test cases.
  • Loading branch information
iNinja committed Jun 28, 2024
1 parent cb03537 commit 3753b5c
Showing 1 changed file with 62 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,56 +50,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
{
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityKeyIsNull",
ExpectedException = ExpectedException.ArgumentNullException(substringExpected: "IDX10253:"),
SecurityKey = null,
SecurityToken = new JwtSecurityToken(),
ValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true },
SigningKeyValidationResult = new SigningKeyValidationResult(
null, // SecurityKey
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(LogMessages.IDX10253),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityTokenIsNullAndValidateIssuerSigningKeyTrue",
ExpectedException = ExpectedException.ArgumentNullException(),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = null,
ValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true },
SigningKeyValidationResult = new SigningKeyValidationResult(
KeyingMaterial.SymmetricSecurityKey2_256,
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(
LogMessages.IDX10000,
LogHelper.MarkAsNonPII("securityToken")),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_ValidationParametersIsNull",
ExpectedException = ExpectedException.ArgumentNullException(),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
ValidationParameters = null,
SigningKeyValidationResult = new SigningKeyValidationResult(
KeyingMaterial.SymmetricSecurityKey2_256,
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(
LogMessages.IDX10000,
LogHelper.MarkAsNonPII("validationParameters")),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityTokenIsPresentAndValidateIssuerSigningKeyTrue",
TestId = "Valid_SecurityTokenIsPresent_ValidateIssuerSigningKeyIsTrue",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -108,7 +59,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityKeyIsNullAndValidateIssuerSigningKeyFalse",
TestId = "Valid_SecurityKeyIsNull_ValidateIssuerSigningKeyIsFalse",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = null,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -117,7 +68,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityTokenIsNullAndValidateIssuerSigningKeyFalse",
TestId = "Valid_SecurityTokenIsNull_ValidateIssuerSigningKeyIsFalse",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = null,
Expand All @@ -126,7 +77,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityKeyIsNullAndRequireSignedTokensFalse",
TestId = "Valid_SecurityKeyIsNull_RequireSignedTokensIsFalse",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = null,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -135,7 +86,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityKeyIsPresentAndRequireSignedTokensTrue",
TestId = "Valid_SecurityKeyIsPresent_RequireSignedTokensIsTrue",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -144,7 +95,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_SecurityKeyIsPresentAndRequireSignedTokensFalse",
TestId = "Valid_SecurityKeyIsPresent_RequireSignedTokensIsFalse",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -153,7 +104,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_DelegateSetAndReturnsTrue",
TestId = "Valid_DelegateSet_ReturnsTrue",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -166,7 +117,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Valid_DelegateUsingConfigurationSetConfigurationAndReturnsTrue",
TestId = "Valid_DelegateUsingConfigurationSet_ReturnsTrue",
ExpectedException = ExpectedException.NoExceptionExpected,
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -179,6 +130,55 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
SigningKeyValidationResult = new SigningKeyValidationResult(KeyingMaterial.SymmetricSecurityKey2_256)
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityKeyIsNull",
ExpectedException = ExpectedException.ArgumentNullException(substringExpected: "IDX10253:"),
SecurityKey = null,
SecurityToken = new JwtSecurityToken(),
ValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true },
SigningKeyValidationResult = new SigningKeyValidationResult(
null, // SecurityKey
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(LogMessages.IDX10253),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityTokenIsNullAndValidateIssuerSigningKeyTrue",
ExpectedException = ExpectedException.ArgumentNullException(),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = null,
ValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true },
SigningKeyValidationResult = new SigningKeyValidationResult(
KeyingMaterial.SymmetricSecurityKey2_256,
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(
LogMessages.IDX10000,
LogHelper.MarkAsNonPII("securityToken")),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_ValidationParametersIsNull",
ExpectedException = ExpectedException.ArgumentNullException(),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
ValidationParameters = null,
SigningKeyValidationResult = new SigningKeyValidationResult(
KeyingMaterial.SymmetricSecurityKey2_256,
ValidationFailureType.NullArgument,
new ExceptionDetail(
new MessageDetail(
LogMessages.IDX10000,
LogHelper.MarkAsNonPII("validationParameters")),
typeof(ArgumentNullException),
new StackFrame(true)))
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityKeyIsExpired",
ExpectedException = ExpectedException.SecurityTokenInvalidSigningKeyException(substringExpected: "IDX10249:"),
Expand Down Expand Up @@ -216,7 +216,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_SecurityKeyIsNullAndRequireSignedTokensTrue",
TestId = "Invalid_SecurityKeyIsNull_RequireSignedTokensIsTrue",
ExpectedException = ExpectedException.ArgumentNullException(substringExpected: "IDX10253:"),
SecurityKey = null,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -231,7 +231,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_DelegateIsSetAndReturnsFalse",
TestId = "Invalid_DelegateIsSet_ReturnsFalse",
ExpectedException = ExpectedException.SecurityTokenInvalidSigningKeyException(substringExpected: "IDX10232:"),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -252,7 +252,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_DelegateUsingConfigurationSetConfigurationAndReturnsFalse",
TestId = "Invalid_DelegateUsingConfigurationSet_ReturnsFalse",
ExpectedException = ExpectedException.SecurityTokenInvalidSigningKeyException(substringExpected: "IDX10232:"),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -274,7 +274,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_DelegateIsSetAndThrows",
TestId = "Invalid_DelegateIsSet_Throws",
ExpectedException = ExpectedException.SecurityTokenInvalidSigningKeyException(substringExpected: "IDX10232:", innerTypeExpected: typeof(SecurityTokenInvalidSigningKeyException)),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand All @@ -296,7 +296,7 @@ public static TheoryData<SigningKeyValidationTheoryData> SigningKeyValidationTes
},
new SigningKeyValidationTheoryData
{
TestId = "Invalid_DelegateUsingConfigurationSetConfigurationAndThrows",
TestId = "Invalid_DelegateUsingConfigurationSet_Throws",
ExpectedException = ExpectedException.SecurityTokenInvalidSigningKeyException(substringExpected: "IDX10232:", innerTypeExpected: typeof(SecurityTokenInvalidSigningKeyException)),
SecurityKey = KeyingMaterial.SymmetricSecurityKey2_256,
SecurityToken = new JwtSecurityToken(),
Expand Down

0 comments on commit 3753b5c

Please sign in to comment.