Refactored tests to use as much unmocked code as possible.