public void cardOnly() { TestAccount bank = new TestAccount(); bank.isCreditCard = false; accounts.Add(bank); TestAccount card = new TestAccount(); card.isCreditCard = true; card.transactions.Add(T1); card.transactions.Add(T2); accounts.Add(card); ofx.genOfx(accounts); XmlDocument doc = ofx.doc; Assert.NotNull(doc); Assert.Null(doc.SelectSingleNode("/OFX/BANKMSGSRSV1")); Assert.NotNull(doc.SelectSingleNode("/OFX/CREDITCARDMSGSRSV1")); }
public void lastBalanceTest() { TestAccount acc = new TestAccount(); acc.isCreditCard = false; accounts.Add(acc); Transaction t; t = new Transaction(); t.date = new DateTime(2010, 4, 1); t.desc = "t1"; t.type = TransType.Payment; t.value = 100; t.balance = 10000; acc.transactions.Add(t); t = new Transaction(); t.date = new DateTime(2010, 4, 1); t.desc = "t2"; t.type = TransType.Payment; t.value = 200; t.balance = 20000; acc.transactions.Add(t); t = new Transaction(); t.date = new DateTime(2010, 1, 1); // 逆順 t.desc = "t3"; t.type = TransType.Payment; t.value = 300; t.balance = 30000; acc.transactions.Add(t); ofx.genOfx(accounts); XmlDocument doc = ofx.doc; // 最も新しい日付の最後の取引(t2)の値になっているかどうか確認 XmlNode ledgerBal = doc.SelectSingleNode("/OFX/BANKMSGSRSV1/STMTTRNRS/STMTRS/LEDGERBAL"); assertNodeText(ledgerBal, "DTASOF", "20100401000000[+9:JST]"); assertNodeText(ledgerBal, "BALAMT", "20000"); }
public void normalTest() { TestAccount bank = new TestAccount(); bank.isCreditCard = false; bank.transactions.Add(T1); accounts.Add(bank); TestAccount card = new TestAccount(); card.isCreditCard = true; card.transactions.Add(T2); accounts.Add(card); ofx.genOfx(accounts); XmlDocument doc = ofx.doc; Assert.NotNull(doc); Assert.NotNull(doc.SelectSingleNode("/OFX/BANKMSGSRSV1")); Assert.NotNull(doc.SelectSingleNode("/OFX/CREDITCARDMSGSRSV1")); // 各エントリチェック assertNodeText(doc, "/OFX/SIGNONMSGSRSV1/SONRS/DTSERVER", "20101231000000[+9:JST]"); XmlNode stmtrs = doc.SelectSingleNode("/OFX/BANKMSGSRSV1/STMTTRNRS/STMTRS"); assertNodeText(stmtrs, "BANKTRANLIST/DTSTART", "20000101000000[+9:JST]"); assertNodeText(stmtrs, "LEDGERBAL/DTASOF", "20000101000000[+9:JST]"); assertNodeText(stmtrs, "LEDGERBAL/BALAMT", "10000"); XmlNode ccstmtrs = doc.SelectSingleNode("/OFX/CREDITCARDMSGSRSV1/CCSTMTTRNRS/CCSTMTRS"); assertNodeText(ccstmtrs, "BANKTRANLIST/DTSTART", "20101231000000[+9:JST]"); assertNodeText(ccstmtrs, "LEDGERBAL/DTASOF", "20101231000000[+9:JST]"); assertNodeText(ccstmtrs, "LEDGERBAL/BALAMT", "12000"); }
public void noEntry() { TestAccount account = new TestAccount(); accounts.Add(account); Assert.Throws<InvalidOperationException>(() => ofx.genOfx(accounts)); }