Exemple #1
0
        /// <summary>
        /// gets a list of rows containing the text to find from the row list
        /// </summary>
        /// <param name="columnName">the column name</param>
        /// <param name="textToFind">the text to find</param>
        /// <returns>list of GridRow</returns>
        public new List <BenchmarkELARow> GetsRowsContainingTextToFindFromList(string columnName, string textToFind)
        {
            if (RowList.Count == 0)
            {//changed to debug for test cases where we want to assert that no search results were found
                Report.Write("No items were found in the search results column list.");
                return(null);
            }
            else
            {
                List <BenchmarkELARow> rowList = new List <BenchmarkELARow>();
                string text  = null;
                int    index = 0;
                //last row is not part of the grid. so use count - 1 to disclude it.
                for (int i = 0; i < RowList.Count - 1; i++)
                {
                    if (RowList[i].Type == GridRowType.Data)
                    {
                        BenchmarkELARow BenchmarkELARow = (BenchmarkELARow)RowList[i];

                        if (Driver.WrappedDriver.GetType() == typeof(DummyDriver))
                        {
                            BenchmarkELARow.FakeText = textToFind;
                        }

                        //get the text by column name
                        if (columnName.Equals(BenchmarkELAColumnNames.TestName))
                        {
                            text = BenchmarkELARow.GetTestName();
                            //Debug.WriteLine("actual text: " + text);
                            //Debug.WriteLine("expected text to find: " + textToFind);
                        }
                        //if the text is not null
                        if (text != null)
                        {
                            //if the text contains the text to find
                            if (text.Contains(textToFind))
                            {
                                rowList.Add(BenchmarkELARow);
                            }
                        }
                    }
                }
                //may return empty row list if text is not found
                return(rowList);
            }
        }