Danliu/testfix

Fix ODatat tests and remove/sort usings
Reduce repeated code.