Generic Test Sample

Download sample

The "EvenOdd" sample is a project that you can build into a simple program. You can then wrap this program as a generic test. The files of this sample are provided for the following walkthrough: Walkthrough: Creating and Running a Generic Test.


For general information about how to use samples, see How to: View and Download Samples.

About the EvenOdd Sample Program

The EvenOdd sample is a Visual C# console application. It returns a value of either 1 or 0, depending on the argument you pass it:

  • If you pass no argument, the program returns 0 if the seconds field of the current system time is even, and 1 if the value of the seconds field is odd.

  • If you pass a single numeric argument, the program returns 0 if the number you pass is even, 1 if that number is odd. If you pass a non-numeric argument, the program returns 1. This causes the generic test that wraps the program to produce a Failed result.

  • If you pass two arguments, the program returns 0 if the second argument represents a file that exists in the same directory as the program; otherwise, it returns 1.

  • All other cases will fail.