Hello Dave,
DataClassInfoProvider in SampleUnitTests is already faked using Fake method.
[TestInitialize]
public void Init()
{
// Fake the data of a particular provider
Fake<DataClassInfo, DataClassInfoProvider>().WithData(
DataClassInfo.New(dc =>
{
dc.ClassID = 1;
dc.ClassName = "MyTest.MyClass";
})
);
}
When you use DataClassInfoProvider to get DataClassInfo(s), it gets the faked data instead of accessing the database. In SampleUnitTests exapmle it behaves as if there was single DataClass (with ClassID = 1 and ClassName = "MyTest.MyClass") in the database.
The prerequisite for getting faked data (provided by Fake method) and not accessing the database is that method (eg. DataClassInfoProvider.GetDataClassInfo) gets the data using the ObjectQuery internally.
You don't need to do anything with GetObjectQuery method in your tests.
Best regards, Michal