Top critical review
Better Books Needed
October 22, 2019
There are some positive reviews of this book, and I honestly wonder what book these people were reading. I have carefully read the first four chapters, with a particularly strong effort to understand Chapter 3, and I don't care to go any further with this confusing, sloppy book.
The author (whom I imagine to be a highly competent developer) seems to be still in the process of making up his mind about what unit testing is really about. He has changed his mind signficantly since the first edition of the book, and says, on page 76: "It's possible that in the next edition of this book I'll have turned 180 degrees on this subject". There is some context to that quote, but I felt like it probably applied to the entire book. Some people have an intuitive grasp of what needs to be done in particular situations, but cannot articulate their ideas effectively and cannot generalize to guiding principles for an entire field of professionals.
The subject matter of the book, published in 2013, does not feel at all dated. The author uses C# and NUnit to demonstrate what he's talking about. However, he is constantly telling you what the book is not about. It is not a design book, not a TDD book, not a patterns book. The author constantly refers the reader to other books. Eventually, it has the effect of making the reader feel that they are reading the wrong book.
* The code examples, which could have significantly redeemed the book, are a disaster. They are full of mistakes that the reader must mentally correct. If you make the mistake of downloading the source code from the author's GitHub page, you will find that Chapter 3 is entirely omitted. There is a lot of picky stuff I could say about the source code you get from the text or the Manning site. For instance, what is the point of inheritance when you have only a single child class? Does the author understand what the internal keyword means?
* The writing style is overly juvenile. The word "sucks" is employed more than once.
* I don't think that the author's use of the vocabulary of unit testing aligns with the currently accepted meanings of terms like stub and mock. For him, the term fake is a collective term for both stubs and mocks. He says on page 77: "A mock object is a fake object in the system that decides whether the unit test has passed or failed. It does so by verifying whether the object under test called the fake object as expected." My first question is, What is this fake that the mock is calling? And my second is, How does that distinguish a mock from a stub? I suppose it could be argued that the answers are implicit in the text, but they are not conspicuous to me. (He says in Chapter 3 that you assert against mocks, but not against stubs. But it seems to me that the examples in Chapter 3 assert against stubs. I don't know!) To be fair, the book is six years old at this point. However, I don't think the author achieves an internal consistency within the book of the terms he is using.
Maybe the book is a masterpiece after Chapter 4. Like I said, I am not going further.
We need better unit testing books for C#. Manning, generally an excellent tech publisher, has a new one coming out in 2020, and I hope it's a better book. One star is harsh, but I feel that it is necessary to counter the many 5-star reviews. This book deserves to be forgotten and replaced by more lucid texts.