so,i read an article about unit testing Here is The Article
it said that you shouldn’t mock a database because it’s a managed dependencies
here’s the part where it said that application database is a managed dependencies
Managed dependencies — out-of-process dependencies you have full control over. These dependencies are only accessible through your application; interactions with them aren’t visible to the external world. A typical example is the application database. External systems don’t access your database directly; they do that through the API your application provides.
and here is the part where it said that managed dependencies should use real instance
Only unmanaged dependencies should be replaced with mocks. Use real instances of managed dependencies in tests.
but i also read a book from the same author that create the above article, the author said that unit test should isolate from each other and should not reach out to a shared state
here’s the part of the book where the author said it
Isolating tests from each other means it’s fine to exercise several classes at once as
long as they all reside in the memory and don’t reach out to a shared state
so, which one is the right one? how can you use real instances of the managed dependencies/database when the criteria of a unit test should be isolated from each other
Is there any mistake in my understanding?
sorry if my english is bad
2