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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With