コード例 #1
0
        public void Test_Empty_Keyword_Should_Return_Zero_Id()
        {
            var       api     = new MyGoogleApi();
            ArrayList results = api.getSEORankings("somewebsite.com", "", 10, false);

            Assert.True((int)results[0] == 0);
            Assert.True(results.Count == 1);
        }
コード例 #2
0
        public IActionResult Index(String keyword, String url, string tryBrute)
        {
            MyGoogleApi api = new MyGoogleApi();

            try
            {
                ArrayList occurences = api.getSEORankings(url, keyword, 100, tryBrute == "true");
                ViewData["Message"] = String.Join('\n', occurences.ToArray());
            } catch
            {
                // This will happen when google blocks your ip or their
                // service is genuinely unavailable
                ViewData["Message"] = "Google may have temporarily blocked your " +
                                      "ip (likely) or their service is unavailable " +
                                      "(unlikely)";
            }

            return(View());
        }