本文整理汇总了C#中Transaction.ApplyTag方法的典型用法代码示例。如果您正苦于以下问题:C# Transaction.ApplyTag方法的具体用法?C# Transaction.ApplyTag怎么用?C# Transaction.ApplyTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transaction
的用法示例。
在下文中一共展示了Transaction.ApplyTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransactionGraph_AddItemTest
public void TransactionGraph_AddItemTest()
{
GraphItem item = new GraphItem();
Transaction t = new Transaction(-1, 0, "", -100.00, "Rent", "Rent", 1000.00, DateTime.Now, DateTime.Now);
TransactionTag tag = new TransactionTag(-1, new Tag(-1, "Rent", TagType.Expense), t.Amount);
t.ApplyTag(tag, false);
item.AddItem(t);
Assert.IsTrue(item.SubItems.Count == 1, "Count incorrect!");
Assert.AreEqual("Rent", item.SubItems[0].Tag.Name, "Subitem name incorrect!");
Assert.AreEqual(-100.00, item.SubItems[0].Amount, "Subitem amount incorrect!");
}
示例2: TransactionGraph_AddMultipleTransactions
public void TransactionGraph_AddMultipleTransactions()
{
GraphItem item = new GraphItem();
Transaction t = new Transaction(-1, 0, "", -100.00, "Rent", "Rent", 1000.00, DateTime.Now, DateTime.Now);
TransactionTag tag = new TransactionTag(-1, new Tag(-1, "Rent", TagType.Expense), t.Amount);
t.ApplyTag(tag, false);
item.AddItem(t);
t = new Transaction(-1, 0, "", -200.00, "The Pixies Concert", "The Pixies Concert", 900.00, DateTime.Now, DateTime.Now);
tag = new TransactionTag(-1, new Tag(-1, "Leisure - Going Out", TagType.Expense), t.Amount);
t.ApplyTag(tag, false);
item.AddItem(t);
Assert.IsTrue(item.SubItems.Count == 2, "Count incorrect!");
Assert.AreEqual("Rent", item.SubItems[0].Tag.Name, "Subitem name incorrect!");
Assert.AreEqual(-100.00, item.SubItems[0].Amount, "Subitem amount incorrect!");
Assert.AreEqual("Leisure - Going Out", item.SubItems[1].Tag.Name, "Subitem name incorrect!");
Assert.AreEqual(-200.00, item.SubItems[1].Amount, "Subitem amount incorrect!");
Assert.AreEqual(-300.00, item.TotalAmount, "Subitem total amount incorrect!");
}