public static Document CreateTestDocument(string xmlString) { XElement root = XDocument.Parse(xmlString).Root; Document document = new Document(); //Initialize Reserves foreach (var t in root.Elements("Type")) { ReserveType type = new ReserveType(); type.Name = t.Attribute("name").Value; document.AddModelObject<ReserveType>(type); foreach (var c in t.Elements()) { Reserve reserve = new Reserve(1000); reserve.Name = c.Attribute("name").Value; reserve.Type = type; document.AddModelObject<Reserve>(reserve); } } //Initialize Categories foreach (var e in root.Element("Expenses").Elements("Item")) { createCategory(document, null, e, CategoryType.Expense); } foreach (var i in root.Element("Incomes").Elements("Source")) { createCategory(document, null, i, CategoryType.Income); } createTransactions(document); Budget budget = new Budget(Period.CurrentWeek); budget.Name = "Week Budget"; document.AddBudget(budget); budget = new Budget(Period.CurrentMonth); budget.Name = "Month Budget"; document.AddBudget(budget); budget = new Budget(Period.CurrentQuarter); budget.Name = "Quarter Budget"; document.AddBudget(budget); budget = new Budget(Period.CurrentYear); budget.Name = "Year Budget"; document.AddBudget(budget); return document; }
public static Reserve CreateReserve(string name, double initialBalance) { Reserve reserve = new Reserve(initialBalance); reserve.Name = name; return reserve; }