Hi,
You didn't mention what it is you are trying to do so in case I got you wrong, correct me.
I've made some assumptions in order to fill in the missing pieces:
1) DataBaseTable and DataBaseTables is the same class.
2) _inMemoryObjects.AsQueryable() is a Queryable collection set to have "test1" in it.
In this case what I would do is:
[TestMethod() , Isolated]
public void DatenholenTesttest()
{
var fakeEntities = Isolate.Fake.Instance<DatabaseEntities>();
Isolate.WhenCalled(() => fakeEntities.DataBaseTables).WillReturnCollectionValuesOf(_inMemoryObjects.AsQueryable());
Isolate.Swap.NextInstance<DatabaseEntities>().With(fakeEntities);
var target = new RepositoryManager();
var actual = target.GetData("test1");
var expected = "test1";
Assert.AreEqual(expected, actual);
}
We use Swap.NextInstance() in order to assign fakeEntities to _db (when the _db is created using new), that's why we created fakeEntities and set the behavior of fakeEntities.DataBaseTables to return a queryable collection.
When _db.DataBaseTable.Where(..) called inside target.GetData(..). is the same as writing
_inMemoryObjects.AsQueryable().Where(f => f.NAME.Equals(name)).Select(f => f.NAME).FirstOrDefault();
If you have more question try to send me all the relevant details.
Please let me know if that helps.