C # Module Testing Resources

I switched from Java to C #, and so I wonder how unit tests are in C #. I remember how JUnit tested my Java applications. How can I unit test in c #? What are some good resources for unit testing in C # USING A DEFAULT TEST LIBRARY? I do not need a port. A good resource will look like a good PDF file, article, or better yet, a video!

+7
c # unit-testing visual-studio
source share
6 answers

NUnit is actually the idiomatic JUnit port for the .NET platform. Visual Studio also has a modular testing system built in, but since you are familiar with JUnit and NUnit, this will be my recommendation.

For ridicule and stubbing I like Rhino Mocks .

Finally, Roy Osherov has a good book, The Art of Unit Testing , which is a good discussion of unit testing in general, but will also include other tools and resources.

+16
source share

You did not indicate which version of VS you are using, but if it is VS 2010 RC, give Pex and Moles Visual Studio 2010 Powertools a try ...

" Pex automatically creates test suites with high code coverage . Right from the Visual Studio code editor, Pex finds interesting I / O values ​​for your methods that you can save as a small test suite with a high degree of code coverage. Microsoft Pex is a Visual Studio add-on for testing applications .NET Framework. "

" Moles allows you to replace any .NET method with a delegate . Moles supports unit testing by providing isolation through workarounds and stubs. The Moles framework is provided by Pex or can be installed by itself as a Microsoft Visual Studio add-in."

Video:

+4
source share

I like to use MSTest as it is associated with Visual Studio (most versions).

Also check out NUnit and xUnit.

For a test runner, I like to use ReSharper.

+2
source share

For piece objects, another interesting Moq library. It has some nice features, especially if you check the lambda expression and all LINQ stuff (it has some support).

As for unit testing, I use NUnit, but highly recommend reading the Introduction to Test Driven Design (TDD) .

+2
source share

What, without love for MbUnit ?

+1
source share

Try NUnit . You can also see unit test projects in Visual Studio 2008 or Visual Studio 2010.

0
source share

All Articles