View CsharpGhist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserLaunchTestBehaviorObserver : BaseTestBehaviorObserver | |
{ | |
protected override void PreTestInit(object sender, TestExecutionEventArgs e) | |
{ | |
var browserType = this.GetExecutionBrowser(e.MemberInfo); | |
Driver.StartBrowser(browserType); | |
} | |
protected override void PostTestCleanup(object sender, TestExecutionEventArgs e) | |
{ |
View IExecutionProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IExecutionProvider | |
{ | |
event EventHandler<TestExecutionEventArgs> TestInstantiatedEvent; | |
event EventHandler<TestExecutionEventArgs> PreTestInitEvent; | |
event EventHandler<TestExecutionEventArgs> PostTestInitEvent; | |
event EventHandler<TestExecutionEventArgs> PreTestCleanupEvent; |
View MSTestExecutionProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MSTestExecutionProvider : IExecutionProvider | |
{ | |
public event EventHandler<TestExecutionEventArgs> TestInstantiatedEvent; | |
public event EventHandler<TestExecutionEventArgs> PreTestInitEvent; | |
public event EventHandler<TestExecutionEventArgs> PostTestInitEvent; | |
public event EventHandler<TestExecutionEventArgs> PreTestCleanupEvent; |
View TestExecutionEventArgs.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class TestExecutionEventArgs : EventArgs | |
{ | |
private readonly TestContext testContext; | |
private readonly MemberInfo memberInfo; | |
public TestExecutionEventArgs(TestContext context, MemberInfo memberInfo) | |
{ | |
this.testContext = context; | |
this.memberInfo = memberInfo; | |
} |
View BaseTestBehaviorObserver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} |
View BrowserLaunchTestBehaviorObserver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BrowserLaunchTestBehaviorObserver : BaseTestBehaviorObserver | |
{ | |
protected override void PreTestInit(object sender, TestExecutionEventArgs e) | |
{ | |
var browserType = this.GetExecutionBrowser(e.MemberInfo); | |
Driver.StartBrowser(browserType); | |
} | |
protected override void PostTestCleanup(object sender, TestExecutionEventArgs e) | |
{ |
View BaseTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseTest | |
{ | |
private readonly MSTestExecutionProvider currentTestExecutionProvider; | |
private TestContext testContextInstance; | |
public BaseTest() | |
{ | |
this.currentTestExecutionProvider = new MSTestExecutionProvider(); | |
this.InitializeTestExecutionBehaviorObservers(this.currentTestExecutionProvider); | |
var memberInfo = MethodInfo.GetCurrentMethod(); |
View ITestExecutionSubject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ITestExecutionSubject | |
{ | |
void Attach(ITestBehaviorObserver observer); | |
void Detach(ITestBehaviorObserver observer); | |
void PreTestInit(TestContext context, MemberInfo memberInfo); | |
void PostTestInit(TestContext context, MemberInfo memberInfo); |
View ITestBehaviorObserver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ITestBehaviorObserver | |
{ | |
void PreTestInit(TestContext context, MemberInfo memberInfo); | |
void PostTestInit(TestContext context, MemberInfo memberInfo); | |
void PreTestCleanup(TestContext context, MemberInfo memberInfo); | |
void PostTestCleanup(TestContext context, MemberInfo memberInfo); |
View MSTestExecutionSubject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MSTestExecutionSubject : ITestExecutionSubject | |
{ | |
private readonly List<ITestBehaviorObserver> testBehaviorObservers; | |
public MSTestExecutionSubject() | |
{ | |
this.testBehaviorObservers = new List<ITestBehaviorObserver>(); | |
} | |
public void Attach(ITestBehaviorObserver observer) |
OlderNewer