Suggested Answer:B🗳️
Scenario: The value of the product Id property must always be greater than 0. The GetDealPrice method, in the ProductController, has ProductID as input parameter. Note: 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. Incorrect: Not D: The Contract.Assume method instructs code analysis tools to assume that a condition is true, even if it cannot be statically proven to always be true. Reference: Contract.Requires(Of TException) Method (Boolean) https://msdn.microsoft.com/en-us/library/dd782896(v=vs.110).aspx
1. Contract.Requires, so only B or C
2. RegisterGlobalFilters method is in FilterConfig.cs in App_Start...So C is not right.
But in Global.asax.as, you apply the custom filters by calling FilterConfig.RegisterGlobalFilters method.
So, B is the only correct and legitimate answer when there is no better option.
The requirement is "The value of the product ID property must always be greater than 0".
Adding a "Contract.Requires" to a single method that takes in PropertyID as an argument only ensures that PropertyID is > 0 for that method. Not that a PropertyID cannot be set to 0 or less on a product, thus allowing for products with a ProductID of 0 or less when creating instances of Product.
Surely you would handle this in the "set" method of the ProductID on the Product class?
Or at least create a Global Filter so that instances can be created with a ProductID of <= 0 but cannot be used in any method?
.. I could be wrong, just seems like the requirement isn't satisfied.
Agreed,hell make it an auto increment from 1 and call it a day.
upvoted 2 times
...
...
This section is not available anymore. Please use the main Exam Page.70-486 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
markcowell
4 years, 8 months agorhysabray
5 years, 3 months agomemou
5 years ago