PrepAway - Latest Free Exam Questions & Answers

How should you complete the relevant code?

HOTSPOT
You are preparing to test an ASP.NET application. The application includes the following class. Line numbers
are included for reference only.

Data will be imported from another system into the current application. Before importing data, you must run unit
tests to validate the data. To be considered valid, the data must meet the following requirements:
The value passed into the GetResults method must be greater than or equal to zero.
The value passed into the GetUserInfo method must not be null.
You need to create unit tests that fail if the requirements are not met.
How should you complete the relevant code? To answer, select the appropriate code segment from each list in
the answer area.
Hot Area:

PrepAway - Latest Free Exam Questions & Answers

Answer:

Explanation:
Box 1: TestClass
The [TestClass] attribute is required in theMicrosoft unit testing framework for managed code for any class that
contains unit test methods that you want to run in Test Explorer.
Box 2: TestMethod
Set the following attributes for the unit test:
[TestMethod]
All unit tests require the [TestMethod] attribute.
Box 3: Assert.Istrue
The value passed into the GetResults method must be greater than or equal to zero.
Box 4: TestMethod
Box 5: Assert.IsNotNull
The value passed into the GetUserInfo method must not be null.
https://msdn.microsoft.com/en-us/library/ms182532.aspx


Leave a Reply