コード例 #1
0
ファイル: QBFake.cs プロジェクト: Ancestry/quality-bot
 public FakeComparisonParams(ScrapeHybrid[] scrapeHybrids = null, ObjectId? objectId = null, StringAsReference path = null, PageResult result = null)
 {
     ScrapeHybrids = scrapeHybrids;
     ObjectId      = objectId;
     Path          = path;
     Result        = result;
 }
コード例 #2
0
ファイル: QBFake.cs プロジェクト: Ancestry/quality-bot
 public PageResult FakePageResult(FakeComparisonResult fakeComparisonResult)
 {
     var result = new PageResult
     {
         ChangedItems                           = fakeComparisonResult.ChangedResult,
         AddedItems                             = fakeComparisonResult.AddedResult,
         RemovedItems                           = fakeComparisonResult.RemovedResult,
         UnchangedItems                         = fakeComparisonResult.UnchangedItems,
         CssChangePercentage                    = fakeComparisonResult.CssPercent,
         TextChangePercentage                   = fakeComparisonResult.TextPercent,
         OverallElementPositionChangePercentage = fakeComparisonResult.OverallPercent,
         Pixels                                 = fakeComparisonResult.PixelResults,
         Html                                   = fakeComparisonResult.HtmlResults,
         HtmlDiff                               = fakeComparisonResult.HtmlDiff
     };
     return result;
 }
コード例 #3
0
ファイル: QBFake.cs プロジェクト: Ancestry/quality-bot
        public Comparison FakeComparison(FakeComparisonParams fakeComparisonParams)
        {
            var hybrid1 = new ScrapeHybrid();
            var hybrid2 = new ScrapeHybrid();
            var result = new PageResult();
            if (fakeComparisonParams.ScrapeHybrids == null)
            {
                var idString = new StringAsReference {Value = "a1b2c3d4e5f6a7b8c9d1e"};
                var htmlString = new StringAsReference {Value = ""};

                hybrid1 = new ScrapeHybrid
                {
                    ExcludeJquerySelector = @"''",
                    IncludeJquerySelector = @"'body*'",
                    Script                = "",
                    BoundingRectangle     = new Rectangle(0, 0, 0, 0),
                    Description           = "",
                    IdString              = idString,
                    Path                  = null,
                    Resources             = null,
                    Html                  = htmlString,
                    Url                   = "http://www.google.com",
                    Screenshot            = null,
                    ViewportSize          = new Size(800, 600),
                    Browser               = "Chrome",
                    BrowserVersion        = "10",
                    TimeStamp             = DateTime.Now,
                    Platform              = "Windows",
                    Cookies               = null
                };
                hybrid2 = new ScrapeHybrid
                {
                    ExcludeJquerySelector = @"''",
                    IncludeJquerySelector = @"'body*'",
                    Script                = "",
                    BoundingRectangle     = new Rectangle(10, 10, 10, 10),
                    Description           = "",
                    IdString              = idString,
                    Path                  = null,
                    Resources             = null,
                    Html                  = htmlString,
                    Url                   = "http://www.ancestry.com",
                    Screenshot            = null,
                    ViewportSize          = new Size(800, 600),
                    Browser               = "FireFox",
                    BrowserVersion        = "10",
                    TimeStamp             = DateTime.Now.AddDays(10),
                    Platform              = "Windows",
                    Cookies               = null
                };
            }

            if (fakeComparisonParams.Result == null)
            {
                result = FakePageResult(new FakeComparisonResult());
            }
            var fakedComparison = new Comparison
            {
                Scrapes = fakeComparisonParams.ScrapeHybrids ?? new[] { hybrid1, hybrid2 },
                Id      = fakeComparisonParams.ObjectId      ?? new ObjectId("555b77b99b111d2aa4b33333"),
                Path    = fakeComparisonParams.Path          ?? new StringAsReference(),
                Result  = fakeComparisonParams.Result        ?? result
            };

            return fakedComparison;
        }