POSTS ARCHIVED ON "DECEMBER 2011"
Unit Testing using NUnit and Rhino Mocks
The smallest piece of a software that can be testable is called as a Unit. In Object Oriented Programming languages like C# each class is called as a Unit. Testing each such unit independent of others is called as Unit-Testing. Unit Testing is very important in Test Driven Development (TDD) where the development starts with writing test cases before code. Lot of testing frameworks are available for doing better unit testing in different languages. For .NET there are frameworks like NUnit, TestDriven.NET, xUnit.net and more.
Usually a class has dependencies with other classes. Unit Testing is all about testing the functionalities of the class in test and not its dependencies. In order of using the real instances of the dependencies we can use dummy or mock objects. NUnit itself comes with mocking support but there are plenty of other frameworks like Rhino Mocks, NMock, TypeMock.NET etc. that does the job better than NUnit. Some of them are open-sources and some are paid. I usually go with Rhino Mocks, it’s an open source and easy to use.
In this article we are going to see about how to do better unit testing in .NET using NUnit and Rhino Mocks.Continue Reading