C# – Unit testing examples for VS2010 testing tools

.net-4.0cunit testingvisual studiovisual studio 2010

I'm looking for sample solution(s) that demonstrate various kinds of unit tests in C# using best practices. Also I require the examples to use the Visual Studio test tools. I know that there are a number of books and web sources on unit testing, but they don’t use the Visual Studio tools for writing their unit tests. I don’t want really basic examples such as can be found here. I am looking to move to the next level of unit-testing and I can’t find advanced examples of unit testing that use Visual Studio 2010 or even VS 2008.

EDIT: To be more clear; I am working on a project where I have to use the testing tools that are built in to Visual Studio. I am not looking for info on any 3rd party testing tools.

Best Answer

Visual Studio unit testing intro and TDD: Test-Driven Development with Visual Studio 2008 Unit Tests may be more to what you are wanting to find perhaps.

nUnit's adoption before Microsoft put built-in unit test support is my guess for why the built-in testing abilities are shunned to some extent. nAnt/nUnit and CI tools may be used outside of the Team System that has a substantial cost in some cases I'd think. Though for those open to 3rd party ideas, here are a couple of other examples:

Using NUnit in Visual Studio 2010 may be a blog example that shows you nUnit + VS2010 as it is possible to do that.

Easy Debugging of NUnit Tests from Visual Studio 2008 Professional would be an example for 2008.

By advanced do you mean things like Rhino Mocks?

Related Topic