本文整理汇总了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>");
}
示例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);
}
示例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);
}
示例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);
}