public ITransaction CreateTransaction(IAccount account, ICategory category, string name, decimal total, DateTime timestamp, long id, decimal weight, IProduct product, ITransaction parentTransaction) { var transaction = new Transaction(account, category, name, total, timestamp, id, weight, product, parentTransaction); parentTransaction?.AddChildTransaction(transaction); return(transaction); }
public void AddChildTransactionTest() { _mainTransaction.AddChildTransaction(_child1); _mainTransaction.AddChildTransaction(_child2); _mainTransaction.AddChildTransaction(_child3); Assert.IsTrue(_mainTransaction.IsComplexTransaction); Assert.AreEqual(280m, _mainTransaction.Total); Assert.AreEqual(_mainTransaction.Account, _child2.Account); Assert.AreEqual(_mainTransaction.Account, _child3.Account); Assert.AreEqual(_mainTransaction.Timestamp, _child1.Timestamp); Assert.AreEqual(_mainTransaction.Timestamp, _child2.Timestamp); Assert.AreEqual(_mainTransaction.Timestamp, _child3.Timestamp); }