Unit Test Involving Mocks And stubs
Problem is shown when you are testing code where Database Context is involved.
You can choose to use Moq as one of the way to solve it.
Click here to use it Moq to use DbContext
Or you can use the DbContextOptionsBuilder class from Entity FrameWork where
you implement an IN-Memory DbContext.
You can click here to read about the IN-memory DbContext