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
Production code
    public abstract class BaseClass
    {

    
    }


Test code
        [Test]
        public void EqualsCall()
        {
            var baseClass = Isolate.Fake.Instance<BaseClass>();
            Isolate.WhenCalled(()=>baseClass.Equals(null)).CallOriginal();
        }


The exception message is:
failed: TypeMock.TypeMockException :
*** No method calls found in recording block. Please check:
* Are you trying to fake a field instead of a property?
* Are you are trying to fake mscorlib type?
at f4.a(ci A_0, Boolean A_1)
at da.a(Boolean A_0)
at de.b(Boolean A_0)
at ic.c(Boolean A_0)
at ic.a(Object A_0, Boolean A_1, Func`1 A_2, Action A_3, Action A_4, Action A_5)
at ic.a(Object A_0, Boolean A_1, Action A_2, Action A_3)
at ic.CallOriginal()


Maybe you should add something like "cannot call abstract method in abstract class" or something.
________
BIG TITS BOUNCING
asked by nsoonhui (59.1k points)

1 Answer

0 votes
Hello Soon Hui,

The reason you go this exception is because "equals" is a method from System.Object that resides inside MsCorLib.

At the present time it is not possible to fake MsCorLib types or set expectations (WhenCalled) on methods from MsCorLib.
answered by dhelper (11.9k points)
...