I have some code that I need to see when I am running a test, and TestContext would have to be part of my Test class I need the debug.writelines of the class being tested displayed. I considered just passing a TestContext to my MessageStatus static method and may have to but that will be a PITA because the UnitTest class would have to pass the TestContext to the object it is testing. Too tightly coupled for my taste.
In basic terms
[TestMethod]
public void TestA()
{
//....
Assert.IsTrue(Blah.Blah()));
}
public void Blah()
{
Debug.WriteLine("Hello");
}
never shows up when I run the unit tests!
I could change it to:
TestContext t;
[TestMethod]
public void TestA()
{
//....
Assert.IsTrue(Blah.Blah(t)));
}
public void Blah(TestContext p1)
{
p1.WriteLine("Hello");
}
but that is insane it means changing all my signatures and tight coupling. I read the thread at How to write output from a unit test? it does not help :(