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 IRedirectStrategy : IDisposable | |
{ | |
void Initialize(); | |
string NavigateToFromUrl(string fromUrl); | |
void Dispose(); | |
} |
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 WebDriverRedirectStrategy : IRedirectStrategy | |
{ | |
private IWebDriver driver; | |
public void Initialize() | |
{ | |
this.driver = new FirefoxDriver(); | |
} | |
public void Dispose() |
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 WebRequestRedirectStrategy : IRedirectStrategy | |
{ | |
public void Initialize() | |
{ | |
} | |
public string NavigateToFromUrl(string fromUrl) | |
{ | |
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(fromUrl); | |
request.Method = "HEAD"; |
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 RedirectsTester | |
{ | |
[TestMethod] | |
public void TestRedirects() | |
{ | |
var redirectService = new RedirectService(new WebRequestRedirectStrategy()); | |
using (redirectService) | |
{ | |
redirectService.TestRedirects(); |
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 IOrderPurchaseStrategy | |
{ | |
void ValidateOrderSummary(string itemPrice, ClientPurchaseInfo clientPurchaseInfo); | |
void ValidateClientPurchaseInfo(ClientPurchaseInfo clientPurchaseInfo); | |
} |
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 SalesTaxOrderPurchaseStrategy : IOrderPurchaseStrategy | |
{ | |
public SalesTaxOrderPurchaseStrategy() | |
{ | |
this.SalesTaxCalculationService = new SalesTaxCalculationService(); | |
} | |
public SalesTaxCalculationService SalesTaxCalculationService { get; set; } | |
public void ValidateOrderSummary(string itemsPrice, ClientPurchaseInfo clientPurchaseInfo) |
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 PurchaseContext | |
{ | |
private readonly IOrderValidationStrategy orderValidationStrategy; | |
public PurchaseContext(IOrderValidationStrategy orderValidationStrategy) | |
{ | |
this.orderValidationStrategy = orderValidationStrategy; | |
} | |
public void PurchaseItem(string itemUrl, string itemPrice, ClientLoginInfo clientLoginInfo, ClientPurchaseInfo clientPurchaseInfo) |
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 PurchaseContext | |
{ | |
private readonly IOrderPurchaseStrategy[] orderpurchaseStrategies; | |
public PurchaseContext(params IOrderPurchaseStrategy[] orderpurchaseStrategies) | |
{ | |
this.orderpurchaseStrategies = orderpurchaseStrategies; | |
} | |
public void PurchaseItem(string itemUrl, string itemPrice, ClientLoginInfo clientLoginInfo, ClientPurchaseInfo clientPurchaseInfo) |
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 PurchaseContext(params IOrderPurchaseStrategy[] orderpurchaseStrategies) | |
{ | |
this.orderpurchaseStrategies = orderpurchaseStrategies; | |
} |
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 ShippingAddressPage : BasePageSingleton<ShippingAddressPage, ShippingAddressPageMap> | |
{ | |
public void ClickContinueButton() | |
{ | |
this.Map.ContinueButton.Click(); | |
} | |
public void FillShippingInfo(ClientPurchaseInfo clientInfo) | |
{ | |
this.Map.CountryDropDown.SelectByText(clientInfo.Country); |