本文整理汇总了C#中Invoice.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Invoice.ToString方法的具体用法?C# Invoice.ToString怎么用?C# Invoice.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invoice
的用法示例。
在下文中一共展示了Invoice.ToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ObjectEquals
public void ObjectEquals()
{
var inv1 = new Invoice
{
Amount = 1,
Currency = "RUB",
};
var inv2 = new Invoice
{
Amount = inv1.Amount,
Currency = inv1.Currency,
};
Assert.AreEqual(inv1.ToString(), inv2.ToString());
inv2.Customer = "customer";
Assert.AreNotEqual(inv1.ToString(), inv2.ToString());
inv1.Customer = inv2.Customer;
Assert.AreEqual(inv1.ToString(), inv2.ToString());
inv1.CustomData["custom"] = "data";
Assert.AreNotEqual(inv1.ToString(), inv2.ToString());
inv2.CustomData["custom"] = "data";
Assert.AreEqual(inv1.ToString(), inv2.ToString());
}
示例2: InvoiceCustomData
public void InvoiceCustomData()
{
var inv = new Invoice
{
Amount = 3,
Currency = "RUB",
};
inv.CustomData["sixteen"] = "being tested";
inv.CustomData["bool"] = false;
inv.CustomData["int"] = 42;
inv.CustomData["decimal"] = 42.5m;
inv.Save();
var inv2 = Invoice.Get(inv.Id);
Assert.AreEqual(inv.ToString(), inv2.ToString());
Assert.AreEqual(42.5m, inv2.CustomData.Value<decimal>("decimal"));
inv.CustomData = JObject.Parse("{\"int\": 9000}");
inv.Save();
Assert.AreEqual(9000, inv.CustomData.Value<int>("int"));
}
示例3: InvoiceCreate
public void InvoiceCreate()
{
var inv = new Invoice();
Assert.Null(inv.Account);
Assert.True(inv.Amount == 0);
Assert.True(inv.AmountPaid == 0);
Assert.Null(inv.Currency);
Assert.Null(inv.Customer);
Assert.Null(inv.Description);
Assert.Null(inv.Created);
Assert.Null(inv.Modified);
Assert.Null(inv.Expires);
Assert.Null(inv.TestMode);
Assert.Null(inv.Reference);
inv.Amount = 42.9m;
inv.Currency = "RUB";
inv.Customer = "Посвящаю эту песню Ринату";
inv.Description = "Test invoice ®";
inv.Save();
Assert.AreEqual("acc_111tov4zxNTQObb3", inv.Account);
Assert.AreEqual(42.9m, inv.Amount);
Assert.AreEqual(0, inv.AmountPaid);
Assert.AreEqual("RUB", inv.Currency);
Assert.AreEqual("Посвящаю эту песню Ринату", inv.Customer);
Assert.AreEqual("Test invoice ®", inv.Description);
Assert.That(inv.Created, Is.EqualTo(DateTime.UtcNow).Within(5).Minutes);
Assert.That(inv.Modified, Is.EqualTo(DateTime.UtcNow).Within(5).Minutes);
Assert.AreEqual("", inv.Reference);
Assert.Null(inv.Expires);
Assert.AreEqual(false, inv.TestMode);
var inv2 = Invoice.Get(inv.Id);
Assert.AreEqual(inv.ToString(), inv2.ToString());
}