Let's create something that might be used in a game, and that can easily be unit tested. Classes that do not subclass from Monobehavior are much easier to unit test, since instance objects can be created using the keyword new. If the class is carefully designed with private data and public methods with clearly declared dependencies as parameters, it becomes easy to write a set of tests to make us confident that objects of this class will behave as expected in terms of default values, as well as valid and invalid data.
In this recipe, we will create a health script class, and a set of tests for this class. This kind of class can be reused for both the health of human players, and also Artificial Intelligence (AI)-controlled enemies in a game: