The approach I've been taking for refactoring old code is to query PDB for the existing resources, put those in spec tests, make sure everything is mocked up correcrly to produce those results, then change the code. Ideally it should produce the same resources.