I'm new at unit testing, and I'm trying to mock a static method in a static class. I already read that you can't do that, but I was looking a way to work around that.
I can't modify the code, and making the same function without being static is not an option because they check the code coverage of the test, and I need at least 90%.
I already tried to mock the variables that it uses but it doesn't work.
public static class MyClass
{
public static response MyMethod(HttpSessionStateBase Session,
otherVariable, stringVariable)
{
//some code
}
}
public ActionResult MyClassTested()
{
var response = MyClass.MyMethod(Session);
//more code
}
My problem is that this method is inside a controller that declares a var with the response, and according to that redirects the user.