Example #1
0
        public void CanParseTransactionXml()
        {
            Transaction transaction = TransactionParser.Parse(_xml);

            CheckIf.EqualId("419124c2108f39c94378c488dda67348", transaction.Id, "Transaction id should be parsed");
            Assert.AreEqual("RUB", transaction.Currency, "Transaction currency should be parsed");

            Assert.AreEqual(
                new DateTimeOffset(2013, 12, 9, 23, 00, 00, new TimeSpan(3, 0, 0)),
                transaction.Posted,
                "Transaction posted date should be parsed");

            Assert.AreEqual(
                new DateTimeOffset(2014, 1, 6, 15, 30, 21, new TimeSpan(3, 0, 0)),
                transaction.Entered,
                "Transaction entered date should be parsed");

            Assert.AreEqual("Обои (отдавать маме)", transaction.Description, "Transaction description should be parsed");

            Assert.AreEqual(2, transaction.Splits.Count, "Transaction splits should be parsed");

            AssertSplitValues(
                "e739f02a5e4ced52a8974292d183727f", "b43f593c319ae9bf475ddb2af3953b38", 10000.00m, 10000.00m,
                transaction.Splits[0]);

            AssertSplitValues(
                "0db32508c93b252e0acb168787d82289", "f7e5c9bd34d8cd881f481d837d98f94d", -10000.00m, -10000.00m,
                transaction.Splits[1]);
        }
        public void CanParseAccountXml()
        {
            Account account = AccountParser.Parse(_xml);

            Assert.AreEqual("Сбер-вклад", account.Name, "Account name should be parsed");
            Assert.AreEqual("BANK", account.Type, "Account type should be parsed");
            CheckIf.EqualId("5a977b5e74b8dbaa94239d15c889798d", account.Id, "Account id should be parsed");
            CheckIf.EqualId("4f21b4bc82713c0a03457515456ecb78", account.ParentId.Value, "Account parent id should be parsed");
            Assert.AreEqual("RUB", account.Commodity, "Account commodity should be parsed");
        }
Example #3
0
        public void CanParseBookXml()
        {
            Book book = BookParser.Parse(_xml);

            CheckIf.EqualId("3dd199f14b9d79e170caa4653fa152f2", book.Id, "Book id should be parsed");

            List <Account>     accounts     = book.Accounts;
            List <Transaction> transactions = book.Transactions;

            Assert.AreEqual(3, accounts.Count, "Accounts should be parsed");
            Assert.AreEqual(3, transactions.Count, "Transactions should be parsed");
        }
Example #4
0
 private static void AssertSplitValues(
     string expectedSplitId,
     string expectedAccountId,
     decimal expectedValue,
     decimal expectedQuantity,
     TransactionSplit actualSplit)
 {
     CheckIf.EqualId(expectedSplitId, actualSplit.Id, "Transaction split id should be parsed");
     Assert.AreEqual(expectedValue, actualSplit.Value, "Transaction split value should be parsed");
     Assert.AreEqual(expectedQuantity, actualSplit.Quantity, "Transaction split quantity should be parsed");
     CheckIf.EqualId(expectedAccountId, actualSplit.AccountId, "Transaction split account id should be parsed");
 }