What should you do?

You create Microsoft Windows-based applications. You are developing a component that will be used by multiple Windows-based applications in a bank.

Your specification states the following requirements for the BankAccount class:

Store the balance value.
Implement a public property to contain the value of balance. Implement a Deposit method that receives the amount to be deposited. This method does not return anything.
Implement a Withdraw method that receives the amount to be withdrawn. This method does not return anything.
The withdraw and deposit methods must throw exceptions in the following cases:
o Negative values are used as amounts for withdrawal or deposit. o Amounts larger than the current balance are used for withdrawal. You need to create a unit test for the component. What should you do?

You create Microsoft Windows-based applications. You are developing a component that will be used by multiple Windows-based applications in a bank.

Your specification states the following requirements for the BankAccount class:

Store the balance value.
Implement a public property to contain the value of balance. Implement a Deposit method that receives the amount to be deposited. This method does not return anything.
Implement a Withdraw method that receives the amount to be withdrawn. This method does not return anything.
The withdraw and deposit methods must throw exceptions in the following cases:
o Negative values are used as amounts for withdrawal or deposit. o Amounts larger than the current balance are used for withdrawal. You need to create a unit test for the component. What should you do?

A.
The test must attempt to deposit a positive amount. The test must attempt to withdraw a positive amount.
The test must attempt to get the value of balance using the property.

B.
The test must attempt to deposit a negative amount. The test must attempt to withdraw a negative amount.
The test must attempt to get the value of balance using the property. The test must attempt to withdraw an amount larger than the current balance.

C.
The test must attempt to deposit both negative and positive amounts. The test must attempt to withdraw both negative and positive amounts.

D.
The test must attempt to deposit both negative and positive amounts. The test must attempt to withdraw both negative and positive amounts. The test must attempt to get the value of balance using the property. The test must attempt to withdraw an amount larger than the current balance.



Leave a Reply 0

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