public void UpdateGeolocation()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            try
            {

                SitesQuery q = new SitesQuery();
                SitesFeed sf = service.Query(q);

                SitesEntry entry = new SitesEntry();
                string siteUrl = "http://www.example.dk/";
                entry.Content.Src = siteUrl;
                entry.Content.Type = "text/plain";
                SitesEntry newEntry = service.Insert(new Uri(SitesQuery.HttpsFeedUrl), entry);

                newEntry.GeoLocation = "US";
                SitesEntry updatedEntry = newEntry.Update();

                Assert.IsTrue(updatedEntry != null);
                Assert.IsTrue(updatedEntry.GeoLocation == "US");
            }
            finally
            {
                Uri deleteUrl = SitesQuery.CreateCustomUri("http://www.example.dk");
                service.Delete(deleteUrl, null);
            }

        }
        public void DeleteSite()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitesQuery feedQuery = new SitesQuery();
            SitesFeed beforeFeed = service.Query(feedQuery);

            int before = beforeFeed.Entries.Count;

            Uri deleteUrl = SitesQuery.CreateCustomUri("http://www.example.com");
            service.Delete(deleteUrl);

            SitesFeed afterFeed = service.Query(feedQuery);
            int after = afterFeed.Entries.Count;

            Assert.Greater(before, after);
        }
        public void InsertSite()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitesQuery feedQuery = new SitesQuery();
            SitesFeed beforeFeed = service.Query(feedQuery);

            int before = beforeFeed.Entries.Count;

            SitesEntry entry = new SitesEntry();
            string siteUrl = "http://www.example.com/";
            entry.Content.Src = siteUrl;
            entry.Content.Type = "text/plain";
            service.Insert(new Uri(SitesQuery.HttpsFeedUrl), entry);

            SitesFeed afterFeed = service.Query(feedQuery);
            int after = afterFeed.Entries.Count;

            Assert.Greater(after, before);
        }
        public void QuerySitemaps()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitemapsQuery feedQuery = new SitemapsQuery(SitemapsQuery.CreateCustomUri("http%3A%2F%2Fwww%2Eexample%2Ecom%2F"));
            SitemapsFeed feed = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (SitemapsEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
            }
        }
        public void QuerySites()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            SitesQuery feedQuery = new SitesQuery();
            SitesFeed feed = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (SitesEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
                Assert.IsNotNull(entry.Verified);
            }
        }
        public void BasicQuery()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            string slug =
                Utilities.EncodeSlugHeader(
                    "https://www.google.com/webmasters/tools/feeds/http%3A%2F%2Fwww%2Eexample%2Ecom%2F/crawlissues/");
            FeedQuery query = new FeedQuery(slug);
            AtomFeed feed = service.Query(query);

            Assert.IsNotNull(feed);
        }
        public void QueryCrawlIssues()
        {
            WebmasterToolsService service = new WebmasterToolsService(this.ApplicationName);
            service.Credentials = new GDataCredentials(this.userName, this.passWord);

            string slug =
                Utilities.EncodeSlugHeader(
                    "https://www.google.com/webmasters/tools/feeds/http%3A%2F%2Fwww%2Eexample%2Ecom%2F/crawlissues/");
            CrawlIssuesQuery feedQuery = new CrawlIssuesQuery(slug);
            CrawlIssuesFeed feed = service.Query(feedQuery);

            Assert.GreaterOrEqual(feed.Entries.Count, 0);

            foreach (CrawlIssuesEntry entry in feed.Entries)
            {
                Assert.IsNotNull(entry.Id);
            }
        }