當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。