public void CheckCurrencyFormat(Currency currency, string puttern) { HomePage homePage = LoadHomePage(); homePage = homePage.ChooseCurrency(currency); homePage.AddProductToCart(ProductRepository.GetIPhone()); cartPage = homePage.GotoShoppingCartPage(); SelectShippingMethodComponent ShippingMethod = cartPage.ApplySippingAndTaxes(ShippingDetailsRepository.GetUADetails()); cartPage = ShippingMethod.ApllyShippingMethod(); Thread.Sleep(2000); // for presentation ONLY Total = cartPage.GetPriceOption("Total:"); SubTotal = cartPage.GetPriceOption("Sub-Total:"); FlatShippingRate = cartPage.GetPriceOption("Flat Shipping Rate:"); FixedTestTax = cartPage.GetPriceOption(TaxRateRepository.GetFixTaxRate().Name + ":"); PercentageTestTax = cartPage.GetPriceOption(TaxRateRepository.GetPercentageTaxRate().Name + ":"); StringAssert.IsMatch(puttern, Total); StringAssert.IsMatch(puttern, SubTotal); StringAssert.IsMatch(puttern, FlatShippingRate); StringAssert.IsMatch(puttern, FixedTestTax); StringAssert.IsMatch(puttern, PercentageTestTax); // for presentation ONLY Console.WriteLine(Total); Console.WriteLine(SubTotal); Console.WriteLine(FlatShippingRate); Console.WriteLine(PercentageTestTax); Console.WriteLine(FixedTestTax); }
public void OneTimeTearDown() { AdminLoginPage ALoginPage = LoadAdminLoginPage(); ALoginPage.ClickLoginButton(); AdminHomePage adminHomePage = ALoginPage.LogInAdmin(); adminHomePage.ClickSystemMenu(); adminHomePage.ClickLocalizationMenu(); adminHomePage.ClickTaxesMenu(); TaxClassesPage taxClassesPage = adminHomePage.GoToTaxClassesPage(); taxClassesPage = taxClassesPage.RemoveRuleFromTaxClass(TaxClassesRepository.GetTaxebleProductsTaxClass(), TaxRateRepository.GetFixTaxRate()); taxClassesPage = taxClassesPage.RemoveRuleFromTaxClass(TaxClassesRepository.GetTaxebleProductsTaxClass(), TaxRateRepository.GetPercentageTaxRate()); Thread.Sleep(3000); // for presentation ONLY taxClassesPage.ClickSystemMenu(); TaxRatesPage taxRatesPage = taxClassesPage.GoToTaxRatesPage(); taxRatesPage = taxRatesPage.DeleteTaxRate(TaxRateRepository.GetFixTaxRate().Name); taxRatesPage = taxRatesPage.DeleteTaxRate(TaxRateRepository.GetPercentageTaxRate().Name); Thread.Sleep(3000); // for presentation ONLY taxClassesPage.ClickSystemMenu(); GeoZonesPage geoZonesPage = taxClassesPage.GoToGeoZonePage(); geoZonesPage.DeleteGeoZone(GeoZonesRepository.GetUAGeoZone().Name); Thread.Sleep(1000); // for presentation ONLY }
static decimal GiftAidAmount(decimal donationAmount) { // TODO: Handle DI with an IoC container var taxRateRepository = new TaxRateRepository(); var calculator = new GaCalculator(taxRateRepository); return(calculator.GiftAidAmount(donationAmount)); }
//Material Cost = Area * CostPerSquareFoot //LaborCost = Area * LaborCostperSquareFoot //Tax = ((MaterialCost + LaborCost)*(Taxrate/100)) //--Tax Rates are stores as whole numnbers //Total = (MaterialCost + LaborCost +Tax) public EditOrderManager(IOrderRepository OrderRepo) { _orderRepo = OrderRepo; _orderToEdit = new Order(); _updatedOrder = new Order(); _taxRateRepo = new TaxRateRepository(); _productRepo = new ProductRepository(); _newProduct = new Product(); }
public AddOrderManager(IOrderRepository OrderRepo) { _productRepo = new ProductRepository(); Product = new Product(); _taxRateRepo = new TaxRateRepository(); _orderRepo = OrderRepo; }
public void CheckFixedTaxHasTheSameValueAsInAdminPanel() { HomePage homePage = LoadHomePage(); homePage.AddProductToCart(ProductRepository.GetIPhone()); cartPage = homePage.GotoShoppingCartPage(); SelectShippingMethodComponent ShippingMethod = cartPage.ApplySippingAndTaxes(ShippingDetailsRepository.GetUADetails()); cartPage = ShippingMethod.ApllyShippingMethod(); Thread.Sleep(2000); // for presentation ONLY decimal fixedTestTax = cartPage.GetPriceOptionValue(TaxRateRepository.GetFixTaxRate().Name + ":"); decimal expectedResult = 2m; Assert.AreEqual(expectedResult, fixedTestTax); }
public void TaxRateUpdatesCorrectly(string newState) { OrderRepository OrderRepo = new OrderRepository(); EditOrderManager EditManager = new EditOrderManager(OrderRepo); TaxRateRepository TaxRateRepo = new TaxRateRepository(); //this will update the "new state" field after called EditManager.ValidateState(newState); EditManager.OrderToEdit.TaxRate = 1; EditManager.CalculateNewTaxRate(); TaxRate newTestTaxRate = EditManager.TaxRateRepo.TaxRateList.Find(t => t.StateAbbreviation == newState); decimal rate = newTestTaxRate.Rate; Assert.AreEqual(EditManager.NewTaxRate, rate); }
//returns true if state is in sales area, false if it is not public static bool ValidateStateInSalesArea(States state) { TaxRateRepository TaxRateRepo = new TaxRateRepository(); string stateString = state.ToString(); TaxRate result = TaxRateRepo.TaxRateList.Find(x => x.StateAbbreviation.Contains(stateString)); if (result == null) { return(false); } else { return(true); } }
public UnitOfWork(PlutoContext context) { _ILog = Log.GetInstance; _context = context; AppUsers = new UserRepository(context); Students = new StudentRepository(context); PaymentHistories = new PaymentHistoryRepository(context); Payments = new PaymentRepository(context); studentclasses = new StudentClassRepository(context); departments = new DepartmentRepository(context); regions = new RegionRepository(context); studentstatuses = new StudentStatusRepository(context); employees = new EmployeeRepository(context); employeedocuments = new EmployeeDocumentRepository(context); payrollamounts = new PayrollAmountRepository(context); employeecategories = new EmployeeCategoryRepository(context); employeelevelsofeducation = new EmployeeLevelOfEducationRepository(context); payrollrates = new PayrollRateRepository(context); taxrates = new TaxRateRepository(context); ssnitrates = new SSNITRateRepository(context); studentsubjects = new StudentSubjectRepository(context); payrollallowances = new PayrollAllowancesRepository(context); employeetypes = new EmployeeTypeRepository(context); employeeloanhistories = new EmployeeLoanHistoryRepository(context); employeeloans = new EmployeeLoanRepository(context); exams = new ExamRepository(context); marks = new MarkRepository(context); externalhelper = new ExternalHelperRepository(context); hostels = new HostelRepository(context); libraries = new LibraryRepository(context); transports = new TransportRepository(context); expenses = new ExpenseRepository(context); expensecategories = new ExpenseCategoryRepository(context); incomes = new IncomeRepository(context); incomecategories = new IncomeCategoryRepository(context); books = new BookRepository(context); booktypes = new BookTypeRepository(context); rooms = new RoomRepository(context); payrolldates = new PayrollDateRepository(context); allowances = new AllowanceRepository(context); }
public void OneTimeSetup() { AdminLoginPage ALoginPage = LoadAdminLoginPage(); AdminHomePage AHomePage = ALoginPage.LogInAdmin(); AHomePage.ClickSystemMenu(); AHomePage.ClickLocalizationMenu(); GeoZonesPage zonesPage = AHomePage.GoToGeoZonePage(); zonesPage.AddNewGeoZone(GeoZonesRepository.GetUAGeoZone()); zonesPage.ClickSystemMenu(); zonesPage.ClickTaxesMenu(); TaxRatesPage ratesPage = zonesPage.GoToTaxRatesPage(); ratesPage.AddNewTaxRate(TaxRateRepository.GetFixTaxRate()); ratesPage.AddNewTaxRate(TaxRateRepository.GetPercentageTaxRate()); ratesPage.ClickSystemMenu(); TaxClassesPage classesPage = ratesPage.GoToTaxClassesPage(); classesPage = classesPage.EditTaxClass(TaxClassesRepository.GetTaxebleProductsTaxClass(), TaxRateRepository.GetFixTaxRate()); classesPage = classesPage.EditTaxClass(TaxClassesRepository.GetTaxebleProductsTaxClass(), TaxRateRepository.GetPercentageTaxRate()); Thread.Sleep(2000); // for presentation ONLY }
public static void TaxAndTotalUpdatesCorrectly(string testState) { OrderRepository OrderRepo = new OrderRepository(); EditOrderManager EditManager = new EditOrderManager(OrderRepo); TaxRateRepository TaxRateRepo = new TaxRateRepository(); EditManager.OrderToEdit.Product = new Product(); EditManager.OrderToEdit.Product.ProductType = "Carpet"; EditManager.OrderToEdit.Product.CostPerSquareFoot = 2.25M; EditManager.OrderToEdit.Product.LaborCostPerSquareFoot = 2.10M; EditManager.OrderToEdit.Area = 200M; EditManager.OrderToEdit.ProductType = "Carpet"; EditManager.OrderToEdit.State = States.OH; EditManager.NewArea = 200M; //sets new state EditManager.ValidateState(testState); //sets Taxrate EditManager.CalculateNewTaxRate(); EditManager.ValidateProduct(""); EditManager.CalculateNewLaborCost(); EditManager.CalculateNewMaterialCost(); EditManager.CalculateNewTax(); TaxRate testRate = TaxRateRepo.TaxRateList.Find(x => x.StateAbbreviation.Contains(testState)); decimal rate = testRate.Rate; decimal expectedTax = (EditManager.NewMaterialCost + EditManager.NewLaborCost) * (rate / 100); Assert.AreEqual(expectedTax, EditManager.NewTax); EditManager.CalculateNewTotal(); decimal expectedTotal = EditManager.NewMaterialCost + EditManager.NewLaborCost + expectedTax; Assert.AreEqual(expectedTotal, EditManager.NewTotal); //what was the old tax, what is the new Tax }