PrepAway - Latest Free Exam Questions & Answers

What should you test?

You create Microsoft Windows-based applications. You are testing a component named BankAccount. You write the following code segment for the BankAccount component.
(Line numbers are included for reference only.)

01 public class BankAccount {
02 private decimal balance;
03 public decimal Balance {
04 get{return this.balance;}
05 set{this.balance = value;}
06 }
07 public void Withdraw(decimal amount) {
08 if(!(amount > 0)) {
09 throw new Exception(“Invalid withdraw amount!”);
10 } else if (amount>this.balance) {
11 throw new Exception(“Insufficient balance”);
12 } else {
13 this.balance -= amount;
14 }
15 }
16 public void Deposit(decimal amount) {
17 if(!(amount > 0)) {
18 throw new Exception(“Invalid deposit amount!”);
19 } else {
20 this.balance += amount;
21 }
22 }
23 }

The test project executes a valid withdraw operation and a valid deposit operation. It also verifies the account balance. Your companys check-in policy requires that the primary code path is tested before check in. Full testing will be completed later. You need to establish the lowest acceptable code coverage metric. What should you test?

PrepAway - Latest Free Exam Questions & Answers

A.
Test all methods.

B.
Do not test exceptions. Test all other methods.

C.
Test all code, including variable declarations.

D.
Do not test accessor methods. Test all other methods and exceptions.


Leave a Reply