I finished reading Pragmatic Unit Testing In C# with NUnit (2nd Edition) by Hunt and Thomas. The book has excellent advice for anyone doing unit testing, and is well worth reading.
The overall high quality made a few omissions and flaws more glaring, though:
- There’s no discussion of using the InternalsVisibleToAttribute to create friend assemblies.
- Several examples appear to be incorrect (p. 151, 179, 180). If a book contains a code example, I expect it to compile and work (especially in a book on testing).
- The test on p. 164 uses file I/O instead of memory streams.
- The book incorrectly states in several places that Nullable<T> types cannot be checked versus null. The example on p. 201 won’t even compile – the variables aren’t assigned. Nullable types with null values do equate to null (Equals is overloaded).
This is nit-picking, though. Buy this book and keep it handy.