public void CheckProductAttributesAfterSizeChoice() { Logger.Log.Info("CheckProductAttributesAfterSizeChoice"); expectedProduct = ProductCreator.withManySizes_04(); ProductPage productPageCheckProductAttributesAfterSizeChoice = new ProductPage(driver); try { BasketPage basketCheckProductAttributesAfterSizeChoice = productPageCheckProductAttributesAfterSizeChoice .OpenPage(expectedProduct.URL) .AcceptCookies() .ChooseSize(expectedProduct.size) .AddProductToBasket() .NavigateToBasket(); products = basketCheckProductAttributesAfterSizeChoice.GetProducts(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProduct.name, products[0].name, "invalid name"); Assert.AreEqual(expectedProduct.color.ToLower(), products[0].color, "invalid color"); Assert.AreEqual(expectedProduct.size, products[0].size, "invalid size"); Assert.AreEqual(expectedProduct.item, products[0].item, "invalid item"); Assert.AreEqual(expectedProduct.price, products[0].price, "invalid price"); Assert.AreEqual(expectedProduct.count, products[0].count, "invalid count"); }
public Form Show() { var repository = new SQLServerProductRepository(); var producCreator = new ProductCreator(repository); var handler = new ProductCommandHandler(producCreator); var categoriesEntities = new SQLServerCategoryRepository().SearchAll().ToList(); var locationsEntities = new SQLServerLocationRepository().SearchAll().ToList(); var packingTypesEntities = new SQLServerPackingRepository().SearchAll().ToList(); var categories = from x in categoriesEntities select x.Name; var locations = from x in locationsEntities select x.Name; var packingTypes = from x in packingTypesEntities select x.Name; var createProductCategoryController = Routes.GetRoutes()["CreateProductCategory"]; var productsWarehouseRepository = new SQLServerProductsWarehouseRepository(); var productsWarehouseCreator = new ProductsWarehouseCreator(productsWarehouseRepository); var productsWarehouseCommandHandler = new ProductsWarehouseCommandHandler(productsWarehouseCreator); var data = new Dictionary <string, object> { { "createHandler", handler }, { "categories", categories.ToList() }, { "locations", locations.ToList() }, { "packingTypes", packingTypes.ToList() }, { "createProductCategoriesController", createProductCategoryController }, { "productsWarehouseCreateHandler", productsWarehouseCommandHandler } }; return(new CreateProduct(data)); }
public void CheckTheTotalPriceOfTwoIdenticalGoods() { Logger.Log.Info("CheckTheTotalPriceOfTwoIdenticalGoods"); expectedProduct = ProductCreator.withCountAndPriceMultiplyedByTwo(); string totalPrice = ""; ProductPage productPageCheckTheTotalPriceOfTwoIdenticalGoods = new ProductPage(driver); try { BasketPage basketPageCheckTheTotalPriceOfTwoIdenticalGoods = productPageCheckTheTotalPriceOfTwoIdenticalGoods.OpenPage(expectedProduct.URL) .AcceptCookies() .AddProductToBasketSeveralTimes(expectedProduct.count) .NavigateToBasket(); products = basketPageCheckTheTotalPriceOfTwoIdenticalGoods.GetProducts(); totalPrice = basketPageCheckTheTotalPriceOfTwoIdenticalGoods.GetTotalPrice(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProduct.name, products[0].name, "invalid name"); Assert.AreEqual(expectedProduct.color.ToLower(), products[0].color, "invalid color"); Assert.AreEqual(expectedProduct.size, products[0].size, "invalid size"); Assert.AreEqual(expectedProduct.item, products[0].item, "invalid item"); Assert.AreEqual(expectedProduct.personalisation, products[0].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProduct.personalisationColor, products[0].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProduct.price, totalPrice, "invalid price"); Assert.AreEqual(expectedProduct.count, products[0].count, "invalid count"); }
public void CheckAddingPersonalisation() { Logger.Log.Info("CheckAddingPersonalisation"); expectedProduct = ProductCreator.withPersonalisation(); ProductPage productPageCheckAddingPersonalisation = new ProductPage(driver); try { BasketPage basketPageCheckAddingPersonalisation = productPageCheckAddingPersonalisation.OpenPage(expectedProduct.URL) .AcceptCookies() .AddPersonalization(expectedProduct.personalisation) .AddProductToBasket() .NavigateToBasket(); products = basketPageCheckAddingPersonalisation.GetProducts(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProduct.name, products[0].name, "invalid name"); Assert.AreEqual(expectedProduct.color.ToLower(), products[0].color, "invalid color"); Assert.AreEqual(expectedProduct.size, products[0].size, "invalid size"); Assert.AreEqual(expectedProduct.item, products[0].item, "invalid item"); Assert.AreEqual(expectedProduct.personalisation, products[0].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProduct.personalisationColor, products[0].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProduct.price, products[0].price, "invalid price"); Assert.AreEqual(expectedProduct.count, products[0].count, "invalid count"); }
public ActionResult DeleteConfirmed(Guid id) { ProductCreator productCreator = UnitOfWork.ProductCreatorRepository.GetById(id); UnitOfWork.ProductCreatorRepository.Delete(productCreator); UnitOfWork.Save(); return(RedirectToAction("Index")); }
public string ConvertProducts() { DatabaseContext db = new DatabaseContext(); var products = db.TempProducts; foreach (var product in products) { var productGroup = UnitOfWork.ProductGroupRepository.Get(c => c.Code == product.Product_Type_Code).FirstOrDefault(); if (productGroup != null) { ProductCreator productCreator = UnitOfWork.ProductCreatorRepository .Get(c => c.Title == product.Maker).FirstOrDefault(); Guid?creatorId = null; if (productCreator != null) { creatorId = productCreator.Id; } ProductForm productForm = UnitOfWork.ProductFormRepository.Get(c => c.Title == product.Type) .FirstOrDefault(); Guid?productFormId = null; if (productForm != null) { productFormId = productForm.Id; } Product oProduct = new Product() { Id = Guid.NewGuid(), Title = product.Product_Name, ProductGroupId = productGroup.Id, Length = product.Length, Weight = product.App_Weight, IsPureWeight = product.Net_weight, Grade = product.Grade, Width = product.Height, Thickness = product.Width, ProductCreatorId = creatorId, ProductFormId = productFormId, Other = product.Other, IsDeleted = false, IsActive = true, CreationDate = DateTime.Now }; UnitOfWork.ProductRepository.Insert(oProduct); //db.Products.Add(oProduct); //db.SaveChanges(); UnitOfWork.Save(); } } UnitOfWork.Save(); return(""); }
public void RemoveProducFromCart() { Product firstTestMice = ProductCreator.WithFirstWireMice(); ProductCatalogPage allMicePage = new ProductCatalogPage(driver).openPage(); CartPage cartPage = allMicePage.AddProductToCartByName(firstTestMice.ProductName) .ViewCart().RemoveProduct(firstTestMice.ProductName); string emptyCartText = cartPage.GetTextAboutEmptyCart(); Assert.AreEqual(emptyCartText, "Your cart is empty", "Descriptions does not math"); }
public void checkProductPage() { MakeScreenshotWhenFail(() => { Product product = ProductCreator.WithName(); HomePage HomePage = new HomePage(); ProductPage productPage = HomePage.GoToPage().GoWithMenuToProductPage().GoToProduct(product); Assert.IsTrue(productPage.getProductName() == product.Name); }); }
public ActionResult Create(ProductCreator productCreator) { if (ModelState.IsValid) { UnitOfWork.ProductCreatorRepository.Insert(productCreator); UnitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productCreator)); }
public void CheckAddProduct() { MakeScreenshotWhenFail(() => { HomePage HomePage = new HomePage(); ProductsPage productsPage = HomePage.GoToPage().GoWithMenuToProductPage(); productsPage.AddProduct(ProductCreator.WithName()); CartPage cartPage = productsPage.GoToCartPage(); Assert.IsTrue(cartPage.CheckProductIsCart(ProductCreator.WithName())); }); }
public ActionResult Edit(ProductCreator productCreator) { if (ModelState.IsValid) { productCreator.IsDeleted = false; UnitOfWork.ProductCreatorRepository.Update(productCreator); UnitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productCreator)); }
public void CheckLocalTaxesForState() { Product firstTestMice = ProductCreator.WithFirstWireMice(); ProductCatalogPage allMicePage = new ProductCatalogPage(driver).openPage(); DeliveryShippingPage cartPage = allMicePage.AddProductToCartByName(firstTestMice.ProductName) .ViewCart() .ProceedToCheckout() .FillAddressField() .CotinueToShippingMethod() .SelectExpressShipping(); float localTaxes = cartPage.GetLocalTaxes(); Assert.AreEqual(localTaxes, 13.3f); }
public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductCreator productCreator = UnitOfWork.ProductCreatorRepository.GetById(id.Value); if (productCreator == null) { return(HttpNotFound()); } return(View(productCreator)); }
public void AddProducts() { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine("---------\nCreating Products:"); ProductCreator productCreator = new ProductCreator(ConnectionString); productCreator.Initialize(); for (int i = 1; i <= ProductsQt; i++) { productCreator.CreateProduct(); } Console.ResetColor(); }
public void PricesFilterTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); bool pricesFilterIsWorking = homePage .GoTo() .GoToItemsPage() .PricesFilterCheck(product.MinPrice, product.MaxPrice); Assert.IsTrue(pricesFilterIsWorking); }); }
public void CheckTheTotalPriceOfTwoDifferentGoods() { Logger.Log.Info("CheckTheTotalPriceOfTwoDifferentGoods"); expectedProducts = new List <Product>(); expectedProducts.Add(ProductCreator.withManyColors_Black()); expectedProducts.Add(ProductCreator.withManyColors_ArchiveBeige()); string totalPrice = ""; ProductPage productPageCheckTheTotalPriceOfTwoDifferentGoods = new ProductPage(driver); try { productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[0].URL) .AcceptCookies() .AddProductToBasket() .NavigateToBasket(); BasketPage basketPageCheckTheTotalPriceOfTwoDifferentGoods = productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[1].URL) .AddProductToBasket() .NavigateToBasket(); products = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetProducts(); totalPrice = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetTotalPrice(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProducts[0].name, products[0].name, "invalid name"); Assert.AreEqual(expectedProducts[0].color.ToLower(), products[0].color, "invalid color"); Assert.AreEqual(expectedProducts[0].size, products[0].size, "invalid size"); Assert.AreEqual(expectedProducts[0].item, products[0].item, "invalid item"); Assert.AreEqual(expectedProducts[0].personalisation, products[0].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[0].personalisationColor, products[0].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[0].count, products[0].count, "invalid count"); Assert.AreEqual(expectedProducts[1].name, products[1].name, "invalid name"); Assert.AreEqual(expectedProducts[1].color.ToLower(), products[1].color, "invalid color"); Assert.AreEqual(expectedProducts[1].size, products[1].size, "invalid size"); Assert.AreEqual(expectedProducts[1].item, products[1].item, "invalid item"); Assert.AreEqual(expectedProducts[1].personalisation, products[1].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[1].personalisationColor, products[1].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[1].count, products[1].count, "invalid count"); string productsTotalPrice = "£1,040"; Assert.AreEqual(productsTotalPrice, totalPrice, "invalid price"); }
public void CheckProductAddedToCart() { Product firstTestMice = ProductCreator.WithFirstWireMice(); ProductCatalogPage allMicePage = new ProductCatalogPage(driver).openPage(); CartPage cartPage = allMicePage.AddProductToCartByName(firstTestMice.ProductName) .ViewCart(); bool isAdded = cartPage.isProductAdded(firstTestMice.ProductName); Assert.IsTrue(isAdded, "Product not added"); Assert.IsTrue(cartPage.CountAddedProducts() == 1, "Count added product does not match "); List <string> productDescr = cartPage.GetProductDescription(firstTestMice.ProductName); Assert.AreEqual(productDescr, firstTestMice.ProductDescriptions, "Descriptions does not math"); }
public void PriceFilterTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var prices = homePage .GoTo() .GoToPhonesPage() .ApplyMaxPriceFilter(product.MaxPrice) .GetPrices(); Assert.IsTrue(!prices.Any(x => x > product.MaxPrice)); }); }
public void SearchTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var products = homePage .GoTo() .GoToPhonesPage() .SearchProduct(product.Search) .GetTitles(); Assert.IsTrue(products.Any(x => x.Contains(product.Search))); }); }
public void AddTwoDifferentProductToCart() { Product firstTestMice = ProductCreator.WithFirstWireMice(); Product secondTestMice = ProductCreator.WithSecondWireMice(); ProductCatalogPage allMicePage = new ProductCatalogPage(driver).openPage(); allMicePage.AddProductToCartByName(firstTestMice.ProductName); CartPage cartPage = allMicePage.openPage(). AddProductToCartByName(secondTestMice.ProductName) .ViewCart(); Assert.IsTrue(cartPage.CountAddedProducts() == 2); Assert.IsTrue(cartPage.isProductAdded("Razer DeathAdder V2 Pro"), "Product not added"); Assert.IsTrue(cartPage.isProductAdded("Razer Naga Pro"), "Product not added"); }
public void CheckTheBiggerPriceForBiggerSizeOfParfum() { Logger.Log.Info("CheckTheBiggerPriceForBiggerSizeOfParfum"); expectedProducts = new List <Product>(); expectedProducts.Add(ProductCreator.with100ml()); expectedProducts.Add(ProductCreator.with30ml()); ProductPage productPageCheckTheTotalPriceOfTwoDifferentGoods = new ProductPage(driver); try { productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[0].URL) .AcceptCookies() .AddProductToBasket() .NavigateToBasket(); BasketPage basketPageCheckTheTotalPriceOfTwoDifferentGoods = productPageCheckTheTotalPriceOfTwoDifferentGoods.OpenPage(expectedProducts[1].URL) .AddProductToBasket() .NavigateToBasket(); products = basketPageCheckTheTotalPriceOfTwoDifferentGoods.GetProducts(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedProducts[0].name, products[0].name, "invalid name"); Assert.AreEqual(expectedProducts[0].color, products[0].size, "invalid color"); Assert.AreEqual(expectedProducts[0].size, products[0].color, "invalid size"); Assert.AreEqual(expectedProducts[0].item, products[0].item, "invalid item"); Assert.AreEqual(expectedProducts[0].personalisation, products[0].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[0].personalisationColor, products[0].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[0].price, products[0].price, "invalid price"); Assert.AreEqual(expectedProducts[0].count, products[0].count, "invalid count"); Assert.AreEqual(expectedProducts[1].name, products[1].name, "invalid name"); Assert.AreEqual(expectedProducts[1].color, products[1].size, "invalid color"); Assert.AreEqual(expectedProducts[1].size, products[1].color, "invalid size"); Assert.AreEqual(expectedProducts[1].item, products[1].item, "invalid item"); Assert.AreEqual(expectedProducts[1].personalisation, products[1].personalisation, "invalid personalisation"); Assert.AreEqual(expectedProducts[1].personalisationColor, products[1].personalisationColor, "invalid personalisation color"); Assert.AreEqual(expectedProducts[1].price, products[1].price, "invalid price"); Assert.AreEqual(expectedProducts[1].count, products[1].count, "invalid count"); Assert.Greater(products[0].price, products[1].price, "invalid price"); }
public void ClearCartTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); string cartText = homePage .GoTo() .GoToItemsPage() .OpenItem() .AddToCart() .GoToCartPage() .EmptyCart() .EmptyCartText(); Assert.AreEqual(cartText, product.ClearCartText); }); }
public void AddToCartTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var productTitle = homePage .GoTo() .GoToPhonesPage() .SearchProduct(product.AddToCart) .OpenPhone() .AddToCart() .GoToCarPage() .GetTitle(); Assert.IsTrue(productTitle.ToLower().Contains(product.AddToCart.ToLower())); }); }
public void ClearCartTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var isCartEmpty = homePage .GoTo() .GoToPhonesPage() .SearchProduct(product.AddToCart) .OpenPhone() .AddToCart() .GoToCarPage() .ClearAll() .IsCartEmpty(); Assert.IsTrue(isCartEmpty); }); }
public void ComparisonTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var products = homePage .GoTo() .GoToPhonesPage() .SearchProduct(product.Compare[0]) .AddFirstProduct() .SearchProduct(product.Compare[1]) .AddFirstProduct() .GoToComparisonPage() .GetProductNames(); Assert.IsTrue(!products.Any(x => product.Compare.Any(u => u.ToLower().Contains(x.ToLower())))); }); }
public void CheckTheCountOfShopsInUK() { Logger.Log.Info("CheckTheCountOfShopsInUK"); expectedProduct = ProductCreator.withManyColors_Black(); string expectedLabel = "21 STORES IN UNITED KINGDOM"; string actualLabel = ""; ProductPage productPageCheckTheCountOfShopsInUK = new ProductPage(driver); try { productPageCheckTheCountOfShopsInUK.OpenPage(expectedProduct.URL) .AcceptCookies() .FindInStore() .AddStoresWithNoCurrentAvailability(); actualLabel = productPageCheckTheCountOfShopsInUK.GetNumberOfShopsLabel(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedLabel, actualLabel, "invalid label"); }
public void CheckTheSelectionOfClothesWithoutSize() { Logger.Log.Info("CheckTheSelectionOfClothesWithoutSize"); Product productForTest = ProductCreator.withManySizes_04(); string expectedMessage = "Please select a size"; ProductPage productPageCheckTheSelectionOfClothesWithoutSize = new ProductPage(driver); string actualMessage = ""; try { productPageCheckTheSelectionOfClothesWithoutSize.OpenPage(productForTest.URL) .AcceptCookies() .AddProductToBasket(); actualMessage = productPageCheckTheSelectionOfClothesWithoutSize.GetNoSizeErrorLabel(); } catch (Exception ex) { Logger.ErrorHandler(driver, ex); } Assert.AreEqual(expectedMessage, actualMessage, "invalid error message"); }
public void SearchTest() { Test(() => { var product = ProductCreator.CreateProduct(_configuration); var homePage = new HomePage(_driver); var products = homePage .GoTo() .GoToItemsPage() .SearchProduct(product.Type + " " + product.Brand); bool brandTrue = true; bool typeTrue = true; Regex regexBrands = new Regex(".*mango.*"); Regex regexTypes = new Regex(".*дж(егг)*инс.*"); var brands = products .GetBrandNames(); var types = products .GetItemsTypes(); foreach (var brand in brands) { if (!regexBrands.IsMatch(brand)) { brandTrue = false; } } foreach (var type in types) { if (!regexTypes.IsMatch(type)) { typeTrue = false; } } Assert.IsTrue(brandTrue && typeTrue); }); }
public ProductCreatorShould() { productRepository = new Mock <ProductRepository>(); eventBus = new Mock <DomainEventBus>(); productCreator = new ProductCreator(productRepository.Object, eventBus.Object); }
static void Main(string[] args) { #region Prototype Pattern /* Use the Prototype pattern when * You want to: * • Hide concrete classes from the client. * • Add and remove new classes (via prototypes) at runtime. * • Keep the number of classes in the system to a minimum. * • Adapt to changing structures of data at runtime. * Because: * • In C# 3.0, cloning by deep copying is absolutely straightforward. * Consider using this pattern: * • With the Composite pattern, to provide archiving. * • Instead of the Factory Method pattern, when subclasses start proliferating */ Console.WriteLine(""); Console.WriteLine("=================Prototype Pattern========================="); WholeLifePremiumIllustrations illustrations = new WholeLifePremiumIllustrations(); WholeLife wl1 = illustrations.Prototypes["SFWholeLife"].Clone(); wl1.ChildRiders[0].CoverageAmount = 1000000000; WholeLife wl2 = illustrations.Prototypes["IMLWholeLife"].DeepCopy(); wl2.ChildRiders[0].CoverageAmount = 1000000000; Console.WriteLine(""); Console.WriteLine("SFWholeLife Actual Object Coverage Amount : " + illustrations.Prototypes["SFWholeLife"].ChildRiders[0].CoverageAmount); Console.WriteLine("SFWholeLife Cloned Copy Coverage Amount : " + wl1.ChildRiders[0].CoverageAmount); Console.WriteLine(""); Console.WriteLine("IMLWholeLife Actual Object Coverage Amount : " + illustrations.Prototypes["IMLWholeLife"].ChildRiders[0].CoverageAmount); Console.WriteLine("IMLWholeLife Deep Copy Object Coverage Amount : " + wl2.ChildRiders[0].CoverageAmount); Console.WriteLine(""); #endregion #region Factory Pattern /*The Factory Method pattern is a way of creating objects, but letting subclasses * decide exactly which class to instantiate. Various subclasses might implement the * interface; the Factory Method instantiates the appropriate subclass based on information * supplied by the client or extracted from the current state. * * Use the Factory Method pattern when * • Flexibility is important. * • Objects can be extended in subclasses * • There is a specific reason why one subclass would be chosen over another—this logic forms part of the Factory * Method. * • A client delegates responsibilities to subclasses in parallel hierarchies. * Consider using instead.... * • The Abstract Factory, Prototype, or Builder patterns, which are more flexible (though also more complex). * • The Prototype pattern to store a set of objects to clone from the abstract factory. */ Samples.StructuralPatterns.General.ProductRequest request = new Samples.StructuralPatterns.General.ProductRequest() { Amount = 10000, IsSmoker = false, IssueAge = 45, ProductType = StructuralPatterns.Common.ProductTypes.WholeLife }; ProductCreator creator = new ProductCreator(); IProduct product = creator.GetFactoryProduct(request); Console.WriteLine("=================Factory Pattern========================="); Console.WriteLine(""); Console.WriteLine("Whole Life Product Amount: {0} and Premium: {1} ", product.Benefit.ToString("C"), product.CalculatePremium().ToString("C")); Console.WriteLine(""); #endregion #region Singleton Pattern #endregion #region Abstract Factory /* Use the Abstract Factory pattern when * • A system should be independent of how its products are created, composed, and represented. * • A system can be configured with one of multiple families of products. * • The constraint requiring products from the same factory to be used together must be enforced. * • The emphasis is on revealing interfaces, not implementations. */ ILifeFactory factory = new LifeFactory(request); ILifeProduct lifeproduct = factory.GetLifeProduct(); ITermProduct tpProduct = factory.GetTermProduct(false); ITermProduct ropProduct = factory.GetTermProduct(true); Console.WriteLine(""); Console.WriteLine("==========================Abstract Factory=============================="); Console.WriteLine("Whole Life Product Premium : " + lifeproduct.CalculatePremium().ToString("C")); Console.WriteLine("Term Plan Product Premium : " + tpProduct.CalculatePremium().ToString("C")); Console.WriteLine("ROP Product Premium : " + ropProduct.CalculatePremium().ToString("C")); Console.WriteLine(""); IDIFactory difactory = new DIFactory(request); IPaycheckProtection diproduct = difactory.GetDIProduct(); IBusinessExpense beproduct = difactory.GetBEProduct(false); IBusinessExpense beproduct1 = difactory.GetBEProduct(true); Console.WriteLine(""); Console.WriteLine("Paycheck protection Product Premium : " + diproduct.CalculatePremium().ToString("C")); Console.WriteLine("Business Expense Product Premium : " + beproduct.CalculatePremium().ToString("C")); Console.WriteLine("Business Expense 2013 Product Premium : " + beproduct1.CalculatePremium().ToString("C")); Console.WriteLine(""); #endregion #region Builder Pattern Samples.StructuralPatterns.General.ProductRequest request11 = new StructuralPatterns.General.ProductRequest() { Amount = 100000, IsSmoker = false, IssueAge = 34, ProductType = Common.ProductTypes.WholeLife }; Samples.StructuralPatterns.General.ProductRequest berequest1 = new StructuralPatterns.General.ProductRequest() { Amount = 40000, IsSmoker = true, IssueAge = 45, ProductType = Common.ProductTypes.BusinessExpense }; IBuilder builder = new LifeBuilder(request11); IBuilder bebuilder = new DIBuilder(berequest1); Console.WriteLine(""); Console.WriteLine("==========================Builder Pattern============================="); Console.WriteLine("Created Whole Life Extended product and Calcuated Premium is : " + builder.InsuranceProduct.CalculatePremium().ToString("C")); Console.WriteLine("Created BE Extended product and Calcuated Premium is : " + bebuilder.InsuranceProduct.CalculatePremium().ToString("C")); Console.WriteLine(""); #endregion Console.ReadKey(); }