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
In 6.0.1, this code throws an unexpected ArgumentOutOfRangeException:

[ img ]
public class A
{
   public void Method()
   {
   }
}

[TestClass, Isolated]
public class Tests
{
   [TestMethod]
   public void Test()
   {
      A a = Isolate.Fake.Instance<A>(Members.CallOriginal);
      a.Method();
      Isolate.Verify.WasCalledWithExactArguments(() => a.Method());
      Isolate.CleanUp();
      a.Method();
      Isolate.Verify.WasCalledWithExactArguments(() => a.Method());
   }
}

Expected is a TypemockException saying "a" is no longer a fake due to the call to CleanUp() and the last WasCalledWithExactArguments() cannot be called on a non-fake.
asked by Neil (27.7k points)

2 Answers

0 votes
Hi Neil,

You're right - we do have a problem with the error message but the scenario you're showing here is not recommended.

Creating a fake instance then "transforming" it to a pseudo real object using cleanup would probably cause other issues as well.
answered by dhelper (11.9k points)
0 votes
Thanks Dror.
answered by Neil (27.7k points)
...