public void TextualParser_ParsePost_ExpensesFoodGroceriesIntegrationTest() { string line = " Expenses:Food:Groceries $ 37.50 ; [=2011/03/01]"; TextualParser parser = CreateTextualParser(); Account account = new Account(); Xact xact = new Xact(); Post post = parser.ParsePost(line, xact, account); Assert.IsNotNull(post); Assert.AreEqual("Expenses:Food:Groceries", post.Account.FullName); Assert.AreEqual("$", post.Amount.Commodity.Symbol); Assert.AreEqual(BigInt.Parse("37.50", 2), post.Amount.Quantity); Assert.AreEqual(new Date(2011, 03, 01), post.DateAux); }
public void TextualParser_ParsePost_AssetsWyshonaItemsIntegrationTest() { string line = " Assets:Wyshona:Items \"Plans: Wildthorn Mail\" 1 {1.25G}"; TextualParser parser = CreateTextualParser(); Account account = new Account(); Xact xact = new Xact(); Post post = parser.ParsePost(line, xact, account); Assert.IsNotNull(post); Assert.AreEqual("Assets:Wyshona:Items", post.Account.FullName); Assert.AreEqual("\"Plans: Wildthorn Mail\"", post.Amount.Commodity.Symbol); Assert.AreEqual(BigInt.Parse("1"), post.Amount.Quantity); Assert.AreEqual("G", ((AnnotatedCommodity)post.Amount.Commodity).Details.Price.Commodity.Symbol); Assert.AreEqual(BigInt.Parse("1.25", 2), ((AnnotatedCommodity)post.Amount.Commodity).Details.Price.Quantity); }
public void TextualParser_ParsePost_BrokerageIntegrationTest() { string line = " Assets:Brokerage 50 AAPL @ $30.00"; TextualParser parser = CreateTextualParser(); Account account = new Account(); Xact xact = new Xact(); Post post = parser.ParsePost(line, xact, account); Assert.IsNotNull(post); Assert.AreEqual("Assets:Brokerage", post.Account.FullName); Assert.AreEqual("AAPL", post.Amount.Commodity.Symbol); Assert.AreEqual(BigInt.Parse("50"), post.Amount.Quantity); Assert.AreEqual("$", post.Cost.Commodity.Symbol); Assert.AreEqual(BigInt.Parse("1500", 2), post.Cost.Quantity); Assert.AreEqual(post.Cost, post.GivenCost); }