Added tests for SortExpression toArray

Change-Id: I56650080d65d56f676f40b5cd1e62ae8e3984a54