diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs index 7d9fcb8b2f..babf9be5f6 100644 --- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs +++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs @@ -66,14 +66,15 @@ public void ValidateTokenValidationResult(JsonWebTokenTheoryData theoryData) [Theory, MemberData(nameof(TokenValidationClaimsTheoryData))] public void ValidateTokenDerivedHandlerValidationResult(JsonWebTokenTheoryData theoryData) { - TestUtilities.WriteHeader($"{this}.ValidateTokenDerivedHandlerValidationResult"); - var derivedJsonWebTokenHandler = new DerivedJsonWebTokenHandler(); + var context = TestUtilities.WriteHeader($"{this}.ValidateTokenDerivedHandlerValidationResult", theoryData); + var derivedJsonWebTokenHandler = new DerivedJsonWebTokenHandler(); var tokenValidationResult = theoryData.TokenHandler.ValidateToken(theoryData.AccessToken, theoryData.ValidationParameters); var tokenValidationDerivedResult = derivedJsonWebTokenHandler.ValidateToken(theoryData.AccessToken, theoryData.ValidationParameters); - IdentityComparer.AreEqual(tokenValidationResult.Claims, TokenUtilities.CreateDictionaryFromClaims(tokenValidationResult.ClaimsIdentity.Claims)); - IdentityComparer.AreEqual(tokenValidationDerivedResult.Claims, TokenUtilities.CreateDictionaryFromClaims(tokenValidationDerivedResult.ClaimsIdentity.Claims)); - IdentityComparer.AreEqual(tokenValidationResult.Claims, tokenValidationDerivedResult.Claims); - IdentityComparer.AreEqual(tokenValidationResult.ClaimsIdentity.Claims, tokenValidationDerivedResult.ClaimsIdentity.Claims); + IdentityComparer.AreEqual(tokenValidationResult.Claims, TokenUtilities.CreateDictionaryFromClaims(tokenValidationResult.ClaimsIdentity.Claims), context); + IdentityComparer.AreEqual(tokenValidationDerivedResult.Claims, TokenUtilities.CreateDictionaryFromClaims(tokenValidationDerivedResult.ClaimsIdentity.Claims), context); + IdentityComparer.AreEqual(tokenValidationResult.Claims, tokenValidationDerivedResult.Claims, context); + IdentityComparer.AreEqual(tokenValidationResult.ClaimsIdentity.Claims, tokenValidationDerivedResult.ClaimsIdentity.Claims, context); + TestUtilities.AssertFailIfErrors(context); } public static TheoryData TokenValidationClaimsTheoryData() diff --git a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTheoryData.cs b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTheoryData.cs index 13bd9e1024..05eb59b170 100644 --- a/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTheoryData.cs +++ b/test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenTheoryData.cs @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using Microsoft.IdentityModel.TestUtils; using Microsoft.IdentityModel.Tokens; namespace Microsoft.IdentityModel.JsonWebTokens.Tests { - public class JsonWebTokenTheoryData + public class JsonWebTokenTheoryData : TheoryDataBase { public TokenValidationParameters ValidationParameters { get; set; }