public void PopTokenBuilder_Build_ValidateToken_OAuth2Example_XMLFormat_Success_Test1b()
        {
            // Arrange
            var keyValuePairDictionary = new Dictionary <string, string>
            {
                { PopEhtsKeyEnum.Authorization.GetDescription(), "Basic UtKV75JJbVAewOrkHMXhLbiQ11SS" },
                { PopEhtsKeyEnum.Uri.GetDescription(), "/oauth2/v6/tokens" },
                { PopEhtsKeyEnum.HttpMethod.GetDescription(), PopEhtsKeyEnum.Post.GetDescription() },
            };

            var hashMapKeyValuePair = HashMapKeyValuePair.Set <string, string>(keyValuePairDictionary);
            var popTokenBuilder     = new PopTokenBuilder(audience, issuer);

            // Act
            var popToken = popTokenBuilder.SetEhtsKeyValueMap(hashMapKeyValuePair)
                           .SignWith(_privateRsaKeyXml)                 // XML format
                           .Build();

            var publicRsaSecurityKey  = PopTokenBuilderUtils.CreateRsaSecurityKey(_publicRsaKeyXml); // XML format
            var tokenValidationResult = PopTokenBuilderUtils.ValidateToken(popToken, issuer, audience, publicRsaSecurityKey);

            // Assert
            Assert.IsNotNull(popToken);
            Assert.IsNotNull(tokenValidationResult);
            Assert.IsTrue(tokenValidationResult.IsValid);
            Assert.IsTrue(tokenValidationResult.Claims.Count == 9);
        }
        public void PopTokenBuilder_Build_ValidateToken_ApiExample_XmlFormat_Success_Test2b()
        {
            // Arrange
            var keyValuePairDictionary = new Dictionary <string, string>
            {
                { PopEhtsKeyEnum.ContentType.GetDescription(), PopEhtsKeyEnum.ApplicationJson.GetDescription() },
                { PopEhtsKeyEnum.CacheControl.GetDescription(), PopEhtsKeyEnum.NoCache.GetDescription() },
                { PopEhtsKeyEnum.Authorization.GetDescription(), "Bearer UtKV75JJbVAewOrkHMXhLbiQ11SS" },
                { PopEhtsKeyEnum.Uri.GetDescription(), "/commerce/v1/orders" },
                { PopEhtsKeyEnum.HttpMethod.GetDescription(), PopEhtsKeyEnum.Post.GetDescription() },
                { PopEhtsKeyEnum.Body.GetDescription(), "{\"orderId\": 100, \"product\": \"Mobile Phone\"}" }
            };

            var hashMapKeyValuePair = HashMapKeyValuePair.Set <string, string>(keyValuePairDictionary);
            var popTokenBuilder     = new PopTokenBuilder(audience, issuer);

            // Act
            var popToken = popTokenBuilder.SetEhtsKeyValueMap(hashMapKeyValuePair)
                           .SignWith(_privateRsaKeyXml)                  // XML format
                           .Build();

            var publicRsaSecurityKey  = PopTokenBuilderUtils.CreateRsaSecurityKey(_publicRsaKeyXml); // XML format
            var tokenValidationResult = PopTokenBuilderUtils.ValidateToken(popToken, issuer, audience, publicRsaSecurityKey);

            //Assert
            Assert.IsNotNull(popToken);
            Assert.IsNotNull(tokenValidationResult);
            Assert.IsTrue(tokenValidationResult.IsValid);
            Assert.IsTrue(tokenValidationResult.Claims.Count == 9);
        }