Update function mocking to store results and pass by reference.
Update unit tests to not use external resources.

I also moved `_hasNetwork` to `Integration` since it should not be in unit tests.