Browsing all articles from July, 2007
Jul
22
Comments

Unit Testing Code with System.Diagnostics.Debug

Author Eli Lopian    Category .NET Tests     Tags

Matt Ellis has answered Ron Cain’s question about Assert in the context of a test harness. I would answer differently.

When testing code that uses Debug.Assert, you would want to fail the test when that Assert fails. Here is a small piece of code that will do it for you (without needing specialized configuration files, this will keep the test confined in the actual test class and not distributed in several places)

// This Class will fail the test when a Debug.Assert has failed public class TestTraceListener:DefaultTraceListener { public override void Fail(string message, string detailMessage) { Assert.Fail("Debug.Assert Failed: "+message+" "+ detailMessage); } } [Test] public void TestCodeWithFailingDebugAssert() { // use special test tracer Trace.Listeners.Remove("Default"); Trace.Listeners.Add(new TestTraceListener()); // see what happens when a Debug.Assert fails // this is normally hidden somewhere deep inside the code Debug.Assert(false); }
Jul
2
Comments

TypeMock is Expanding

Author Eli Lopian    Category Release     Tags

PartnersIf you are reading this you are probably the developer we are looking for.

TypeMock is expanding and we are looking for .NET developers who have a passion for Bleeding Edge Technologies like Mocking (of course), Test Driven Development and Aspect Oriented Development.

We work in a dynamic environment and we have the infrastructure to support home offices for developers who require it.

More information can be found on our Career Page

Send your resume to: jobs@typemock.com