For this kind of refactoring, the compiler should guide you. Take everything you want into a separate class and compile. He will tell you where you need to use the new class in both production code and tests. Refactor everything until it compiles and repeats.
The right way to do this is to move the methods / properties one by one, it only depends on how comfortable you are with the process.
EDIT You only need to create enough tests to cover the code. For the organization, you must transfer the tests, which were in the main test class, to a separate class, but more about that. If you need to write more code for the refactoring process (for example, a method that creates an instance of a new class), you should also write tests for this.
Say you start with a class and a test class:
OneBigClass -Method1 -Method2 -Method3 OneBigClassTest -Method1ShouldDoSomething -Method2ShouldDoSomething -Method3ShouldDoSomething
After refactoring, it will look like this:
OneBigClass -Method1 -Method2 SmallerClass -Method3 OneBigClassTest -Method1ShouldDoSomething -Method2ShouldDoSomething SmallerClassTest -Method3ShouldDoSomething
source share