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);
        }
コード例 #2
0
        public void Purchase_Decorator()
        {
            var itemUrl      = "/Selenium-Testing-Cookbook-Gundecha-Unmesh/dp/1849515743";
            var itemPrice    = 44.99m;
            var shippingInfo = new ClientAddressInfo()
            {
                FullName = "John Smith",
                Country  = "United States",
                Address1 = "7518 CAROTHERS STREET",
                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"
            };
            var clientPurchaseInfo = new ClientPurchaseInfo(billingInfo, shippingInfo)
            {
                GiftWrapping = GiftWrappingStyles.Fancy
            };
            var clientLoginInfo = new ClientLoginInfo()
            {
                Email    = "*****@*****.**",
                Password = "******"
            };

            Advanced.Strategies.OrderPurchaseStrategy orderPurchaseStrategy = new Advanced.Strategies.TotalPriceOrderPurchaseStrategy(itemPrice);
            orderPurchaseStrategy = new Advanced.Strategies.SalesTaxOrderPurchaseStrategy(orderPurchaseStrategy, itemPrice, clientPurchaseInfo);
            orderPurchaseStrategy = new Advanced.Strategies.VatTaxOrderPurchaseStrategy(orderPurchaseStrategy, itemPrice, clientPurchaseInfo);

            new PurchaseContext(orderPurchaseStrategy).PurchaseItem(itemUrl, itemPrice.ToString(), clientLoginInfo, clientPurchaseInfo);
        }
コード例 #3
0
        public void Purchase_SeleniumTestingToolsCookbook()
        {
            string itemUrl      = "/Selenium-Testing-Cookbook-Gundecha-Unmesh/dp/1849515743";
            string itemPrice    = "40.49";
            var    shippingInfo = new ClientAddressInfo()
            {
                FullName = "John Smith",
                Country  = "United States",
                Address1 = "950 Avenue of the Americas",
                State    = "New York",
                City     = "New York City",
                Zip      = "10001-2121",
                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 = "******"
            };

            new PurchaseContext(new SalesTaxOrderPurchaseStrategy(), new VatTaxOrderPurchaseStrategy(), new GiftOrderPurchaseStrategy())
            .PurchaseItem(itemUrl, itemPrice, clientLoginInfo, clientPurchaseInfo);
        }
コード例 #4
0
 public ClientPurchaseInfo(ClientAddressInfo addressInfo)
 {
     BillingInfo  = addressInfo;
     ShippingInfo = addressInfo;
 }
コード例 #5
0
 public ClientPurchaseInfo(ClientAddressInfo addressInfo)
 {
     this.BillingInfo  = addressInfo;
     this.ShippingInfo = addressInfo;
 }
コード例 #6
0
 public ClientPurchaseInfo(ClientAddressInfo billingInfo, ClientAddressInfo shippingInfo)
 {
     BillingInfo  = billingInfo;
     ShippingInfo = shippingInfo;
 }