public decimal CalculateBeforeTaxPrice(decimal itemsPrice, ClientPurchaseInfo clientPurchaseInfo)
        {
            decimal beforeTaxPrice = default(decimal);
            decimal shippingCosts = CalculateShippingPrice(clientPurchaseInfo);
            beforeTaxPrice = itemsPrice + shippingCosts;

            return beforeTaxPrice;
        }
        public decimal CalculateTotalPrice(decimal itemsPrice, decimal estimatedTax, ClientPurchaseInfo clientPurchaseInfo)
        {
            decimal totalPrice = default(decimal);
            decimal shippingCosts = CalculateShippingPrice(clientPurchaseInfo);
            totalPrice = itemsPrice + estimatedTax + shippingCosts;

            return totalPrice;
        }
 public void PurchaseItem(string itemUrl, string itemPrice, ClientLoginInfo clientLoginInfo, ClientPurchaseInfo clientPurchaseInfo)
 {
     ItemPage.Instance.Navigate(itemUrl);
     ItemPage.Instance.ClickBuyNowButton();
     PreviewShoppingCartPage.Instance.ClickProceedToCheckoutButton();
     SignInPage.Instance.Login(clientLoginInfo.Email, clientLoginInfo.Password);
     ShippingAddressPage.Instance.FillShippingInfo(clientPurchaseInfo);
     ShippingAddressPage.Instance.ClickDifferentBillingCheckBox(clientPurchaseInfo);
     ShippingAddressPage.Instance.ClickContinueButton();
     ShippingPaymentPage.Instance.ClickBottomContinueButton();
     ShippingAddressPage.Instance.FillBillingInfo(clientPurchaseInfo);
     ShippingAddressPage.Instance.ClickContinueButton();
     ShippingPaymentPage.Instance.ClickTopContinueButton();
     decimal expectedTotalPrice = this.orderPurchaseStrategy.CalculateTotalPrice();
     this.orderPurchaseStrategy.ValidateOrderSummary(expectedTotalPrice);
 }
        public void Purchase_SeleniumTestingToolsCookbook_DecoratedStrategies()
        {
            string itemUrl = "/Selenium-Testing-Cookbook-Gundecha-Unmesh/dp/1849515743";
            decimal itemPrice = 40.49m;
            var shippingInfo = new ClientAddressInfo()
            {
                FullName = "John Smith",
                Country = "United States",
                Address1 = "950 Avenue of the Americas",
                State = "Texas",
                City = "Houston",
                Zip = "77001",
                Phone = "00164644885569"
            };
            var billingInfo = new ClientAddressInfo()
            {
                FullName = "Anton Angelov",
                Country = "Bulgaria",
                Address1 = "950 Avenue of the Americas",
                City = "Sofia",
                Zip = "1672",
                Phone = "0894464647"
            };
            ClientPurchaseInfo clientPurchaseInfo = new ClientPurchaseInfo(billingInfo, shippingInfo)
            {
                GiftWrapping = GiftWrappingStyles.Fancy
            };
            ClientLoginInfo clientLoginInfo = new ClientLoginInfo()
            {
                Email = "*****@*****.**",
                Password = "******"
            };
            OrderPurchaseStrategy orderPurchaseStrategy = new TotalPriceOrderPurchaseStrategy(itemPrice);
            orderPurchaseStrategy = new SalesTaxOrderPurchaseStrategy(orderPurchaseStrategy, itemPrice, clientPurchaseInfo);
            orderPurchaseStrategy = new VatTaxOrderPurchaseStrategy(orderPurchaseStrategy, itemPrice, clientPurchaseInfo);

            new PurchaseContext(orderPurchaseStrategy).PurchaseItem(itemUrl, itemPrice.ToString(), clientLoginInfo, clientPurchaseInfo);
        }
 public GiftOrderPurchaseStrategy(OrderPurchaseStrategy orderPurchaseStrategy, decimal itemsPrice, ClientPurchaseInfo clientPurchaseInfo) 
     : base(orderPurchaseStrategy, itemsPrice, clientPurchaseInfo)
 {
     this.giftWrappingPriceCalculationService = new GiftWrappingPriceCalculationService();
 }
 public SalesTaxOrderPurchaseStrategy(OrderPurchaseStrategy orderPurchaseStrategy, decimal itemsPrice, ClientPurchaseInfo clientPurchaseInfo)
     : base(orderPurchaseStrategy, itemsPrice, clientPurchaseInfo)
 {
     this.salesTaxCalculationService = new SalesTaxCalculationService();
 }
 public OrderPurchaseStrategyDecorator(OrderPurchaseStrategy orderPurchaseStrategy, decimal itemsPrice, ClientPurchaseInfo clientPurchaseInfo)
 {
     this.orderPurchaseStrategy = orderPurchaseStrategy;
     this.itemsPrice = itemsPrice;
     this.clientPurchaseInfo = clientPurchaseInfo;
 }
 public decimal CalculateShippingPrice(ClientPurchaseInfo clientPurchaseInfo)
 {
     decimal shippingCosts = this.ShippingCostsCalculationService.Calculate(clientPurchaseInfo.ShippingInfo.Country, clientPurchaseInfo.ShippingInfo.State, clientPurchaseInfo.ShippingInfo.Address1, clientPurchaseInfo.ShippingInfo.Zip);
     return shippingCosts;
 }
 public NoTaxesOrderPurchaseStrategy(OrderPurchaseStrategy orderPurchaseStrategy, decimal itemsPrice, ClientPurchaseInfo clientPurchaseInfo) 
     : base(orderPurchaseStrategy, itemsPrice, clientPurchaseInfo)
 {
 }