What book on TDD for C# with treatment of Mocks

与世无争的帅哥 提交于 2019-11-28 04:33:10

问题


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.


回答1:


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.




回答2:


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.




回答3:


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.




回答4:


XUnit Test Patterns has a couple of sections on Test Doubles, including Mocks. Not C# specific, but does contain C# examples.



来源:https://stackoverflow.com/questions/880401/what-book-on-tdd-for-c-sharp-with-treatment-of-mocks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!