I have two tables, Clients and Administrators, which are linked in a many-to-many relationship by the table ClientAdministrators.
In the real application this works fine and I can get a list of Administrators for my Client. My problem comes in trying to unit test the service class that is retrieving this from the repository.
I have a FakeRepository class which implements my repository interface and I have several internal lists of objects for the service class to query against.
My problem is that I can't find a way of getting the relationships to work in the fake classes in order to be able to query successfully against this many-to-many relationship.
Dim clients = From c in _repository.GetAllClients _
Select New ClientBizObj With {.ID = c.ID, _
.ClientName = c.ClientName, _
.Admins = (From a in c.ClientAdministrators _
Select a.Administrator.UserName).ToList}
It's telling me that c.ClientAdministrators is an EntitySet(of ClientAdministrator).
How can I fake this relationship in my FakeRepository class so that it stops throwing NullReferencExceptions?
I don't care if doesn't return any Admins, I just need the Client object to be returned successfully.