I'd like to start using unit testing as part of my development projects. Can anyone recommend any web resources to help explain how to write effective unit tests? A walk through example project would be useful.
I am predominantly working开发者_运维技巧 wit C# and would prefer examples which demonstrate using .Net unit testing tools but don't mind if there is a useful example in some other language.
The best one I know http://xunitpatterns.com/
Personally I like the Visual Studio Embedded Test. But in the near past I was really happy with NUnit. If you need some mocking, i would suggest MoQ for his simplicity. Hope this help.
Good unit test should make…
Easy to write tests
Easy to organize your tests
Easy to run tests (all, some, one)
I also firstly had experience with NUnit and later moved to MSTest. In my opinion MSTest has 2 strength: it is much easy to create unit test for particular method and run test. The only problem with organising tests in group - that is what was easy to do with NUnit.
More information regarding creating effective unit test for .Net also described here
I very recomment the Art of Unit Testing book from Roy Osherove. This book is an essense of expirience and best practices. And yes, this is not an web-resource, but you should look to Roy's blog too.
精彩评论