当前位置: 首页>>代码示例>>C#>>正文


C# TransactionRequest.ToXml方法代码示例

本文整理汇总了C#中Braintree.TransactionRequest.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# TransactionRequest.ToXml方法的具体用法?C# TransactionRequest.ToXml怎么用?C# TransactionRequest.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Braintree.TransactionRequest的用法示例。


在下文中一共展示了TransactionRequest.ToXml方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ToXml_Includes_DeviceData

        public void ToXml_Includes_DeviceData()
        {
            TransactionRequest request = new TransactionRequest();
            request.DeviceData = "{\"device_session_id\":\"my_dsid\", \"fraud_merchant_id\":\"my_fmid\"}";

            Assert.IsTrue(request.ToXml().Contains("device-data"));
            Assert.IsTrue(request.ToXml().Contains("device_session_id"));
            Assert.IsTrue(request.ToXml().Contains("my_dsid"));
            Assert.IsTrue(request.ToXml().Contains("fraud_merchant_id"));
            Assert.IsTrue(request.ToXml().Contains("my_fmid"));
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:11,代码来源:TransactionRequestTest.cs

示例2: ToXml_InludesPaymentMethodNonce

        public void ToXml_InludesPaymentMethodNonce()
        {
            TransactionRequest request = new TransactionRequest();
            request.PaymentMethodNonce = "1232131232";

            Assert.IsTrue(request.ToXml().Contains("1232131232"));
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs

示例3: ToXml_Includes_FraudMerchantId

        public void ToXml_Includes_FraudMerchantId()
        {
            TransactionRequest request = new TransactionRequest();
            request.FraudMerchantId = "my_fmid";

            Assert.IsTrue(request.ToXml().Contains("my_fmid"));
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs

示例4: ToXml_Includes_DeviceSessionId

        public void ToXml_Includes_DeviceSessionId()
        {
            TransactionRequest request = new TransactionRequest();
            request.DeviceSessionId = "my_dsid";

            Assert.IsTrue(request.ToXml().Contains("my_dsid"));
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:7,代码来源:TransactionRequestTest.cs

示例5: ToXML_EscapesGeneratedXMLForString

        public void ToXML_EscapesGeneratedXMLForString()
        {
            TransactionRequest request = new TransactionRequest
            {
                OrderId = "<>&\"'"
            };

            TestHelper.AssertIncludes("<order-id>&lt;&gt;&amp;&quot;&apos;</order-id>", request.ToXml());
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:9,代码来源:RequestTest.cs

示例6: ToXML_EscapesGeneratedXMLForNestedSearchCriteria

        public void ToXML_EscapesGeneratedXMLForNestedSearchCriteria()
        {
            TransactionRequest request = new TransactionRequest
            {
                Customer = new CustomerRequest
                {
                    FirstName = "<John>"
                }
            };

            TestHelper.AssertIncludes("<first-name>&lt;John&gt;</first-name>", request.ToXml());
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:12,代码来源:RequestTest.cs

示例7: ToXML_EnsuresUSLocaleForDecimals

        public void ToXML_EnsuresUSLocaleForDecimals()
        {
            System.Globalization.CultureInfo existingCulture = System.Globalization.CultureInfo.CurrentCulture;

            try
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("it-IT");

                TransactionRequest transactionRequest = new TransactionRequest
                {
                    Amount = 100.0M
                };

                SubscriptionRequest subscriptionRequest = new SubscriptionRequest
                {
                    Price = 200.0M,
                };

                SubscriptionTransactionRequest subscriptionTransactionRequest = new SubscriptionTransactionRequest
                {
                    Amount = 300.0M
                };

                ModificationRequest modificationRequest = new ModificationRequest
                {
                    Amount = 400.0M
                };

                TestHelper.AssertIncludes("<amount>100.0</amount>", transactionRequest.ToXml());
                TestHelper.AssertIncludes("<price>200.0</price>", subscriptionRequest.ToXml());
                TestHelper.AssertIncludes("<amount>300.0</amount>", subscriptionTransactionRequest.ToXml());
                TestHelper.AssertIncludes("<amount>400.0</amount>", modificationRequest.ToXml("root"));
            }
            finally
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = existingCulture;
            }
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:38,代码来源:RequestTest.cs

示例8: ToXML_EscapesGeneratedXMLForCustomFields

        public void ToXML_EscapesGeneratedXMLForCustomFields()
        {
            TransactionRequest request = new TransactionRequest
            {
                CustomFields = new Dictionary<String, String>
                {
                    { "<key>", "val&ue" }
                }
            };

            TestHelper.AssertIncludes("<custom-fields><&lt;key&gt;>val&amp;ue</&lt;key&gt;></custom-fields>", request.ToXml());
        }
开发者ID:zxed,项目名称:braintree_dotnet,代码行数:12,代码来源:RequestTest.cs


注:本文中的Braintree.TransactionRequest.ToXml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。