Simplify each BasicTests test.

This extracts the common part of each method into the class constructor and Dispose methods.