public IList<Album> GetAlbums(SyndicationFeed feed) { var albumList = new List<Album>(); foreach (var syndicationItem in feed.Items) { var picasaQuery = new PicasaQuery(syndicationItem.Id); var album = new Album() { Id = picasaQuery.Uri.Segments.LastOrDefault(), Title = syndicationItem.Title.Text, Description = syndicationItem.Summary.Text }; albumList.Add(album); } return albumList; }
///////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////// /// <summary>runs an authentication test</summary> ////////////////////////////////////////////////////////////////////// [Test] public void PhotosAuthenticationTest() { Tracing.TraceMsg("Entering PhotosAuthenticationTest"); PicasaQuery query = new PicasaQuery(); PicasaService service = new PicasaService("unittests"); query.KindParameter = "album,tag"; if (this.defaultPhotosUri != null) { if (this.userName != null) { service.Credentials = new GDataCredentials(this.userName, this.passWord); } query.Uri = new Uri(this.defaultPhotosUri); AtomFeed feed = service.Query(query); ObjectModelHelper.DumpAtomObject(feed,CreateDumpFileName("PhotoAuthTest")); if (feed != null && feed.Entries.Count > 0) { Tracing.TraceMsg("Found a Feed " + feed.ToString()); DisplayExtensions(feed); foreach (AtomEntry entry in feed.Entries) { Tracing.TraceMsg("Found an entry " + entry.ToString()); DisplayExtensions(entry); } } } }
public void ThumbsizeTest() { PicasaQuery target = new PicasaQuery(); // TODO: Initialize to an appropriate value string expected = "TestValue"; string actual; target.Thumbsize = expected; actual = target.Thumbsize; Assert.AreEqual(expected, actual); }
public void PicasaQueryConstructorTest() { string queryUri = "http://www.google.com/test"; string expected = "http://www.google.com/test?kind=tag"; PicasaQuery target = new PicasaQuery(queryUri); Assert.AreEqual(new Uri(expected), target.Uri); }
public void PicasaQueryConstructorTest1() { PicasaQuery target = new PicasaQuery(); Assert.IsNotNull(target); }
public void AccessTest() { PicasaQuery target = new PicasaQuery(); // TODO: Initialize to an appropriate value PicasaQuery.AccessLevel expected = PicasaQuery.AccessLevel.AccessPrivate; PicasaQuery.AccessLevel actual; target.Access = expected; actual = target.Access; Assert.AreEqual(expected, actual); }
public void KindParameterTest() { PicasaQuery target = new PicasaQuery(); // TODO: Initialize to an appropriate value string expected = "TestValue"; string actual; target.KindParameter = expected; actual = target.KindParameter; Assert.AreEqual(expected, actual); }
private List<PicasaEntry> GetItems(string uri, PicasaQuery.Kinds kind, string searchText = null) { var service = GetPicasaService(); KindQuery query; switch (kind) { case PicasaQuery.Kinds.album: query = new AlbumQuery(uri); break; case PicasaQuery.Kinds.photo: query = new PhotoQuery(uri); if (!String.IsNullOrWhiteSpace(searchText)) query.Query = searchText; break; default: throw new NotImplementedException("Unknown kind"); } query.NumberToRetrieve = 1000; PicasaFeed feed; try { feed = service.Query(query); } catch { //If a first error. Try recreate service service = GetPicasaService(true); feed = service.Query(query); } var result = new List<PicasaEntry>(); while (feed.Entries!=null) { foreach (PicasaEntry entry in feed.Entries) result.Add(entry); if (String.IsNullOrWhiteSpace(feed.NextChunk)) break; switch (kind) { case PicasaQuery.Kinds.album: query = new AlbumQuery(feed.NextChunk); break; case PicasaQuery.Kinds.photo: query = new PhotoQuery(feed.NextChunk); break; default: throw new NotImplementedException("Unknown kind"); } try { feed = service.Query(query); } catch { //If a first error. Try recreate service service = GetPicasaService(true); feed = service.Query(query); } } return result; }