Chaining Tests

I learned something new about tests this morning.  Methods that are called from a test that have an Assert in them will be treated as a test.  For example:

        InterfaceKit interfaceKit = null;
public void InterfaceKitAttachedTest_ReturnsTrue()
            interfaceKit = 
new InterfaceKit();
            interfaceKit.Attach += 
new Events.AttachEventHandler(interfaceKit_Attach);
void interfaceKit_Attach(object sender, Events.AttachEventArgs e)
bool expected = true;
bool actual = interfaceKit.Attached;
Assert.AreEqual(expected, actual);


Thinking about it, that makes sense – b/c the called method is sharing the stack so the Assert will be called and inspected.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: