コード例 #1
0
        public void GivenWebPageContentWithNoInfoTrackResultsExpectCorrectRankings()
        {
            //Arrange
            const string SomeRandomWebPageContent = "<!doctype html><html><span class=\"Z98Wse\">Ad</span><cite>https://www.website1.com.au/Property_<b>Search</b></cite><span class=\"CiacGf\"></span><cite>www.saiglobal.com/<b>title</b>-<b>search</b></cite></div><table border=\"0\" cellpadding=\"0\" cellspacing=\"0\"><tr><td valign=\"top\"><cite>https://www.website2.com.au/SomePage</cite></html>";
            const string InfoTrackUrl             = "https://www.infotrack.com.au";

            //Act
            string actualRankings = ResultsGenerator.GetRankingsFormattedAsString(SomeRandomWebPageContent, InfoTrackUrl);

            //Assert
            Assert.AreEqual("0", actualRankings);
        }
コード例 #2
0
 public ViewResult GetResults(InputFields inputFields)
 {
     if (ModelState.IsValid)
     {
         string  googleSearchUrl = UrlGenerator.GenerateGoogleSearchUrl(inputFields.KeyWords);
         string  webPageContent  = WebPageDownloader.GetWebPageContent(googleSearchUrl);
         string  rankings        = ResultsGenerator.GetRankingsFormattedAsString(webPageContent, inputFields.Url);
         Results results         = new Results {
             Rankings = rankings
         };
         return(View("Results", results));
     }
     return(View("Index"));
 }
コード例 #3
0
ファイル: Processor.cs プロジェクト: ExtTS/generator
 protected Processor()
 {
     this.Store             = new Store();
     this.Extractor         = new Extractor(this);
     this.Preparer          = new Preparer(this);
     this.JsDuck            = new JsDuck(this);
     this.Reader            = new Reader(this);
     this.Consolidator      = new Consolidator(this);
     this.SpecialsGenerator = new SpecialsGenerator(this);
     this.TypesChecker      = new TypesChecker(this);
     this.ResultsGenerator  = new ResultsGenerator(this);
     this.Exceptions        = new List <Exception>();
     this.JsDuckErrors      = new List <string>();
     this.ProcessingInfo    = new ProcessingInfo();
 }
コード例 #4
0
ファイル: Processor.cs プロジェクト: ExtTS/generator
        protected void processGenerateResults()
        {
            this.Consolidator = null;
            this.ProcessingInfo.StageIndex = 17;
            this.ProcessingInfo.StageName  = "Generating result TypeScript type definitions files.";
            this.allClassesCount           = (double)(
                (this.Store.ExtAllClasses.Count - this.Store.ExtCallbackClasses.Count)
                + this.Store.UnknownTypes.Count
                );
            this.ResultsGenerator.GenerateResults(
                this.progressHandlerCycleProcessing
                );

            this.ProcessingInfo.InfoText = "Finished.";
            this.ProcessingInfo.Progress = 100.0;
            this.ProcessingInfoHandler.Invoke(this.ProcessingInfo);

            this.Reader           = null;
            this.ResultsGenerator = null;
            this.Store            = null;
        }