I am just starting out with DI and unit testing and have fallen into a trap that, I am sure, has no problems for those more experienced developers:
I have a MessageManager class that receives data and stores it in db. Within the same assembly (project in Visual Studio) I created a repository interface with all the methods needed to access db. The specific implementation of this interface is in a separate assembly called DataAccess.
Therefore, DataAccess needs a reference to the MessageManager project to find out about the repository interface. And MessageManager needs a reference to the DataAccess project so that the MessageManager client can implement a specific implementation of the repository interface. This is prohibited by the course.
I could move the interface to a data access assembly, but I believe that the repository interface should be in the same assembly as the client that uses it.
So what have I done wrong?
source
share