Assert statements

The assert statement is used for comparing the result from the original method with the expected result, and then passing or failing the test based on the match. Whatever the result produced by the method may be, the end result of the test method depends on the return value of the assert method. The assert statement takes care of setting the result. There are multiple overloaded methods supported by the Assert statement to set the return value to Pass or Fail or Inconclusive. If the assert statement is not present in the test method, the test method will always return a Pass value. If there are many assert statements in the test method, the test will be in Pass state until one of the assert statements returns Fail.

In the preceding ...

Get Software Testing using Visual Studio 2012 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.