Hi,
This example should do the trick of handling private static method:
public class Foo
{
private static int Parse(int a, string c)
{
return 3;
}
}
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
//ARRANGE - faking private static method
Isolate.NonPublic.WhenCalled(typeof (Foo) , "Parse").WillReturn(5);
//ACT - invoking private static method
var num = Isolate.Invoke.Method(typeof (Foo), "Parse", new object[] {1, "something"});
//use one of the ASSERTs below
Assert.AreEqual(5 , num);
//verifying private static method
Isolate.Verify.NonPublic.WasCalled(typeof(Foo) , "Parse");
}
}
You can find more info on this topic
here.
Please let me know if it helps.