Made many key methods virtual so they can be mocked in tests.
Changed the strange encoding test to use its own directory so that it doesn't cause other tests to fail.