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

How to disable dbContext replace with MyTested.AspNetCore.EntityFrameworkCore #394

Open
grinay opened this issue Nov 12, 2021 · 2 comments
Assignees
Labels

Comments

@grinay
Copy link

grinay commented Nov 12, 2021

I faced into next problem.
I'm replacing dbContext to InMemory by myself in TechStartup.cs in method ConfigureTestServices.
Then in my startup class, I have a method which seeding some data into db.
But later on, when I execute the controller method by Db replaced by MyTested.AspNetCore.EntityFrameworkCore to its in-memory DB context.
Can you advice how to avoid it?

@ivaylokenov
Copy link
Owner

@grinay Why do you replace the DbContext by yourself? What do you want to accomplish? Do you just want to seed global data for every test case? Is that the scenario here?

@grinay
Copy link
Author

grinay commented Nov 25, 2021

@ivaylokenov yes, basically in the startup class on the first run seeding some data into the database, eventually this data isn't available in dB for a test. Also in some scenarios, we are testing against the real SQL database, to test constraints, etc. And if I want to use data extension to check data in DB, i need to install mytested entity framework extension, which replaces DbContext to in-memory, and I am unable to find an option to disable this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants