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!"); }
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!"); }