简体   繁体   中英

Mocking Static classes using Typemock

I am having a class as follows. I would like to know how can we mock this class using Typemock

public static class MyClass
{
   public static string MyFunction()
   {

   }
}

There's no special syntax required for static method mocking. You should be able to use the AAA syntax as usual.

Isolate.Fake.WhenCalled(() => MyClass.MyFunction()).WillReturn("mock");

There is some great documentation about this on the Typemock site .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM