Ok thanks for the help. The last thing I just want to confirm - The SomeObject object handles code for both mocking and performing the real task (writing to a database), and not just a clone of another object that does the real implementation. Am I correct?
SomeObject is mainly just a container for data in and data out. If you noticed I editied my post (had a typo). The SomeObject is the param into the repository, not the object that does the DB work. In the test there will be no real database activity, but
from the ThingToTest's perspective it doesn't know because all of that is hidden behind the IRepository interface. He doesn't know if it's a real or a fake (and that's a nice level of decoupling).
BrockAllen
All-Star
27516 Points
4897 Posts
MVP
Re: Database Mocking
Mar 27, 2012 09:17 PM|LINK
SomeObject is mainly just a container for data in and data out. If you noticed I editied my post (had a typo). The SomeObject is the param into the repository, not the object that does the DB work. In the test there will be no real database activity, but from the ThingToTest's perspective it doesn't know because all of that is hidden behind the IRepository interface. He doesn't know if it's a real or a fake (and that's a nice level of decoupling).
DevelopMentor | http://www.develop.com
thinktecture | http://www.thinktecture.com/