Why does this code throw ShimNotSupportedException in operator?
ShimStreamReader.AllInstances.EndOfStreamGet = ((s)=>calls < 1);
[TestMethod]
public void GetAllLinesFromFile__()
{
int calls = 0;
using (ShimsContext.Create())
{
ShimStreamReader.AllInstances.EndOfStreamGet = ((s)=>calls < 1);
ShimStreamReader.AllInstances.ReadLine = (s) =>
{
calls++;
return ";;;;;;;;;;";
};
var streamFake = new ShimStreamReader();
var obj = new MyFile(streamFake, ';');
Assert.IsTrue(obj.GetAllLinesFromFile().Count() == 1);
}
}
Could it be that you are running the test from Resharper or some other testrunner?
I've written a few blogposts related to this which may be helpful:
http://blog.degree.no/2012/09/unit-testing-visual-studio-2012-fakes-in-team-city/