本文整理汇总了C#中SubscriptionRequest.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# SubscriptionRequest.ToXml方法的具体用法?C# SubscriptionRequest.ToXml怎么用?C# SubscriptionRequest.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubscriptionRequest
的用法示例。
在下文中一共展示了SubscriptionRequest.ToXml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ToXML_EnsuresUSLocaleForDecimals
public void ToXML_EnsuresUSLocaleForDecimals()
{
CultureInfo existingCulture = CultureInfo.CurrentCulture;
try
{
#if netcore
CultureInfo.CurrentCulture = new CultureInfo("it-IT");
#else
Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("it-IT");
#endif
TransactionRequest transactionRequest = new TransactionRequest
{
Amount = 100.0M,
TaxAmount = 10.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.00</amount>", transactionRequest.ToXml());
TestHelper.AssertIncludes("<tax-amount>10.00</tax-amount>", transactionRequest.ToXml());
TestHelper.AssertIncludes("<price>200.00</price>", subscriptionRequest.ToXml());
TestHelper.AssertIncludes("<amount>300.00</amount>", subscriptionTransactionRequest.ToXml());
TestHelper.AssertIncludes("<amount>400.00</amount>", modificationRequest.ToXml("root"));
}
finally
{
#if netcore
CultureInfo.CurrentCulture = existingCulture;
#else
Thread.CurrentThread.CurrentCulture = existingCulture;
#endif
}
}
示例2: 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;
}
}