I have a problem that I haven't been able to find a solution to, and I wonder if anyone could give some advice.
I have a mocked datacontext/objectset, done through interfaces and t4 templates, with some ninject magic, with the intent of having in memory datasets for unit testing.
However, what should you do with the foreign key values/navigation properties?
Lets say I have hotels and customers, ctx.Hotels has some values, but Customer.Hotels does not. The get is something like this if it is a one-to-one relationship:
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedReference<Hotel>("HotelModel.FK_Customers_Hotels", "Hotel").Value;
and one-to-many:
return ((IEntityWithRelationships)this).RelationshipManager.GetRelatedCollection<BookingRow>("HotelModel.FK_BookingRows_Customers", "BookingRow");
My skill level just isn't enough to even understand what is going on here.
[edit:] Great Master Julie Lerman confirms that this is a dead end. You can't properly mock entityobjects, you need POCOs for that.