Which lines are covered by the test?

You create Web-based client applications. You create a Web site that will be used to simulate different types of loans. You are writing a method to calculate the payment on a simple loan. You write the following lines of code for the method. (Comments are included for reference only.)

public static decimal Payment(decimal loanAmount, int period, decimal rate) { if (!(loanAmount > 0)||!(period > 1)||!(rate > 0)) { // Line A throw new Exception(“Invalid input!”); // Line B
} else {
return 0M; // Line C: return a calculated payment
}
}
public static decimal CheckBalance(ulong accountID) {
return 0M; // Line D: return calculated balance
}

You write the following code for the unit test.

[TestMethod()]
public void PaymentTest() {
decimal payment = Loan.Payment(100000,360,10); // Line E
Assert.AreEqual(payment, 877.57M); // Line F
}

You enable coverage testing for this unit test. You need to identify the coverage of your test. Which lines are covered by the test?

You create Web-based client applications. You create a Web site that will be used to simulate different types of loans. You are writing a method to calculate the payment on a simple loan. You write the following lines of code for the method. (Comments are included for reference only.)

public static decimal Payment(decimal loanAmount, int period, decimal rate) { if (!(loanAmount > 0)||!(period > 1)||!(rate > 0)) { // Line A throw new Exception(“Invalid input!”); // Line B
} else {
return 0M; // Line C: return a calculated payment
}
}
public static decimal CheckBalance(ulong accountID) {
return 0M; // Line D: return calculated balance
}

You write the following code for the unit test.

[TestMethod()]
public void PaymentTest() {
decimal payment = Loan.Payment(100000,360,10); // Line E
Assert.AreEqual(payment, 877.57M); // Line F
}

You enable coverage testing for this unit test. You need to identify the coverage of your test. Which lines are covered by the test?

A.
Lines commented A, B, and C

B.
Lines commented A and C

C.
Lines commented A, B, C, D, E, and F

D.
Lines commented A, B, C, E, and F



Leave a Reply 0

Your email address will not be published. Required fields are marked *