コード例 #1
0
        public void CreditPayment_InvalidTest()
        {
            FinanceManager financeManager = new FinanceManager();

            FinantialDB.Accounts.Clear();
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            IAccount account = FinantialDB.Accounts.Values.ToList()[0];

            double oldCredit = account.CreditPayment;

            Assert.Throws <KeyNotFoundException>(() => financeManager.CreditPayment(Guid.NewGuid(), 100));
        }
コード例 #2
0
        public void CreditPayment_ValidTest()
        {
            FinanceManager financeManager = new FinanceManager();

            FinantialDB.Accounts.Clear();
            financeManager.CreateAccount("412341234", new Bank(), 34534, 600, true);
            IAccount account = FinantialDB.Accounts.Values.ToList()[0];

            double oldCredit = account.CreditPayment;

            financeManager.CreditPayment(account.ID, 100);

            Assert.IsTrue(account.CreditPayment == oldCredit - 100 * 1.05);
        }