Example of a transform for unit testing something tricky

There were some requests for an example of my unit testing strategy so made up this fragment and included some things that would make your testing annoying. This is the initial fragment.  Note that it uses annoying global methods that complicate testing as well as global state and system calls that have challenging failure conditions. HANDLE hMutex…

2

How to make ANY code in ANY system unit-test-friendly

[I added this example in a later post] There are lots of pieces of code that are embedded in places that make it very hard to test.  Sometimes these bits are essential to the correct operation of your program and could have complex state machines, timeout conditions, error modes, and who knows what else.  However,…

13