As we have mentioned earlier, testing could be applied in different ways. We could have written the tests before the code, following a TDD methodology for development, or Behavior-Driven Development (BDD). But we can also write the tests afterwards, as part of a quality assurance process, or to be included in a battery of regression tests. Also tests are a great tool in order to discover the behavior of a system, even more if it is a legacy system, or a subsystem that is not properly documented. As the code has already been written before introducing the tests, we could use these as a tool for discovering or checking that the application runs properly.
Now we are going to write, configure, and run a couple of unit tests, and in the full sample of this chapter you can find many more of them.
We choose MyBookingsVM
as an interesting piece of code for testing:
It has some business logic related to UI.
It is decoupled from external sources...