How do I find Odd even in C# using Test Driven Development Approach

Some days back I have written an article describing TDD Katas: http://www.c-sharpcorner.com/UploadFile/g_arora/writting-fizzbuzz-kata/
 
I have received some queries and lot of responses from great readers, here is one of the good question I have asked in an offline session, held in New Delhi by great guy Balwinder Singh:
 
Q. How do I find Odd even in C# using Test Driven Development approach ?
 
Answer is very simple we just need to follow same approach as we have seen in previous article. Hereunder, I am submitting a complete code with its related tests.
 
Please note that I am not going to copy/paste entire code - reason I do not want to steal your time :) I have attached the complete code also you can get the same one from Github: https://github.com/garora/TDD-Katas/tree/master/TDD-Katas-project/TDD-Katas-project/OddEvenKata
 
Lets start to get the walkthrough - how we can write this tdd kata?
 
  1. public static string PrintOddEven(int startNumber, int lastNumber)  
  2. {  
  3. return GetOddEvenWithinRange(startNumber, lastNumber);  
  4. }  
In above, snippet we have a simple method which is accepting two paramenters startNumber and lastNumber, its obvious that we are defining the limit of our numeric series to find-out the odd-even.
 
  1. public static string PrintSingleOddEven(int number)  
  2. {  
  3. return CheckSingleNumberOddEvenPrimeResult(number);  
  4. }  
Great, we also have one another method, which tell us whether entered number is odd or even :)
 
Now, lets test our first method to find out odds and evens from within provided range of integers:
 
  1. [TestFixture]  
  2. [Category("OddEven Kata")]  
  3. public class TestOddEven  
  4. {  
  5. [Test]  
  6. [TestCase(1, 50)]  
  7. [TestCase(1, 100)]  
  8. [TestCase(5, 150)]  
  9. public void CanPrintOddEven(int startRange, int endRange)  
  10. {  
  11. var result = OddEven.PrintOddEven(startRange, endRange);  
  12. Assert.NotNull(result, string.Format("{0}", result));  
  13. }  
In above, we are using NUnit framework to create tests , I have another post describing all about NUnit framework (if you want to read all about Nunit).
 
So, In above we have three test cases with different Series of integers, it will provides all numbers quoting Odd or Even.
 
You just need to run the code and you will get the desired results :)