How to fake a static function using FakeItEasy

798 Views Asked by At

I have the function like this :

public class myClass
{
  public static string myFunction()
  {
    return "returnValue";
  } 
}

I want to fake myClass() using FakeItEasy.

And I wrote:

var fakeMyClass = A.Fake<myClass>();
A.CallTo(() => fakeMyClass.myClass()).Returns(timeZoneName);

But it was wrong, said that:

"Cannot access with an instance reference; please use the type name instead."

How to fix this problem or if there is another way to fake static function in class, thank you.

0

There are 0 best solutions below