Example #1
0
        public void GetLocations_Return_List_Of_One_Location()
        {
            IWebPageTester gtMetrixObject = new CustomTester("abc", "abc");
            var            browsers       = gtMetrixObject.GetLocations();

            Assert.AreEqual(browsers.Count, 1);
        }
Example #2
0
        public void GetLocations_SubmitSite_Returns_new_TestId()
        {
            var            url              = "www.w3schools.com";
            var            location         = @"C:\Users\Pramod\Documents\visual studio 2017\Projects\ProjectRsa\ProjectRsa.UI\Content\screenshots";
            var            screenshotPrefix = @"http://api.screenshotlayer.com/api/capture?access_key=bf00597a1e21c182ca629879d0b953d4&width=540&viewport=1440x900&url=";
            IWebPageTester gtMetrixObject   = new CustomTester(location, screenshotPrefix);
            var            response         = gtMetrixObject.SubmitTest(new TestRequestParameter(url));

            Assert.IsNotNull(response.TestId);
        }
        public ActionResult Index(ServerPageModel model)
        {
            model.Urls = model.UrlCsv.Trim(',').Split(',').ToList();
            var location    = Helper.ScreenShotPath;
            var snapshotUrl = Helper.ScreenShotUrl;

            model.Results = new List <TestResponse>();
            var threadingOptions = new ParallelOptions()
            {
                MaxDegreeOfParallelism = 5
            };

            Parallel.ForEach(model.Urls, (url) =>
            {
                IWebPageTester tester  = new CustomTester(location, snapshotUrl);
                var testRequest        = new TestRequestParameter(url);
                var submissionResponse = tester.SubmitTest(testRequest);
                var result             = tester.GetResult(submissionResponse.TestId);
                model.Results.Add(result);
            });
            model.Results        = SortResultsBy(model.Results, model.SortBy);
            Session["ViewModel"] = model;
            return(View(model));
        }
Example #4
0
        public void CustomTester_Implements_Interface()
        {
            IWebPageTester gtMetrixObject = new CustomTester("abc", "abc");

            Assert.AreEqual(gtMetrixObject.GetType(), typeof(CustomTester));
        }