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


C# ProcessPaymentRequest.DeserializeCustomValues方法代码示例

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


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

示例1: Can_serialize_and_deserialize_CustomValues

        public void Can_serialize_and_deserialize_CustomValues()
        {
            var processPaymentRequest = new ProcessPaymentRequest();
            processPaymentRequest.CustomValues.Add("key1", "value1");
            processPaymentRequest.CustomValues.Add("key2", null);
            processPaymentRequest.CustomValues.Add("key3", 3);
            processPaymentRequest.CustomValues.Add("<test key4>", "<test value 4>");
            var serializedXml = processPaymentRequest.SerializeCustomValues();
            var deserialized = processPaymentRequest.DeserializeCustomValues(serializedXml);

            deserialized.ShouldNotBeNull();
            deserialized.Count.ShouldEqual(4);

            deserialized.ContainsKey("key1").ShouldEqual(true);
            deserialized["key1"].ShouldEqual("value1");

            deserialized.ContainsKey("key2").ShouldEqual(true);
            //deserialized["key2"].ShouldEqual(null);
            deserialized["key2"].ShouldEqual("");

            deserialized.ContainsKey("key3").ShouldEqual(true);
            deserialized["key3"].ShouldEqual("3");

            deserialized.ContainsKey("<test key4>").ShouldEqual(true);
            deserialized["<test key4>"].ShouldEqual("<test value 4>");
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:26,代码来源:PaymentExtensionTests.cs

示例2: Can_deserialize_null_string

        public void Can_deserialize_null_string()
        {
            var processPaymentRequest = new ProcessPaymentRequest();
            var deserialized = processPaymentRequest.DeserializeCustomValues(null);

            deserialized.ShouldNotBeNull();
            deserialized.Count.ShouldEqual(0);
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:8,代码来源:PaymentExtensionTests.cs

示例3: DeserializeCustomValues

        /// <summary>
        /// Deerialize CustomValues of Order
        /// </summary>
        /// <param name="order">Order</param>
        /// <returns>Serialized CustomValues CustomValues</returns>
        public static Dictionary<string, object> DeserializeCustomValues(this Order order)
        {
            if (order == null)
                throw new ArgumentNullException("order");

            var request = new ProcessPaymentRequest();
            return request.DeserializeCustomValues(order.CustomValuesXml);
        }
开发者ID:shuangyu1937,项目名称:nopCommerce,代码行数:13,代码来源:PaymentExtensions.cs

示例4: Can_serialize_and_deserialize_empty_CustomValues

        public void Can_serialize_and_deserialize_empty_CustomValues()
        {
            var processPaymentRequest = new ProcessPaymentRequest();
            var serializedXml = processPaymentRequest.SerializeCustomValues();
            var deserialized = processPaymentRequest.DeserializeCustomValues(serializedXml);

            deserialized.ShouldNotBeNull();
            deserialized.Count.ShouldEqual(0);
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:9,代码来源:PaymentExtensionTests.cs


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