Clarity / Evident Data
Often the motivation for accessing files from a unit test violating this principle is to read test data upon which the class under test depends. Separating test data from the code of your test class makes that test significantly harder to understand and debug.
In his TDD book, Kent Beck refers alludes to this unit testing best practice as Evident Data. Show the reader of your test the intent of the code being tested by using clear and understandable data as parameters to your code and expected results in your assert statements. Once you move that data into test data moves to a separate file, especiall especially in binary formats, the maintenance cost and usefulness of that test becomes significantly worseworrisome.
Speed Of Execution
Reading files is much slower than executing code. Most