added unit tests for dynamic queries