The history functions, I was going to have two collections one for additions and one for subtractions, but in reality I think we can get away with only one and allow the interface code to decide how to display the information.
So the add and subtract routines need to add the money transaction object to a collection. First the test
[Test] public void CheckHistory() { _Engine.AddTransaction(10.10, "test category", "test description", DateTime.Now); List<MoneyTransaction> history = _Engine.History; Assert.AreEqual(1, history.Count); }
We now need to add a history property to the engine class
private List<MoneyTransaction> _History = new List<MoneyTransaction>(); public List<MoneyTransaction> History { get { return _History; } }
the following line is added to the add and subtract methods, after the new money transaction is created
_History.Add(trans);
This showed up a problem with the current code base, the money transaction class is currently declared private, which causes a build error with the property declared above, changing it to public solves this.