Reputation: 8211
I have something like a HQL-query factory, which produces plain string HQL-queries. How can I unit-test for syntax errors, without doing integration testing with the database by actually executing the query over something?
Best option would be to call some magic VerifyHql() method, or to maybe use it somewhere and catch some meaningful parse exception or something.
Upvotes: 3
Views: 857
Reputation: 49301
It doesn't make much sense to test a query without a database to query, so these should be tested using integration tests. However, you can use an in memory SQLite database instead of hitting a real server. There's a NuGet SQLite package available.
Upvotes: 3