public void CheckTotalAndSubtotalValuesWhenThereAreDiscountsForBothLicensesAndYearlyDropDowns()
        {
            productsPage  = new ProductsPage(CmdDriver.Driver);
            yourOrderPage = new YourOrderPage(CmdDriver.Driver);

            extentReportUtils.createATestCase("Check total and subtotal values when there are discounts for both licenses and yearly dropdowns");
            extentReportUtils.addTestLog(Status.Info, "CheckTotalAndSubtotalValuesWhenThereAreDiscountsForBothLicensesAndYearlyDropDowns");
            //CmdDriver.NavigateTo("https://store.progress.com/configure-purchase?skuId=6127");

            productsPage.ClickAcceptAllCookies();

            // Choose product and click on 'Buy Now' button for it
            productsPage.ClickBuyNowButtonByProductName(ProductsEnum.DEVCRAFT_ULTIMATE);

            yourOrderPage.ClickAcceptAllCookies();

            Product product = new Product(ProductType.LICENSE_AND_YEARLY_DISCOUNT);

            // Set min values to have discounts for both licenses and yearly
            product.MinLicenseQty = 2;
            product.MinYearlyQty  = 2;

            // Set Unit Price and M & S subscription price
            product.InitialUnitPrice     = yourOrderPage.GetUnitPrice();
            product.MNsSubscriptionPrice = yourOrderPage.GetMnSSubscriptionPrice();

            // Set license quantity
            int randomLicenseQuantity = yourOrderPage.GetRandomLicenseQuantityWithMinValue(product.MinLicenseQty);

            product.LicenseQuantity = randomLicenseQuantity;

            // Set license discount
            product.LicenseDiscount = yourOrderPage.GetQuantityDiscounts(product.LicenseQuantity);

            // Calculate discount
            yourOrderPage.SetLicenseQuantity(product.LicenseQuantity);

            // Set Yearly quantity
            int randomYearQuantity = yourOrderPage.GetRandomYearQuantityWithMinValue(product.MinYearlyQty);

            product.YearlyQuantity = randomYearQuantity;
            product.YearlyDiscount = yourOrderPage.GetYearQuantityDiscounts(randomYearQuantity);
            yourOrderPage.SetMaintenanceAndSupportQuantity(product.YearlyQuantity);

            // Calculations
            product.CalculateValues();

            // Assert actual and expected unit price
            double actualUnitPrice = yourOrderPage.GetUnitPrice();

            Assert.AreEqual(product.UnitPrice, actualUnitPrice);

            // Check discount for licenses
            double actualDiscountForLicenses = yourOrderPage.GetSavingsLabelForUnitPrice();

            Assert.AreEqual(product.ExpectedDiscountForLicense, actualDiscountForLicenses);

            // Assert actual and expected yearly price
            double actualYearlyPrice = yourOrderPage.GetYearlyQuantityValue();

            Assert.AreEqual(product.ExpectedYearlyPrice, actualYearlyPrice);

            // Check discount
            double actualDiscountForYear = yourOrderPage.GetSavingsLabelForYearlyPrice();

            Assert.AreEqual(product.DiscountForYear, actualDiscountForYear);

            // Assert subtotal value
            double actualSubtotal = yourOrderPage.GetSubtotalValue();

            Assert.AreEqual(product.SubtotalValue, actualSubtotal);

            // Assert renewal price
            double actualRenewalPrice = yourOrderPage.GetMnSSubscriptionPrice();

            Assert.AreEqual(product.ExpectedRenewalPrice, actualRenewalPrice);

            // Assert total license price
            double actualTotalLicensesPrice = yourOrderPage.GetTotalLicensesPrice();

            Assert.AreEqual(product.ExpectedTotalLicensesPrice, actualTotalLicensesPrice);

            // Assert total Maintenance price
            double actualMaintenancePrice = yourOrderPage.GetTotalMaintenancePrice();

            Assert.AreEqual(product.ExpectedMaintenancePrice, actualMaintenancePrice);

            // Assert total discounts
            double actualTotalDiscounts = yourOrderPage.GetTotalDiscounts();

            Assert.AreEqual(product.ExpectedTotalDiscounts, actualTotalDiscounts);

            // Assert Total value
            double actualTotalValue = yourOrderPage.GetTotalValue();

            Assert.AreEqual(product.ExpectedTotalValue, actualTotalValue);

            // Assert Subtotal and Total value
            Assert.AreEqual(product.SubtotalValue, product.ExpectedTotalValue);
        }
        public void CheckTotalAndSubtotalValuesWhenThereIsADiscountOnlyForYearly()
        {
            yourOrderPage = new YourOrderPage(CmdDriver.Driver);

            extentReportUtils.createATestCase("Check total and subtotal values when there are discounts for both licenses and yearly dropdowns");
            extentReportUtils.addTestLog(Status.Info, "CheckTotalAndSubtotalValuesWhenThereAreDiscountsForBothLicensesAndYearlyDropDowns");
            CmdDriver.NavigateTo("https://store.progress.com/configure-purchase?skuId=6127");

            yourOrderPage.ClickAcceptAllCookies();

            Product product = new Product(ProductType.ONLY_YEARLY_DISCOUNT);

            product.LicenseQuantity = 1;
            product.MinYearlyQty    = 2;

            // Set Unit Price and M & S subscription price
            product.InitialUnitPrice     = yourOrderPage.GetUnitPrice();
            product.MNsSubscriptionPrice = yourOrderPage.GetMnSSubscriptionPrice();

            // Assert Savings Label is NOT displayed under Unit Price
            Assert.IsFalse(yourOrderPage.IsSavingsLabelForUnitPriceDisplayed());

            // Set Yearly quantity
            int randomYearQuantity = yourOrderPage.GetRandomYearQuantityWithMinValue(product.MinYearlyQty);

            product.YearlyQuantity = randomYearQuantity;
            product.YearlyDiscount = yourOrderPage.GetYearQuantityDiscounts(randomYearQuantity);
            yourOrderPage.SetMaintenanceAndSupportQuantity(product.YearlyQuantity);

            // Calculations
            product.CalculateValues();

            // Assert actual and expected unit price
            double actualUnitPrice = yourOrderPage.GetUnitPrice();

            Assert.AreEqual(product.UnitPrice, actualUnitPrice);

            // Assert actual and expected yearly price
            double actualYearlyPrice = yourOrderPage.GetYearlyQuantityValue();

            Assert.AreEqual(product.ExpectedYearlyPrice, actualYearlyPrice);

            // Check discount
            double actualDiscountForYear = yourOrderPage.GetSavingsLabelForYearlyPrice();

            Assert.AreEqual(product.DiscountForYear, actualDiscountForYear);

            // Assert subtotal value
            double actualSubtotal = yourOrderPage.GetSubtotalValue();

            Assert.AreEqual(product.SubtotalValue, actualSubtotal);

            // Assert renewal price
            double actualRenewalPrice = yourOrderPage.GetMnSSubscriptionPrice();

            Assert.AreEqual(product.ExpectedRenewalPrice, actualRenewalPrice);

            // Assert total Maintenance price
            double actualMaintenancePrice = yourOrderPage.GetTotalMaintenancePrice();

            Assert.AreEqual(product.ExpectedMaintenancePrice, actualMaintenancePrice);

            // Assert total discounts
            double actualTotalDiscounts = yourOrderPage.GetTotalDiscounts();

            Assert.AreEqual(product.ExpectedTotalDiscounts, actualTotalDiscounts);

            // Assert Total value
            double actualTotalValue = yourOrderPage.GetTotalValue();

            Assert.AreEqual(product.ExpectedTotalValue, actualTotalValue);

            // Assert Subtotal and Total value
            Assert.AreEqual(product.SubtotalValue, product.ExpectedTotalValue);
        }