What should you do?

Posted by: Pdfprep Category: 70-486 Tags: , ,

You need to modify the application to meet the productId requirement.

What should you do?
A . Modify the RegisterGlobalFilters method of the Global.asax.cs file as follows.
Contract.Assume<ArgumentException>(productId != 0);
B . Modify the GetDealPrice method of ProductController as follows.
Contract.Requires<ArgumentException>(productId > 0);

C . Modify the RegisterGlobalFilters method of the Global.asax.cs file as follows.
Contract.Requires<ArgumentException>(productId > 0);
D . Modify the GetDealPrice method of ProductController as follows.
Contract.Assume<ArgumentException>(productId > 0);

Answer: B

Explanation:

The Contract.Requires(Of TException) method specifies a precondition contract for the enclosing method or property, and throws an exception if the condition for the contract fails.

Syntax:

‘Declaration

Public Shared Sub Requires(Of TException As Exception) ( _ condition As Boolean _)

Type Parameters

TException

The exception to throw if the condition is false.

Parameters

condition

Type: System.Boolean

The conditional expression to test.

Reference: Contract.Requires(Of TException) Method (Boolean)

Leave a Reply

Your email address will not be published.