Skip to content

Instantly share code, notes, and snippets.

View angelovstanton's full-sized avatar
💭
UPDATED STATUS

Anton Angelov angelovstanton

💭
UPDATED STATUS
View GitHub Profile
public class BaseTestBehaviorObserver : ITestBehaviorObserver
{
private readonly ITestExecutionSubject testExecutionSubject;
public BaseTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
{
this.testExecutionSubject = testExecutionSubject;
testExecutionSubject.Attach(this);
}
[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; }
}
public class BrowserLaunchTestBehaviorObserver : BaseTestBehaviorObserver
{
public BrowserLaunchTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
: base(testExecutionSubject)
{
}
public override void PreTestInit(TestContext context, MemberInfo memberInfo)
{
var browserType = this.GetExecutionBrowser(memberInfo);
var executionBrowserAttribute = memberInfo.GetCustomAttribute<ExecutionBrowserAttribute>(true);
public class OwnerTestBehaviorObserver : BaseTestBehaviorObserver
{
public OwnerTestBehaviorObserver(ITestExecutionSubject testExecutionSubject)
: base(testExecutionSubject)
{
}
public override void PreTestInit(TestContext context, MemberInfo memberInfo)
{
this.ThrowExceptionIfOwnerAttributeNotSet(memberInfo);
[TestClass]
public class BaseTest
{
private readonly ITestExecutionSubject currentTestExecutionSubject;
private TestContext testContextInstance;
public BaseTest()
{
this.currentTestExecutionSubject = new MSTestExecutionSubject();
this.InitializeTestExecutionBehaviorObservers(this.currentTestExecutionSubject);
var memberInfo = this.GetType().GetMethod(this.TestContext.TestName);
<?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>
[XmlRoot(ElementName = "sites")]
public class Sites
{
[XmlElement(ElementName = "site")]
public List<Site> Site { get; set; }
}
[XmlRoot(ElementName = "site")]
public class Site
{
public class RedirectService : IDisposable
{
readonly IRedirectStrategy redirectEngine;
private Sites sites;
public RedirectService(IRedirectStrategy redirectEngine)
{
this.redirectEngine = redirectEngine;
this.redirectEngine.Initialize();
this.InitializeRedirectUrls();