Example #1
0
        public Service(string outputDir)
        {
            _comparePersister = PersisterFactory.CreateComparePersisterInstance(outputDir);
            _scrapePersister = PersisterFactory.CreateScrapePersisterInstance(outputDir);

            var elementProvider = new ElementProvider();
            var webRequestUtil = new WebRequestUtil();
            _scrapeBuilder = new ScrapeBuilder(elementProvider, webRequestUtil);
        }
        public void Setup()
        {
            var webRequestUtilMock = Substitute.For<IWebRequestUtil>();
            Resource[] resArray =
            {
                new Resource
                {
                    Uri = "http://www.zombo.com/inrozxa.swf"
                },
                new Resource
                {
                    Uri = "http://www.google.com/197834gfn8qw673tgfn8763tbf.aspx"
                }
            };

            webRequestUtilMock.HeadCheck(resArray).ReturnsForAnyArgs(new []
            {
                new Resource
                {
                    Headers = new List<string>()
                    {
                        "Content-Encoding:",
                        "Vary:Accept-Encoding",
                        "X-AspNetMvc-Version:4.0",
                        "X-UA-Compatible:IE=edge",
                        "Content-Length:154",
                        "Cache-Control:private",
                        "Content-Type:text/html; charset=utf-8",
                        "Date:Mon, 03 Dec 2012 16:42:16 GMT",
                        "Server:Microsoft-IIS/7.5",
                        "X-AspNet-Version:4.0.30319"
                    },
                    StatusCode = HttpStatusCode.OK,
                    StatusDescription = "OK",
                    Uri = "http://www.zombo.com/inrozxa.swf"
                }
            });
            IFormatter formatter = new BinaryFormatter();
            _pageData = (PageData)formatter.Deserialize(GetResourceStream("QualityBot.Test.Tests.TestData.FakePageData.bin"));
            _scrapeBuilder = new ScrapeBuilder(new ElementProvider(), webRequestUtilMock);
        }