问题
I really want to get into TDD development but I have no point of reference where to start.
I think that looking at code and seeing how they write tests and make classes testable that it'll be easier for me to digest and start using myself.
Is anyone aware of any sample or small open source C#
applications that include unit tests?
回答1:
For shakalpesh,
I would recommend the ObjectMentor katas.
- One is to create a bowling game scoring algorithm
- Another is to convert infix expressions to postfix. (The shunting yard algorithm)
Bolwing Game
Shunting Yard Algorithm
回答2:
I highly recommend "Test Driven Development: By Example (Addison-Wesley Signature Series)" by Kent Beck.
Far, far better than any other resources I've found on the net or elsewhere. Well worth the $40 - $50.
回答3:
If you're looking for a real-life open source application where the unit tests are critical to evaluating correctness, I'd suggest BouncyCastle C#, the source is available here. It's an open source crypto API for .NET, has loads of tests and obviously the tests help establish whether things are working or not. Great if you like jumping into the thick of things.
回答4:
I personally believe it's better to see web / screencasts for this than reading sample source code.
I'd go watch Rob Connery's MVC storefront series here. He covers most of what you are looking for.
Also, look at DnRTV episodes w/ JP Boodhoo. Find it here.
回答5:
Microsoft Press has the book, "Test Driven Development in Microsoft .NET", by Newkirk and Vorontsov, two members of the NUnit development team. It's a few years old now, but it'll show you a more complete view of the process.
来源:https://stackoverflow.com/questions/1146218/new-to-tdd-are-there-sample-applications-with-tests-to-show-how-to-do-tdd