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

TDD with DbContextScope #55

Open
k2ibegin opened this issue Aug 7, 2017 · 1 comment
Open

TDD with DbContextScope #55

k2ibegin opened this issue Aug 7, 2017 · 1 comment

Comments

@k2ibegin
Copy link

k2ibegin commented Aug 7, 2017

Hi,

I am wondering how can I implement TDD with DbContextScope. I have seen some of the methods such as Repository pattern and using Effort package. I am a beginner in TDD, so I am struggling with dependencies break down. I looked into couple of SO discussions but using moq framework seems to be an overkill ? ( as unit tests should be simple)

Thanks in advance !

@VictorioBerra
Copy link

For unit tests, you will benefit from moq. The whole point of a unit test is to test your isolated business logic. The reason a service layer exists is because it should isolate business logic from your database stuff. As for an integration test, you can just set up your EF connection string to hit a test DB and test away. Moq your interface and instead of saving rollback every transaction.

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

No branches or pull requests

2 participants