Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DbQuery<T> for unit testing #948

Closed
aaronhudon opened this issue Aug 27, 2018 — with docs.microsoft.com · 4 comments
Closed

DbQuery<T> for unit testing #948

aaronhudon opened this issue Aug 27, 2018 — with docs.microsoft.com · 4 comments

Comments

Copy link

An example on how to construct a DbQuery<T> for unit testing would be most appreciated.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@divega divega added help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. and removed help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. labels Nov 5, 2018
@oleg-orlenko
Copy link

Any input on this ?

@aaronhudon
Copy link
Author

@oleg-orlenko Zero feedback on this. Either:

  • Switch to DbSet. This is unfortunate because you'll be required to define a primary key
  • Hold your breath and don't unit test database views :-/

@oleg-orlenko
Copy link

@aaronhudon thx for reply. I solved this with mocked context and DbQuery from
https://github.com/huysentruitw/entity-framework-core-mock

@ajcvickers
Copy link
Member

Duplicate of #898

@ajcvickers ajcvickers marked this as a duplicate of #898 Aug 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants