public bool FindComputers(PostFilter c)
        {
            SearchResultProcessor resultProcessor = new SearchResultProcessor(_Driver, (IErrorLogger)this, c);

            bool result = resultProcessor.PreProcess();

            if (!result)
            {
                AddError("Failed to pre process the filtered result.");
                return(false);
            }

            do
            {
                result = resultProcessor.Process();
                if (!result)
                {
                    AddError("Failed to process the filtered result.");
                    return(false);
                }

                if (resultProcessor.IsCompleted)
                {
                    break;
                }

                result = resultProcessor.NextPage();
                if (!result)
                {
                    AddError("Failed to move to next result page.");
                    return(false);
                }
            } while (!resultProcessor.IsLastPageReached);


            if (resultProcessor.Result == null)
            {
                AddError("Unable to find product that satisfy the filtering conditions.");
                return(false);
            }

            ExpectedResult = resultProcessor.Result;

            result = SelectTargetProduct(resultProcessor.Result);
            if (!result)
            {
                AddError("Unable to select target product");
                return(false);
            }

            return(true);
        }
Example #2
0
 public SearchResultProcessor(IWebDriverWrapper driver, IErrorLogger errorlog, PostFilter postFilterCriteria)
 {
     _Driver     = driver;
     _ErrorLog   = errorlog;
     _PostFilter = postFilterCriteria;
 }