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 : ITestBehaviorObserver | |
{ | |
private readonly ITestExecutionSubject testExecutionSubject; | |
public BaseTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
{ | |
this.testExecutionSubject = testExecutionSubject; | |
testExecutionSubject.Attach(this); | |
} |
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
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)] | |
public class ExecutionBrowserAttribute : Attribute | |
{ | |
public ExecutionBrowserAttribute(BrowserTypes browser) | |
{ | |
this.BrowserType = browser; | |
} | |
public BrowserTypes BrowserType { get; set; } | |
} |
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 | |
{ | |
public BrowserLaunchTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
: base(testExecutionSubject) | |
{ | |
} | |
public override void PreTestInit(TestContext context, MemberInfo memberInfo) | |
{ | |
var browserType = this.GetExecutionBrowser(memberInfo); |
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
var executionBrowserAttribute = memberInfo.GetCustomAttribute<ExecutionBrowserAttribute>(true); |
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 OwnerTestBehaviorObserver : BaseTestBehaviorObserver | |
{ | |
public OwnerTestBehaviorObserver(ITestExecutionSubject testExecutionSubject) | |
: base(testExecutionSubject) | |
{ | |
} | |
public override void PreTestInit(TestContext context, MemberInfo memberInfo) | |
{ | |
this.ThrowExceptionIfOwnerAttributeNotSet(memberInfo); |
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
[TestClass] | |
public class BaseTest | |
{ | |
private readonly ITestExecutionSubject currentTestExecutionSubject; | |
private TestContext testContextInstance; | |
public BaseTest() | |
{ | |
this.currentTestExecutionSubject = new MSTestExecutionSubject(); | |
this.InitializeTestExecutionBehaviorObservers(this.currentTestExecutionSubject); |
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
var memberInfo = this.GetType().GetMethod(this.TestContext.TestName); |
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
<?xml version="1.0" encoding="utf-8" ?> | |
<sites> | |
<site url="http://automatetheplanet.com/" name="AutomateThePlanet"> | |
<redirects> | |
<redirect from="http://automatetheplanet.com/singleton-design-pattern-design-patterns-in-automation-testing/" to="/singleton-design-pattern/" /> | |
<redirect from="/advanced-strategy-design-pattern-design-patterns-in-automation-testing/" to="/advanced-strategy-design-pattern/" /> | |
</redirects> | |
</site> | |
</sites> |
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
[XmlRoot(ElementName = "sites")] | |
public class Sites | |
{ | |
[XmlElement(ElementName = "site")] | |
public List<Site> Site { get; set; } | |
} | |
[XmlRoot(ElementName = "site")] | |
public class Site | |
{ |
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 RedirectService : IDisposable | |
{ | |
readonly IRedirectStrategy redirectEngine; | |
private Sites sites; | |
public RedirectService(IRedirectStrategy redirectEngine) | |
{ | |
this.redirectEngine = redirectEngine; | |
this.redirectEngine.Initialize(); | |
this.InitializeRedirectUrls(); |