public void CreateClaimsPrincipalCrossVersionTest(CrossTokenVersionTheoryData theoryData)
        {
            var             context           = TestUtilities.WriteHeader($"{this}.CreateClaimsPrincipalCrossVersionTest", theoryData);
            SecurityToken4x validatedToken4x  = null;
            SecurityToken   validatedToken5x  = null;
            ClaimsPrincipal claimsPrincipal4x = null;
            ClaimsPrincipal claimsPrincipal5x = null;

            try
            {
                claimsPrincipal4x = CrossVersionUtility.ValidateSaml2Token(theoryData.TokenString4x, theoryData.ValidationParameters4x, out validatedToken4x);
            }
            catch (Exception ex)
            {
                context.Diffs.Add($"CrossVersionTokenValidationTestsData.ValidateToken threw: '{ex}'.");
            }

            try
            {
                claimsPrincipal5x = new Tokens.Saml2.Saml2SecurityTokenHandler().ValidateToken(theoryData.TokenString4x, theoryData.ValidationParameters5x, out validatedToken5x);
            }
            catch (Exception ex)
            {
                context.Diffs.Add($"Tokens.Saml.SamlSecurityTokenHandler().ValidateToken threw: '{ex}'.");
            }

            AreSaml2TokensEqual(validatedToken4x, validatedToken5x, context);
            IdentityComparer.AreClaimsPrincipalsEqual(claimsPrincipal4x, claimsPrincipal5x, context);
            TestUtilities.AssertFailIfErrors(context);
        }
        public void CrossVersionSaml2TokenTest(CrossTokenVersionTheoryData theoryData)
        {
            var context       = TestUtilities.WriteHeader($"{this}.CrossVersionSaml2TokenTest", theoryData);
            var samlHandler5x = new Tokens.Saml2.Saml2SecurityTokenHandler();

            var samlToken4x = CrossVersionUtility.CreateSaml2Token4x(theoryData.TokenDescriptor4x);
            var samlToken5x = samlHandler5x.CreateToken(theoryData.TokenDescriptor5x, theoryData.AuthenticationInformationSaml2) as Saml2SecurityToken;

            AreSaml2TokensEqual(samlToken4x, samlToken5x, context);

            var token4x = CrossVersionUtility.WriteSaml2Token(samlToken4x);
            var token5x = samlHandler5x.WriteToken(samlToken5x);

            var claimsPrincipalFrom4xUsing5xHandler = samlHandler5x.ValidateToken(token4x, theoryData.ValidationParameters5x, out SecurityToken validatedSamlToken4xUsing5xHandler);
            var claimsPrincipalFrom5xUsing5xHandler = samlHandler5x.ValidateToken(token5x, theoryData.ValidationParameters5x, out SecurityToken validatedSamlToken5xUsing5xHandler);
            var claimsPrincipalFrom4xUsing4xHandler = CrossVersionUtility.ValidateSaml2Token(token4x, theoryData.ValidationParameters4x, out SecurityToken4x validatedSamlToken4xUsing4xHandler);
            var claimsPrincipalFrom5xUsing4xHandler = CrossVersionUtility.ValidateSaml2Token(token5x, theoryData.ValidationParameters4x, out SecurityToken4x validatedSamlToken5xUsing4xHandler);

            IdentityComparer.AreClaimsPrincipalsEqual(claimsPrincipalFrom4xUsing4xHandler, claimsPrincipalFrom5xUsing4xHandler, context);
            IdentityComparer.AreClaimsPrincipalsEqual(claimsPrincipalFrom4xUsing5xHandler, claimsPrincipalFrom5xUsing4xHandler, context);
            IdentityComparer.AreClaimsPrincipalsEqual(claimsPrincipalFrom5xUsing5xHandler, claimsPrincipalFrom5xUsing4xHandler, context);

            // the results from ValidateTokenAsync() and ValidateToken() should be the same
            var tokenValidationResult = samlHandler5x.ValidateTokenAsync(token4x, theoryData.ValidationParameters5x);

            IdentityComparer.AreClaimsIdentitiesEqual(claimsPrincipalFrom5xUsing5xHandler.Identity as ClaimsIdentity, tokenValidationResult.Result.ClaimsIdentity, context);

            TestUtilities.AssertFailIfErrors(context);
        }