Sunday, April 11, 2010

Unit testing your App.config and ConfigurationSection using NUnit, Ninject and TestDriven.NET

Let me just make things clear. This post is not about creating mocks.
This post is about really unit testing the different scenarios you have when working with configuration files:

   * What if the section is missing?
   * What if required fields are missing?
   * What values can I expect when optional fields are missing?
   * ...

To get started you need the following:

   * NUnit: http://www.nunit.org/ (assembly included in my solution)
   * Ninject: http://ninject.org/ (assembly included in my solution)
   * TestDriven.NET: http://www.testdriven.net/ (to be installed)

NUnit is the testing framework we'll use to perform our unit tests.
Ninject will be for dependency injection.
TestDriven.NET will be used to run the tests.

And I presume you have a basic knowledge of unit testing and dependency injection.

Read more: Codeproject

Posted via email from jasper22's posterous