Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Created July 9, 2015 19:50
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/7b67f21022c3bc0f792e to your computer and use it in GitHub Desktop.
Save angelovstanton/7b67f21022c3bc0f792e to your computer and use it in GitHub Desktop.
public class OwnerTestBehaviorObserver : BaseTestBehaviorObserver
{
public OwnerTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
: base(testExecutionSubject)
{
}
public override void PreTestInit(TestContext context, MemberInfo memberInfo)
{
this.ThrowExceptionIfOwnerAttributeNotSet(memberInfo);
}
private void ThrowExceptionIfOwnerAttributeNotSet(MemberInfo memberInfo)
{
try
{
var ownerAttribute = memberInfo.GetCustomAttribute<OwnerAttribute>(true);
}
catch
{
throw new Exception("You have to set Owner of your test before you run it");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment