Write test cases for Sum(int a , int b) function – C#.

(Last Updated On: April 29, 2016)

Answer: Test cases for Sum(int a, int b) method.

Positive Cases:

  1. Only int data type is accepted: Need to test if Sum () method accept only int data type as a parameter.
  2. Only addition function accepted: Method should return only addition of two numbers. Verify if the output value is equivalent to sum of the input.

 

Negative Cases:

 

  1. Verify for non –int type data: Verify if variable is a numeric and int type only and do not accept alpha characters or others.
  2. Test boundary conditions: int data type has a range e.g. -32,767 to 32,767. So, we need to test Sum() function with boundary conditions for example 32,767, 32,768 and -32,766 etc.