Added ExpectedQuery support along with unit tests