Can you recoment a book on on Unit Testing and TDD for C# with at least some treatment of Mock Objects?
I have seen this question but it does not seem to mention mocking.
Can you recoment a book on on Unit Testing and TDD for C# with at least some treatment of Mock Objects?
I have seen this question but it does not seem to mention mocking.
Have a look at Growing Object-Oriented Software, Guided by Tests by Steve Freeman and Nat Pryce - a work in progress, but free online. The code examples are in java, which shouldn't be a problem if you're a C# developer, and does focus extensively on Mocks.
In my opinion, Pragmatic Unit Testing in C# with NUnit, 2nd Edition is the best introduction to Unit Testing. It's got a chapter on Mock Objects as well.
The Art of Unit Testing: With Examples in .NET by Roy Osherove (Amazon Page, Official Site) sounds like what you're looking for. He devotes one chapter introducing the concepts of stub and mock objects (using a "roll-your-own" approach), and then a second chapter on using mock object frameworks, particularly Rhino Mocks. There is somewhat less emphasis on Test-Driven Development, but there is quite a lot of information about TDD available from other sources, and TDD isn't all that language-specific.
XUnit Test Patterns has a couple of sections on Test Doubles, including Mocks. Not C# specific, but does contain C# examples.