HOTSPOT
You are building an ASP.NET application. You develop the following unit test code. Line numbers are included for reference only.
0 1 [TestClass]
0 2 public class UnitTest1
0 3 {
0 4 protected string _name;
0 5 protected float _expenses;
0 6 protected float _income;
0 7 protected float _payment;
0 8 protected float _balance;
0 9 public void AddCustomer(string name, float income, float payment, float balance)
1 0 {
1 1 _name = name;
1 2 _expenses = expenses;
1 3 _income = income;
1 4 _payment = payment;
1 5 _balance = balance;
1 6 CheckName();
1 7 DebRatio();
1 8 CheckBalance();
1 9 }
2 0 [TestMethod]
2 1 public void CheckName()
2 2 {
2 3 Assert.IsNotNull(_name, "CheckName failed unit test");
2 4 }
2 5 [TestMethod]
2 6 public void DebRatio()
2 7 {
2 8 Assert.AreSame(_income, _payment, "DebRatio failed unit test");
2 9 }
3 0 [TestMethod]
3 1 public void CheckBalance()
3 2 {
3 3 Assert.IsTrue(_balance >= 0.0f, Check balance failed unit test.");
3 4 }
3 5}
You run the following line of code:
AddCustomer("Contoso", 0, 100, 100, -1);
You need to evaluate the unit test results. For each of the following statements, select Yes if the statement is true. Otherwise, select No.
Hot Area:

Correct Answer:

Explanation/Reference:
Explanation:
Box 1: Yes
Line 23 is Assert.IsNotNull(_name, "CheckName failed unit test");
_name is "Contoso" so the assertion will succeed.
Box 2: No
Line 289 is Assert.AreSame(_income, _payment, "DebRatio failed unit test");
_income is 0 and payment is 100. The assertion will fail.
Box 3: No
Line 33 is Assert.IsTrue(_balance >= 0.0f, Check balance failed unit test.");
_balance is -1. The assertion will fail.