chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
          var pro = Isolate.Fake.Instance<Process>();
          pro.StandardOutput).ReturnRecursiveFake();
            Isolate.WhenCalled(() => pro.StandardOutput.ReadToEnd())
                .WillReturn("hi"); 


It will return a System.NullReferenceException.

But it should return a Cannot mock the mscorlib exception.
________
SMOKE KILLS
asked by nsoonhui (59.1k points)

1 Answer

0 votes
Hi Soon,

You see this behavior since the isolator silently ignores methods that returns mscorlib types when doing a recursive fakes. For mscorlib types the default value is returned which is null in case of reference types.

However in case when the user specify explicitly that he wants to return recursive fakes on mscorlib type I think we should throw the 'mscorlib exception'.
answered by ohad (35.4k points)
...