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 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 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);
        }
Example #5
0
 /// <summary>
 /// overloaded to create typed version of Query
 /// </summary>
 /// <param name="feedQuery"></param>
 /// <returns>SitesFeed</returns>
 public SitesFeed Query(SitesQuery feedQuery)
 {
     return base.Query(feedQuery) as SitesFeed;
 }
Example #6
0
 /// <summary>
 /// overloaded to create typed version of Query
 /// </summary>
 /// <param name="feedQuery"></param>
 /// <returns>SitesFeed</returns>
 public SitesFeed Query(SitesQuery feedQuery)
 {
     return(base.Query(feedQuery) as SitesFeed);
 }