Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save angelovstanton/10b8cd83d44b1d610de1 to your computer and use it in GitHub Desktop.
Save angelovstanton/10b8cd83d44b1d610de1 to your computer and use it in GitHub Desktop.
public class MSTestExecutionProvider : IExecutionProvider
{
public event EventHandler<TestExecutionEventArgs> TestInstantiatedEvent;
public event EventHandler<TestExecutionEventArgs> PreTestInitEvent;
public event EventHandler<TestExecutionEventArgs> PostTestInitEvent;
public event EventHandler<TestExecutionEventArgs> PreTestCleanupEvent;
public event EventHandler<TestExecutionEventArgs> PostTestCleanupEvent;
public void PreTestInit(TestContext context, MemberInfo memberInfo)
{
this.RaiseTestEvent(this.PreTestInitEvent, context, memberInfo);
}
public void PostTestInit(TestContext context, MemberInfo memberInfo)
{
this.RaiseTestEvent(this.PostTestInitEvent, context, memberInfo);
}
public void PreTestCleanup(TestContext context, MemberInfo memberInfo)
{
this.RaiseTestEvent(this.PreTestCleanupEvent, context, memberInfo);
}
public void PostTestCleanup(TestContext context, MemberInfo memberInfo)
{
this.RaiseTestEvent(this.PostTestCleanupEvent, context, memberInfo);
}
public void TestInstantiated(MemberInfo memberInfo)
{
this.RaiseTestEvent(this.TestInstantiatedEvent, null, memberInfo);
}
private void RaiseTestEvent(EventHandler<TestExecutionEventArgs> eventHandler, TestContext testContext, MemberInfo memberInfo)
{
if (eventHandler != null)
{
eventHandler(this, new TestExecutionEventArgs(testContext, memberInfo));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment