So I have a class that looks like this:
public class MyClassToTest()
{
MyStaticClass.DoSomethingThatIsBadForUnitTesting();
}
and a static class that looks like this:
public static class MyStaticClass()
{
public static void DoSomethingThatIsBadForUnitTesting()
{
// Hit a database
// call services
// write to a file
// Other things bad for unit testing
}
}
(Obviously this is a dumbed down example)
So, I know that the second class is doomed when it comes to unit testing, but is there any way to uncouple the MyClassToTest
class so that I can test it (WITHOUT instantiating MyStaticClass
). Basically, I would want it to ignore this call.
Note: Sadly this is a Compact Framework Project, so tools like Moles and Typemock Isolator cannot be used :(.