I'm a newbie with Moles so forgive the simple question but according to documentation I think this should work:
MDataServiceCollection<string> dataServiceCollectionMock = new
MDataServiceCollection<string>();
new MCollection<string>(dataServiceCollectionMock)
{
SystemCollectionsIEnumerableGetEnumerator = () =>
{
return new List<string>(new string[] { "a", "b", "c" }).GetEnumerator();
}
};
string result = string.Empty;
foreach (string s in dataServiceCollectionMock.Instance)
{
result += s;
}
I'm replacing GetEnumerator with my own implementation so that I can inject the values I iterate through when using an instance of DataServiceCollection. I'm expecting s to return "abc". However I get the following exception thrown:
Microsoft.Moles.Framework.Moles.MoleNotImplementedException: Collection`1.GetEnumerator() was not moled.
Any help greatly appreciated.
Regards, Chris.