O'Reilly logo

Software Testing using Visual Studio 2010 by S. Subashni, N. Satheesh Kumar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assert statements

The assert statement is used for comparing the result from the method with the expected result and then passing or failing the test based on the match. Whatever may be the result produced by the method, the end result of the test method depends on the return value of the assert method. The assert statement establishes the result. There are different statements supported by the Assert class to set the return value to Pass, Fail, or Inconclusive. If the assert statement is not present in the test method, the test method will always return a Pass. 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 example, the test method, CalculateTotalPriceTest ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required