示例#1
0
        /// <summary>
        /// Sets the Rows List
        /// </summary>
        public override void SetRowLists()
        {
            base.SetRowLists();
            int rowIndex = 0;

            foreach (var webElement in WebElementRows)
            {
                Report.Write("GridRow by index: " + rowIndex);
                GridRowType rowType = GetGridRowType(rowIndex);
                Report.Write("GridRowType: " + rowType);
                var lineItem = new ViewPortalMyTestResultsRow(gridCssSelector, webElement, rowIndex, rowType, ColumnList, ControlPrefix);
                RowList.Add(lineItem);
                rowIndex++;
            }
        }
示例#2
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 ViewPortalMyTestResultsRow</returns>
        public new List <ViewPortalMyTestResultsRow> GetsRowsContainingTextToFindFromList(string columnName, string textToFind)
        {
            if (RowList.Count == 0)
            {
                Assert.Fail("No items were found in the search results column list.");
                return(null);
            }

            else
            {
                List <ViewPortalMyTestResultsRow> viewPortalMyTestResultsRowList = new List <ViewPortalMyTestResultsRow>();
                string text  = null;
                int    index = 0;
                foreach (var row in RowList)
                {
                    ViewPortalMyTestResultsRow viewPortalMyTestResultsRow = (ViewPortalMyTestResultsRow)row;

                    if (viewPortalMyTestResultsRow.Type != GridRowType.Header && viewPortalMyTestResultsRow.Type != GridRowType.Pagination)
                    {
                        //get the text by column name
                        if (columnName.Equals(ViewPortalMyTestResultsColumnNames.TestName))
                        {
                            text = viewPortalMyTestResultsRow.GetTestName();
                        }

                        if (columnName.Equals(ViewPortalMyTestResultsColumnNames.Subject))
                        {
                            text = viewPortalMyTestResultsRow.GetTestSubject();
                        }

                        if (columnName.Equals(ViewPortalMyTestResultsColumnNames.GradeLevel))
                        {
                            text = viewPortalMyTestResultsRow.GetTestGradeLevel();
                        }

                        if (columnName.Equals(ViewPortalMyTestResultsColumnNames.TestStage))
                        {
                            text = viewPortalMyTestResultsRow.GetTestStage();
                        }

                        if (columnName.Equals(ViewPortalMyTestResultsColumnNames.ModifiedDate))
                        {
                            text = viewPortalMyTestResultsRow.GetLastModifiedDateOfTest();
                        }

                        //if the text is not null
                        if (text != null)
                        {
                            //if the text contains the text to find
                            if (text.Contains(textToFind))
                            {
                                viewPortalMyTestResultsRowList.Add(viewPortalMyTestResultsRow);
                            }
                        }
                    }
                }

                //may return empty row list if text is not found
                return(viewPortalMyTestResultsRowList);
            }
        }