Unit Testing Query<T> #3428
-
I am writing some xunit unit tests for marten. await session.Query().ToListAsync(token).ConfigureAwait(false); but seems that it's not possible to cast an IQueryable object to type 'Marten.Linq.IMartenQueryable'. Does anyone knows how to approach this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If you look at the tests we have Marten in test suite, everything pertaining to querying is fully integration tests with Postgres DB. @jeremydmiller always recommended not to mock the portions/LINQ support which you are attempting to do. Our suggested approach is to write integration tests talking to a Postgres database. |
Beta Was this translation helpful? Give feedback.
-
@leopoldev404 I'll go even farther, I very, very strongly recommend against trying to mock out any kind of IQueryable implementation. |
Beta Was this translation helpful? Give feedback.
@leopoldev404 I'll go even farther, I very, very strongly recommend against trying to mock out any kind of IQueryable implementation.