コード例 #1
0
        public void TestDebitCase()
        {
            Balance bank = new Balance("rutvi", 2);

            bank.Debit(2);
            Assert.AreEqual(0, bank.bal);
        }
コード例 #2
0
        public void TestExceptionCase()
        {
            Balance bank = new Balance("rutvi", 0);

            try
            {
                bank.Debit(2);
            }
            catch (ArgumentOutOfRangeException e)
            {
                StringAssert.Contains(e.Message, "amount<=0 r amount>balance");
                return;
            }
            catch (Exception e)
            {
                StringAssert.Contains(e.Message, "balance=0");
                return;
            }
            Assert.Fail("no exception");
        }