Skip to content

Instantly share code, notes, and snippets.

@angelovstanton
Last active December 11, 2017 10:34
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/ea39584f8faa6e227d6e to your computer and use it in GitHub Desktop.
Save angelovstanton/ea39584f8faa6e227d6e to your computer and use it in GitHub Desktop.
public partial class PlaceOrderPage : BasePage
{
private readonly PurchaseTestInput purchaseTestInput;
private readonly PromotionalPurchaseSpecification promotionalPurchaseSpecification;
private readonly CreditCardSpecification creditCardSpecification;
private readonly WiretransferSpecification wiretransferSpecification;
private readonly FreePurchaseSpecification freePurchaseSpecification;
public PlaceOrderPage(IWebDriver driver, PurchaseTestInput purchaseTestInput) : base(driver)
{
this.purchaseTestInput = purchaseTestInput;
this.promotionalPurchaseSpecification = new PromotionalPurchaseSpecification(purchaseTestInput);
this.wiretransferSpecification = new WiretransferSpecification(purchaseTestInput);
this.creditCardSpecification = new CreditCardSpecification(purchaseTestInput);
this.freePurchaseSpecification = new FreePurchaseSpecification();
}
public override string Url
{
get
{
return @"yourSiteUrl";
}
}
public void ChoosePaymentMethod()
{
if (this.creditCardSpecification.
And(this.wiretransferSpecification.Not()).
And(this.freePurchaseSpecification.Not()).
And(this.promotionalPurchaseSpecification.Not()).
IsSatisfiedBy(this.purchaseTestInput))
{
this.CreditCard.SendKeys("371449635398431");
this.SecurityNumber.SendKeys("1234");
}
else
{
this.Wiretransfer.SendKeys("pathToFile");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment