In my opinion, the best way is to start by “stabilizing” the current code functionality with integration tests. Try creating tests that have a starting point that is unlikely to change later. Using integration tests, you can be sure that refactoring, which will be released later for unit tests, does not violate anything.
The next step is the unit test code. If you can reorganize the code, you can start dividing the logic into classes (for example, additional logic at the level of visibility) and add unit tests to them. Using this process, you will also better know the product code.
It is highly recommended that you read “Working with Obsolete Code,” many of the problems you encounter already have solutions :)
, , . , , White framework . , : Typemock Isolator ( - Typemock), . , , :)