What should you do?

You work as the Enterprise application developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. Your responsibilities at Domain.com include the testing and stabilization of applications. Domain.com operates in the international retail environment. You are currently developing an order fulfillment solution for Domain.com. In this solution, the Domain.com customer’s order is represented by the Order class. The Order class has a property named Status. It is possible to set Status to one of the following enumeration members:
1. Created – the order has been created.
2. BackOrdered – the order has been placed on backorder.
3. Scheduled – the order is scheduled for delivery.
4. Cancelled – the order has been cancelled.
5. Shipped – the order has been shipped.
6. Delivered – the order has been delivered.

Domain.com works in joint ventures with courier companies world-wide due to the nature of the business. A method named Ship is implemented to invoke a Web method of an Extensible Markup Language (XML) Web service at these courier companies. The courier companies are then responsible for the delivery of the order. When the Ship method is called, the Status property is set to Shipped. You are required to unit test the Ship method to ensure that the test passes.

What should you do?

You work as the Enterprise application developer at Domain.com. The Domain.com network consists of a single Active Directory domain named Domain.com. All servers in the domain run Windows Server 2003. Your responsibilities at Domain.com include the testing and stabilization of applications. Domain.com operates in the international retail environment. You are currently developing an order fulfillment solution for Domain.com. In this solution, the Domain.com customer’s order is represented by the Order class. The Order class has a property named Status. It is possible to set Status to one of the following enumeration members:
1. Created – the order has been created.
2. BackOrdered – the order has been placed on backorder.
3. Scheduled – the order is scheduled for delivery.
4. Cancelled – the order has been cancelled.
5. Shipped – the order has been shipped.
6. Delivered – the order has been delivered.

Domain.com works in joint ventures with courier companies world-wide due to the nature of the business. A method named Ship is implemented to invoke a Web method of an Extensible Markup Language (XML) Web service at these courier companies. The courier companies are then responsible for the delivery of the order. When the Ship method is called, the Status property is set to Shipped. You are required to unit test the Ship method to ensure that the test passes.

What should you do?

A.
Carry out the unit test by calling the Ship method.
Then verify that the Status property is not changed to Scheduled.

B.
Carry out the unit test by calling the Ship method.
Then verify that the Status property is not changed to BackOrdered.

C.
Carry out the unit test by calling the Ship method.
Then verify that the Status property is changed to Ship prior to the delivery of the order.

D.
Carry out the unit test by calling the Ship method.
Then verify that the Status property is changed to Delivered after delivery of the order.

Explanation:
During a unit test on a method, you should test the logical outcome of the method call. In this case you need to call the Ship method and verify the Status property is changed to Shipped.
Incorrect answers:
A: You should not verify that the Status is not changed to Scheduled as this will not indicate that the Ship method is working as it should. This option will allow the unit test to pass even if the Ship method set the Status to Cancelled, Created, BackOrdered or Delivered.
B: You should not verify that the Status is not changed to BackOrdered as this will not indicate that the Ship method is working as it should. This option will allow the unit test to pass even if the Ship method set the Status to Cancelled, Created, Scheduled or Delivered.
D: In this scenario you are unit testing the Ship method, this means that you should only ensure that the Status property is set to Shipped.



Leave a Reply 0

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