Added exchange-direct test; refactored test code