You create Web-based applications. You are creating an Internet banking application. You write the following lines of code to represent a method in your application. (Line numbers are included for reference only.)
01 public void Transfer(decimal amount, BankAccount account) 02 {
03 if (!(amount > 0))
04 throw new Exception(“Invalid deposit amount!”);
05 else
06 {
07 this.Withdraw(amount);
08 account.Deposit(amount);
09 }
10 }
You use the Microsoft Visual Studio 2005 test feature to automatically generate the following unit test.
(Line numbers are included for reference only.)
01 [TestMethod()]
02 public void TransferTest()
03 {
05 BankAccount target = new BankAccount();
06 BankAccount transferTo = new BankAccount();
07 target.Deposit(500);
08 target.Transfer(100,transferTo);
09 Assert.Inconclusive(“A method that does not return a value cannot be verified.”); 10 }
You need to change the test method to return a conclusive result. Which line of code should replace the code on line 09 of the unit test?
A.
Assert.AreEqual (400M, target.Balance);
B.
Assert.IsTrue (target.Balance != 400M);
C.
Debug.Assert (target.Balance == 400M,passed);
D.
Debug.Assert (target.Balance == 400M,failed);