I am tryin to test a private static method like so:
public void myMethodTest()
{
MyClass target = new MyClass();
PrivateType pt = new PrivateType(target.GetType());
var x = pt.InvokeStatic("MyMethod");
//Some type of Assert here
}
The method also uses a private static variable within its class to check if its null, MyMethod is what im trying to test
private static HashSet<AnotherClass> fakeName{get;set;}
private static void MyMethod()
{
if (null== fakeName)
{
fakeName = new HashSet<AnotherClass>();
}
}
Thanks guys, if you need more clarification please let me know
In my Test if I do ,
Assert.IsNotNull(x);
the test fails, im just wondering if the method is actually been called , i followed this answer to run this test Stack answer