Chapter 12: Writing Testable Code
So far, in this book, our focus has been on writing test code. The LookupValue extension, our example case, came with application code mainly ready. As such we did not talk about how to get your application code better suited to being tested. We did not ask ourselves: what does it mean to write testable code?
In this chapter, we'll find an answer to this query based on the following questions:
- What is testable code?
- How to make your code testable?
As we have done in the previous chapters, we will go through a test example, Test example 11 – how to unit test event subscribers' logic, where we'll work out one of the techniques discussed.