|
2 | 2 | // Licensed under the MIT License.
|
3 | 3 |
|
4 | 4 | using System;
|
| 5 | +using System.Collections.Generic; |
5 | 6 | using Microsoft.IdentityModel.TestUtils;
|
6 | 7 | using Xunit;
|
7 | 8 |
|
@@ -170,6 +171,47 @@ public static TheoryData<SupportedAlgorithmTheoryData> IsSupportedAlgorithmAndKe
|
170 | 171 | "X509_CustomCryptoProviderFactory",
|
171 | 172 | theoryData);
|
172 | 173 |
|
| 174 | + // Add "none" and "noNe" test cases for all key types |
| 175 | + var keyTypes = new Dictionary<string, SecurityKey> |
| 176 | + { |
| 177 | + { "JsonWebKey_Ecdsa", KeyingMaterial.JsonWebKeyP256 }, |
| 178 | + { "JsonWebKey_Rsa", KeyingMaterial.JsonWebKeyRsa_2048 }, |
| 179 | + { "JsonWebKey_Symmetric", KeyingMaterial.JsonWebKeySymmetric256 }, |
| 180 | + { "Rsa", KeyingMaterial.RsaSecurityKey_2048 }, |
| 181 | + { "Symmetric", KeyingMaterial.DefaultSymmetricSecurityKey_256 }, |
| 182 | + { "X509", KeyingMaterial.X509SecurityKeySelfSigned2048_SHA256 }, |
| 183 | + { "Ecdsa", KeyingMaterial.Ecdsa384Key } |
| 184 | + }; |
| 185 | + |
| 186 | + // All permutations of "none" with different capitalizations |
| 187 | + var nonePermutations = new[] |
| 188 | + { |
| 189 | + "none", |
| 190 | + "None", |
| 191 | + "nOne", |
| 192 | + "noNe", |
| 193 | + "nonE", |
| 194 | + "NOne", |
| 195 | + "NONe", |
| 196 | + "NOnE", |
| 197 | + "noNE", |
| 198 | + "nONE", |
| 199 | + "NoNe", |
| 200 | + "NoNE", |
| 201 | + "NOnE", |
| 202 | + "nONe", |
| 203 | + "nonE", |
| 204 | + "NONE" |
| 205 | + }; |
| 206 | + |
| 207 | + foreach (var keyType in keyTypes) |
| 208 | + { |
| 209 | + foreach (var permutation in nonePermutations) |
| 210 | + { |
| 211 | + SupportedAlgorithmTheoryData.AddTestCase(permutation, keyType.Value, false, $"{keyType.Key}_{permutation}", theoryData); |
| 212 | + } |
| 213 | + } |
| 214 | + |
173 | 215 | return theoryData;
|
174 | 216 | }
|
175 | 217 | }
|
|
0 commit comments