Skip to content

Commit

Permalink
Add disable discovery enumeration = true to all theory tests (#2849)
Browse files Browse the repository at this point in the history
* add disable discovery enumeration = true to all theory tests

* fix copy past error
  • Loading branch information
kellyyangsong authored Sep 26, 2024
1 parent 5de1dc8 commit c2d8e4b
Show file tree
Hide file tree
Showing 87 changed files with 358 additions and 358 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class JsonClaimSetTests
new Claim("dateTimeIso8061", _dateTime.ToUniversalTime().ToString("o", CultureInfo.InvariantCulture), ClaimValueTypes.DateTime, "LOCAL AUTHORITY", "LOCAL AUTHORITY"),
};

[Theory, MemberData(nameof(DirectClaimSetTestCases))]
[Theory, MemberData(nameof(DirectClaimSetTestCases), DisableDiscoveryEnumeration = true)]
public void DirectClaimSetTests(JsonClaimSetTheoryData theoryData)
{
CompareContext context = TestUtilities.WriteHeader($"{this}.ClaimSetTests", theoryData);
Expand Down Expand Up @@ -78,7 +78,7 @@ public static TheoryData<JsonClaimSetTheoryData> DirectClaimSetTestCases()
return theoryData;
}

[Theory, MemberData(nameof(GetClaimAsTypeTheoryData))]
[Theory, MemberData(nameof(GetClaimAsTypeTheoryData), DisableDiscoveryEnumeration = true)]
public void GetClaimAsType(JsonClaimSetTheoryData theoryData)
{
CompareContext context = TestUtilities.WriteHeader($"{this}.GetClaimAsType", theoryData);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.IdentityModel.JsonWebTokens.Tests
{
public class JsonWebTokenHandlerValidationParametersTests
{
[Theory, MemberData(nameof(JsonWebTokenHandlerValidationParametersTestCases))]
[Theory, MemberData(nameof(JsonWebTokenHandlerValidationParametersTestCases), DisableDiscoveryEnumeration = true)]
public async Task ValidateTokenAsync(JsonWebTokenHandlerValidationParametersTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ValidateTokenAsync", theoryData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1466,7 +1466,7 @@ public static TheoryData<GetPayloadValueTheoryData> GetPayloadValueTheoryData

// Time values can be floats, ints, or strings.
// This test checks to make sure that parsing does not fault in any of the above cases.
[Theory, MemberData(nameof(ParseTimeValuesTheoryData))]
[Theory, MemberData(nameof(ParseTimeValuesTheoryData), DisableDiscoveryEnumeration = true)]
public void ParseTimeValues(ParseTimeValuesTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ParseTimeValues", theoryData);
Expand Down Expand Up @@ -1544,7 +1544,7 @@ public static TheoryData<ParseTimeValuesTheoryData> ParseTimeValuesTheoryData
// Test ensures that we only try to populate a JsonWebToken from a string if it is a properly formatted JWT.
// More specifically, we only want to try and decode
// a JWT token if it has the correct number of (JWE or JWS) token parts.
[Theory, MemberData(nameof(ParseTokenTheoryData))]
[Theory, MemberData(nameof(ParseTokenTheoryData), DisableDiscoveryEnumeration = true)]
public void ParseToken(JwtTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ParseToken", theoryData);
Expand Down Expand Up @@ -1721,7 +1721,7 @@ public void DifferentCultureJsonWebToken()
}

// Test to verify equality between JsonWebTokens created from a string and an equivalent span
[Theory, MemberData(nameof(ParseTokenTheoryData))]
[Theory, MemberData(nameof(ParseTokenTheoryData), DisableDiscoveryEnumeration = true)]
public void StringAndMemoryConstructors_CreateEquivalentTokens(JwtTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.CompareJsonWebToken", theoryData);
Expand Down
2 changes: 1 addition & 1 deletion test/Microsoft.IdentityModel.Logging.Tests/LoggerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public void PrepareMessageWithNoArguments()
var exception = LogHelper.LogExceptionMessage(new ArgumentException("This is the first parameter '{0}'. This is the second parameter '{1}'."));
}

[Theory, MemberData(nameof(LoggerTestTheoryData))]
[Theory, MemberData(nameof(LoggerTestTheoryData), DisableDiscoveryEnumeration = true)]
public void LoggerInstanceTests(LoggerTheoryData theoryData)
{
LogHelper.Logger = theoryData.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Microsoft.IdentityModel.Protocols.OpenIdConnect.Tests
/// </summary>
public class End2EndTests
{
[Theory, MemberData(nameof(OpenIdConnectTheoryData))]
[Theory, MemberData(nameof(OpenIdConnectTheoryData), DisableDiscoveryEnumeration = true)]
public async Task OpenIdConnect(OpenIdConnectTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.OpenIdConnect", theoryData);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ public void GetSets()
TestUtilities.AssertFailIfErrors("OpenIdConnectMessage_GetSets*** Test Failures:\n", context.Errors);
}

[Theory, MemberData(nameof(CreateAuthenticationRequestUrlTheoryData))]
[Theory, MemberData(nameof(CreateAuthenticationRequestUrlTheoryData), DisableDiscoveryEnumeration = true)]
public void OidcCreateAuthenticationRequestUrl(string testId, OpenIdConnectMessage message, string expectedMessage)
{
TestUtilities.WriteHeader(testId, "OidcCreateAuthenticationRequestUrl", true);
Expand Down Expand Up @@ -542,7 +542,7 @@ public static TheoryData<string, OpenIdConnectMessage, string> CreateAuthenticat
return theoryData;
}

[Theory, MemberData(nameof(CreateLogoutRequestUrlTheoryData))]
[Theory, MemberData(nameof(CreateLogoutRequestUrlTheoryData), DisableDiscoveryEnumeration = true)]
public void OidcCreateLogoutRequestUrl(string testId, OpenIdConnectMessage message, string expectedMessage)
{
TestUtilities.WriteHeader("OidcCreateLogoutRequestUrl - " + testId, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public void GetSets()
}


[Theory, MemberData(nameof(ValidateAuthenticationResponseTheoryData))]
[Theory, MemberData(nameof(ValidateAuthenticationResponseTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateAuthenticationResponse(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateAuthenticationResponse", theoryData);
Expand Down Expand Up @@ -277,7 +277,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateAuthentication
}
}

[Theory, MemberData(nameof(ValidateTokenResponseTheoryData))]
[Theory, MemberData(nameof(ValidateTokenResponseTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateTokenResponse(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateTokenResponse", theoryData);
Expand Down Expand Up @@ -376,7 +376,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateTokenResponseT
}
}

[Theory, MemberData(nameof(ValidateUserInfoResponseTheoryData))]
[Theory, MemberData(nameof(ValidateUserInfoResponseTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateUserInfoResponse(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateUserInfoResponse", theoryData);
Expand Down Expand Up @@ -498,7 +498,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateUserInfoRespon
}
}

[Theory, MemberData(nameof(ValidateIdTokenTheoryData))]
[Theory, MemberData(nameof(ValidateIdTokenTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateIdToken(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateIdToken", theoryData);
Expand Down Expand Up @@ -726,7 +726,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateIdTokenTheoryD
}
}

[Theory, MemberData(nameof(ValidateCHashTheoryData))]
[Theory, MemberData(nameof(ValidateCHashTheoryData), DisableDiscoveryEnumeration = true)]
private void ValidateCHash(OidcProtocolValidatorTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ValidateCHash", theoryData);
Expand Down Expand Up @@ -960,7 +960,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateCHashTheoryDat
}
}

[Theory, MemberData(nameof(ValidateJWEPayloadCHashTheoryData))]
[Theory, MemberData(nameof(ValidateJWEPayloadCHashTheoryData), DisableDiscoveryEnumeration = true)]
private void ValidateJWEPayloadCHash(OidcProtocolValidatorTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ValidateJWEPayloadCHash", theoryData);
Expand Down Expand Up @@ -1091,7 +1091,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateJWEPayloadCHas
}
}

[Theory, MemberData(nameof(ValidateNonceTheoryData))]
[Theory, MemberData(nameof(ValidateNonceTheoryData), DisableDiscoveryEnumeration = true)]
private void ValidateNonce(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateNonce", theoryData);
Expand Down Expand Up @@ -1317,7 +1317,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateNonceTheoryDat
}
}

[Theory, MemberData(nameof(ValidateAtHashTheoryData))]
[Theory, MemberData(nameof(ValidateAtHashTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateAtHash(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateAtHash", theoryData);
Expand Down Expand Up @@ -1429,7 +1429,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateAtHashTheoryDa
}
}

[Theory, MemberData(nameof(ValidateJWEPayloadAtHashTheoryData))]
[Theory, MemberData(nameof(ValidateJWEPayloadAtHashTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateJWEPayloadAtHash(OidcProtocolValidatorTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ValidateJWEPayloadAtHash", theoryData);
Expand Down Expand Up @@ -1470,7 +1470,7 @@ public static TheoryData<OidcProtocolValidatorTheoryData> ValidateJWEPayloadAtHa
}
}

[Theory, MemberData(nameof(ValidateStateTheoryData))]
[Theory, MemberData(nameof(ValidateStateTheoryData), DisableDiscoveryEnumeration = true)]
public void ValidateState(OidcProtocolValidatorTheoryData theoryData)
{
TestUtilities.WriteHeader($"{this}.ValidateState", theoryData);
Expand Down Expand Up @@ -1629,7 +1629,7 @@ public void DefaultAlgorithmMapTest(string algorithm, string expectedHash, bool
Assert.Equal(hashFound, expectedHash);
}

[Theory, MemberData(nameof(HashAlgorithmExtensibilityTheoryData))]
[Theory, MemberData(nameof(HashAlgorithmExtensibilityTheoryData), DisableDiscoveryEnumeration = true)]
public void HashAlgorithmExtensibility(OpenIdConnectProtocolValidator protocolValidator, string alg, Type algorithmType, ExpectedException ee)
{
ee.Verbose = false;
Expand Down Expand Up @@ -1702,7 +1702,7 @@ public static TheoryData<OpenIdConnectProtocolValidator, string, Type, ExpectedE
}
}

[Theory, MemberData(nameof(GetHashAlgorithmTheoryData))]
[Theory, MemberData(nameof(GetHashAlgorithmTheoryData), DisableDiscoveryEnumeration = true)]
public void GetHashAlgorithm(OpenIdConnectProtocolValidator protocolValidator, string alg, Type algorithmType, ExpectedException ee)
{
ee.Verbose = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class PopKeyResolvingTests
{
internal const string _defaultJkuDomain = "contoso.com";

[Theory, MemberData(nameof(ResolvePopKeyFromCnfClaimAsyncTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromCnfClaimAsyncTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyFromCnfClaimAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyFromCnfClaimAsync", theoryData);
Expand Down Expand Up @@ -142,7 +142,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyFromCnfClaimAsync
}
}

[Theory, MemberData(nameof(ResolvePopKeyAsyncTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyAsyncTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyTheoryData", theoryData);
Expand Down Expand Up @@ -198,7 +198,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyAsyncTheoryData
}
}

[Theory, MemberData(nameof(ResolvePopKeyFromJwkTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromJwkTheoryData), DisableDiscoveryEnumeration = true)]
public void ResolvePopKeyFromJwk(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyTheoryData", theoryData);
Expand Down Expand Up @@ -269,7 +269,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyFromJwkTheoryData
}
}

[Theory, MemberData(nameof(ResolvePopKeyFromJweTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromJweTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyFromJweAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyFromJwe", theoryData);
Expand Down Expand Up @@ -393,7 +393,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyFromJweTheoryData
}
}

[Theory, MemberData(nameof(ResolvePopKeyFromJkuTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromJkuTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyFromJkuAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyFromJkuAsync", theoryData);
Expand Down Expand Up @@ -562,7 +562,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyFromJkuTheoryData
}
}

[Theory, MemberData(nameof(GetCnfClaimValueTheoryData))]
[Theory, MemberData(nameof(GetCnfClaimValueTheoryData), DisableDiscoveryEnumeration = true)]
public void GetCnfClaimValue(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.GetCnfClaimValue", theoryData);
Expand Down Expand Up @@ -625,7 +625,7 @@ public static TheoryData<ResolvePopKeyTheoryData> GetCnfClaimValueTheoryData
}
}

[Theory, MemberData(nameof(ResolvePopKeyFromJkuKidTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromJkuKidTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyFromJkuKidAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyFromJkuKidAsync", theoryData);
Expand Down Expand Up @@ -742,7 +742,7 @@ public static TheoryData<ResolvePopKeyTheoryData> ResolvePopKeyFromJkuKidTheoryD
}
}

[Theory(Skip = "flaky"), MemberData(nameof(GetPopKeysFromJkuAsyncTheoryData))]
[Theory(Skip = "flaky"), MemberData(nameof(GetPopKeysFromJkuAsyncTheoryData), DisableDiscoveryEnumeration = true)]
public async Task GetPopKeysFromJkuAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.GetPopKeysFromJkuAsync", theoryData);
Expand Down Expand Up @@ -856,7 +856,7 @@ public static TheoryData<ResolvePopKeyTheoryData> GetPopKeysFromJkuAsyncTheoryDa
}
}

[Theory, MemberData(nameof(ResolvePopKeyFromKeyIdentifierAsyncTheoryData))]
[Theory, MemberData(nameof(ResolvePopKeyFromKeyIdentifierAsyncTheoryData), DisableDiscoveryEnumeration = true)]
public async Task ResolvePopKeyFromKeyIdentifierAsync(ResolvePopKeyTheoryData theoryData)
{
var context = TestUtilities.WriteHeader($"{this}.ResolvePopKeyFromKeyIdentifierAsync", theoryData);
Expand Down
Loading

0 comments on commit c2d8e4b

Please sign in to comment.