コード例 #1
0
        public void FreezeAccountTest()
        {
            var target = new BankAccount_Accessor("Mr Brian Walton", 11.99);

            target.FreezeAccount();

            var creditAccount = true;

            try
            {
                target.Credit(1.00);
            }
            catch (Exception)
            {
                creditAccount = false;
            }

            Assert.IsFalse(creditAccount, "Was not able to credit account.");
        }
コード例 #2
0
        public void FreezeAccountTest()
        {
            BankAccount_Accessor target = new BankAccount_Accessor("Mr. Bryan Walton", 11.99); // TODO: Initialize to an appropriate value
            target.FreezeAccount();
            // Assert.Inconclusive("A method that does not return a value cannot be verified.");

            bool creditAccount = false; // False means account could be credited: Fail test.
            // Try to credit account
            try
            {
                target.Credit(1.00);
            }
            catch (System.Exception)
            {
                // Threw exception. FreezeAccount worked correctly: Pass test.
                creditAccount = true;
            }

            // Assert fails if 'creditAccount' condition is false. Fail test.
            Assert.IsTrue(creditAccount, "Was able to credit account.");
        }
コード例 #3
0
ファイル: BankAccountTest.cs プロジェクト: LunaRose/BankCS
        public void FreezeAccountTest()
        {
            var target = new BankAccount_Accessor("Mr Brian Walton", 11.99);
            target.FreezeAccount();

            var creditAccount = true;

            try
            {
                target.Credit(1.00);
            }
            catch (Exception)
            {
                creditAccount = false;
            }

            Assert.IsFalse(creditAccount, "Was not able to credit account.");
        }