diff --git a/test/Microsoft.IdentityModel.Tokens.Tests/SupportedAlgorithmTests.cs b/test/Microsoft.IdentityModel.Tokens.Tests/SupportedAlgorithmTests.cs index 5b7859128e..e00e277809 100644 --- a/test/Microsoft.IdentityModel.Tokens.Tests/SupportedAlgorithmTests.cs +++ b/test/Microsoft.IdentityModel.Tokens.Tests/SupportedAlgorithmTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT License. using System; +using System.Collections.Generic; using Microsoft.IdentityModel.TestUtils; using Xunit; @@ -170,6 +171,47 @@ public static TheoryData IsSupportedAlgorithmAndKe "X509_CustomCryptoProviderFactory", theoryData); + // Add "none" and "noNe" test cases for all key types + var keyTypes = new Dictionary + { + { "JsonWebKey_Ecdsa", KeyingMaterial.JsonWebKeyP256 }, + { "JsonWebKey_Rsa", KeyingMaterial.JsonWebKeyRsa_2048 }, + { "JsonWebKey_Symmetric", KeyingMaterial.JsonWebKeySymmetric256 }, + { "Rsa", KeyingMaterial.RsaSecurityKey_2048 }, + { "Symmetric", KeyingMaterial.DefaultSymmetricSecurityKey_256 }, + { "X509", KeyingMaterial.X509SecurityKeySelfSigned2048_SHA256 }, + { "Ecdsa", KeyingMaterial.Ecdsa384Key } + }; + + // All permutations of "none" with different capitalizations + var nonePermutations = new[] + { + "none", + "None", + "nOne", + "noNe", + "nonE", + "NOne", + "NONe", + "NOnE", + "noNE", + "nONE", + "NoNe", + "NoNE", + "NOnE", + "nONe", + "nonE", + "NONE" + }; + + foreach (var keyType in keyTypes) + { + foreach (var permutation in nonePermutations) + { + SupportedAlgorithmTheoryData.AddTestCase(permutation, keyType.Value, false, $"{keyType.Key}_{permutation}", theoryData); + } + } + return theoryData; } }