I tried the following:
But as the Static class cannot be instantiated, I have to pass the class, never a variable and Arrange Syntax is not happy about it at all.
Is this intentional? I mean, Justmock does not tolerate mocking private method of static classes at all?
I've found two workarounds:
- Make the method public for temporary testing purposes.
- Make the static class singleton for temporary testing purposes.
This two workarounds are just fine for temporary testing but I cannot modify the class structure.
Any suggestion is welcomed.
Mock.NonPublic.Arrange(StaticClass,
"PrivatedMethod"
, Arg.IsAny<
object
>()).CallOriginal();
But as the Static class cannot be instantiated, I have to pass the class, never a variable and Arrange Syntax is not happy about it at all.
Is this intentional? I mean, Justmock does not tolerate mocking private method of static classes at all?
I've found two workarounds:
- Make the method public for temporary testing purposes.
- Make the static class singleton for temporary testing purposes.
This two workarounds are just fine for temporary testing but I cannot modify the class structure.
Any suggestion is welcomed.