public void GalleriesEditPhotosTest() { string galleryId = "78188-72157622589312064"; var gallery = AuthInstance.GalleriesGetInfo(galleryId); Console.WriteLine("GalleryUrl = " + gallery.GalleryUrl); var photos = AuthInstance.GalleriesGetPhotos(galleryId); List <string> photoIds = new List <string>(); foreach (var photo in photos) { photoIds.Add(photo.PhotoId); } AuthInstance.GalleriesEditPhotos(galleryId, gallery.PrimaryPhotoId, photoIds); var photos2 = AuthInstance.GalleriesGetPhotos(gallery.GalleryId); Assert.AreEqual(photos.Count, photos2.Count); for (int i = 0; i < photos.Count; i++) { Assert.AreEqual(photos[i].PhotoId, photos2[i].PhotoId); } }
public void GalleriesEditPhotoTest() { string photoId = "486875512"; string galleryId = "78188-72157622589312064"; string comment = "You don't get much better than this for the best Entrance to Hell.\n\n" + DateTime.Now.ToString(); AuthInstance.GalleriesEditPhoto(galleryId, photoId, comment); var photos = AuthInstance.GalleriesGetPhotos(galleryId); bool found = false; foreach (var photo in photos) { if (photo.PhotoId == photoId) { Assert.AreEqual(comment, photo.Comment, "Comment should have been updated."); found = true; break; } } Assert.IsTrue(found, "Should have found the photo in the gallery."); }
public void GalleriesEditComplexTest() { string primaryPhotoId = "486875512"; string comment = "You don't get much better than this for the best Entrance to Hell.\n\n" + DateTime.Now.ToString(); string galleryId = "78188-72157622589312064"; // Get photos var photos = AuthInstance.GalleriesGetPhotos(galleryId); List <string> photoIds = new List <string>(); foreach (var p in photos) { photoIds.Add(p.PhotoId); } // Remove the last one. GalleryPhoto photo = photos[photos.Count - 1]; photoIds.Remove(photo.PhotoId); // Update the gallery AuthInstance.GalleriesEditPhotos(galleryId, primaryPhotoId, photoIds); // Check removed photo no longer returned. var photos2 = AuthInstance.GalleriesGetPhotos(galleryId); Assert.AreEqual(photos.Count - 1, photos2.Count, "Should be one less photo."); bool found = false; foreach (var p in photos2) { if (p.PhotoId == photo.PhotoId) { found = true; break; } } Assert.IsFalse(false, "Should not have found the photo in the gallery."); // Add photo back in AuthInstance.GalleriesAddPhoto(galleryId, photo.PhotoId, photo.Comment); var photos3 = AuthInstance.GalleriesGetPhotos(galleryId); Assert.AreEqual(photos.Count, photos3.Count, "Count should match now photo added back in."); found = false; foreach (var p in photos3) { if (p.PhotoId == photo.PhotoId) { Assert.AreEqual(photo.Comment, p.Comment, "Comment should have been updated."); found = true; break; } } Assert.IsTrue(found, "Should have found the photo in the gallery."); }