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/742d6dc173ffb33262b6 to your computer and use it in GitHub Desktop.
Save angelovstanton/742d6dc173ffb33262b6 to your computer and use it in GitHub Desktop.
public class BaseTestBehaviorObserver
{
public void Subscribe(IExecutionProvider provider)
{
provider.TestInstantiatedEvent += this.TestInstantiated;
provider.PreTestInitEvent += this.PreTestInit;
provider.PostTestInitEvent += this.PostTestInit;
provider.PreTestCleanupEvent += this.PreTestCleanup;
provider.PostTestCleanupEvent += this.PostTestCleanup;
}
public void Unsubscribe(IExecutionProvider provider)
{
provider.TestInstantiatedEvent -= this.TestInstantiated;
provider.PreTestInitEvent -= this.PreTestInit;
provider.PostTestInitEvent -= this.PostTestInit;
provider.PreTestCleanupEvent -= this.PreTestCleanup;
provider.PostTestCleanupEvent -= this.PostTestCleanup;
}
protected virtual void TestInstantiated(object sender, TestExecutionEventArgs e)
{
}
protected virtual void PreTestInit(object sender, TestExecutionEventArgs e)
{
}
protected virtual void PostTestInit(object sender, TestExecutionEventArgs e)
{
}
protected virtual void PreTestCleanup(object sender, TestExecutionEventArgs e)
{
}
protected virtual void PostTestCleanup(object sender, TestExecutionEventArgs e)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment