public ISort GetAlgorithm(Enums.SortAlgorithms algorithm)
        {
            ISort selectedSortingAlgorithmImpl = null;

            foreach (ISort sortingAlgorithm in sortingAlgorithms)
            {
                if (sortingAlgorithm.GetSortingAlgorithm() == algorithm)
                {
                    selectedSortingAlgorithmImpl = sortingAlgorithm;
                    break;
                }
            }

            return(selectedSortingAlgorithmImpl);
        }
Ejemplo n.º 2
0
        protected void Sort(RemoteWebDriver browser, Enums.SortAlgorithms sortAlgorithm)
        {
            SelectSort(browser, "hvJsSortItemBtn", false, sortAlgorithm);
            SelectSort(browser, "hvJsSortItemBtn", true, sortAlgorithm);

            SelectSort(browser, "hvJsSortCreatedBtn", false, sortAlgorithm);
            SelectSort(browser, "hvJsSortCreatedBtn", true, sortAlgorithm);

            SelectSort(browser, "hvJsSortCategoryBtn", false, sortAlgorithm);
            SelectSort(browser, "hvJsSortCategoryBtn", true, sortAlgorithm);

            SelectSort(browser, "hvJsSortAchievedBtn", false, sortAlgorithm);
            SelectSort(browser, "hvJsSortAchievedBtn", true, sortAlgorithm);

            SelectSort(browser, "hvJsCancelBtn", false, sortAlgorithm);
        }
Ejemplo n.º 3
0
        private IList <BucketListItem> Sort
        (
            IList <BucketListItem> bucketListItems,
            string decodedSortString,
            string decodedSortType
        )
        {
            var sortColumn = this.stringHelper.GetSortColumn(decodedSortString);
            var sortAsc    = this.stringHelper.HasSortOrderAsc(decodedSortString);

            Enums.SortAlgorithms selectedSortAlgorithm = (Enums.SortAlgorithms)Enum.Parse(typeof(Enums.SortAlgorithms), decodedSortType);
            var sortAlgorithm = availableSortingAlgorithms.GetAlgorithm(selectedSortAlgorithm);

            try
            {
                bucketListItems = sortAlgorithm.Sort(bucketListItems, sortColumn, !sortAsc);
            }
            catch (Exception ex)
            {
                Log("Sort failed - Error: " + ex.Message);
            }

            return(bucketListItems);
        }
Ejemplo n.º 4
0
        private void SelectSort(RemoteWebDriver browser, string buttonName, bool desc, Enums.SortAlgorithms sortAlgorithm)
        {
            IWebElement link = browser.FindElement(By.Id("btnMainMenu"));

            link.Click();
            System.Threading.Thread.Sleep(_testStepInterval);

            link = browser.FindElement(By.Id("hvJsSortBucketListItemBtn"));
            link.Click();
            System.Threading.Thread.Sleep(_testStepInterval);

            if (sortAlgorithm == Enums.SortAlgorithms.Bubble || sortAlgorithm == Enums.SortAlgorithms.Insertion)
            {
                var selectBox     = browser.FindElement(By.Id("hvJsSortAvailableSortAlgorithmsSelect"));
                var selectElement = new SelectElement(selectBox);
                selectElement.SelectByText(sortAlgorithm.ToString());
                System.Threading.Thread.Sleep(_testStepInterval);
            }

            if (desc)
            {
                link = browser.FindElement(By.Id("hvJsDescCheckbox"));
                link.Click();
                System.Threading.Thread.Sleep(_testStepInterval);
            }

            link = browser.FindElement(By.Id(buttonName));
            link.Click();
            System.Threading.Thread.Sleep(_testStepInterval);
        }