public void GroupsDiscussTopicsGetInfoStickyTest()
        {
            const string topicId = "72157630982967152";

            var topic = AuthInstance.GroupsDiscussTopicsGetInfo(topicId);

            Assert.IsTrue(topic.IsSticky, "This topic should be marked as sticky.");
            Assert.IsFalse(topic.IsLocked, "This topic should not be marked as locked.");

            // topic.CanReply should be true, but for some reason isn't, so we cannot test it.
        }
示例#2
0
        public void PhotosAddTagTest()
        {
            string photoId = "4499284951";
            string tag     = "testx";

            var w = new AsyncSubject <FlickrResult <NoResponse> >();

            AuthInstance.PhotosAddTagsAsync(photoId, tag, r => { w.OnNext(r); w.OnCompleted(); });

            var result = w.Next().First();
        }
        public void GroupsDiscussTopicsGetInfoLockedTest()
        {
            var topicId = "72157630982969782";

            var topic = AuthInstance.GroupsDiscussTopicsGetInfo(topicId);

            Assert.IsTrue(topic.IsLocked, "This topic should be marked as locked.");
            Assert.IsFalse(topic.IsSticky, "This topic should not be marked as sticky.");

            Assert.IsFalse(topic.CanReply, "CanReply should be false as the topic is locked.");
        }
示例#4
0
        public void ActivityUserPhotosBasicTest()
        {
            ActivityItemCollection activity = AuthInstance.ActivityUserPhotos(20, "d");

            Assert.IsNotNull(activity, "ActivityItemCollection should not be null.");

            foreach (ActivityItem item in activity)
            {
                Assert.IsNotNull(item.Id, "Id should not be null.");
            }
        }
示例#5
0
        public void PhotosetsGetListWithExtras()
        {
            var sets = AuthInstance.PhotosetsGetList(TestData.TestUserId, 1, 5, PhotoSearchExtras.All);

            Assert.AreNotEqual(0, sets.Count, "Should have returned at least 1 set for the authenticated user.");

            var firstSet = sets.First();

            Assert.IsNotNull(firstSet.PrimaryPhoto, "Primary Photo should not be null.");
            Assert.IsNotNullOrEmpty(firstSet.PrimaryPhoto.LargeSquareThumbnailUrl, "LargeSquareThumbnailUrl should not be empty.");
        }
示例#6
0
        public void PeopleGetLimitsTest()
        {
            var limits = AuthInstance.PeopleGetLimits();

            Assert.IsNotNull(limits);

            Assert.AreEqual(0, limits.MaximumDisplayPixels);
            Assert.AreEqual(209715200, limits.MaximumPhotoUpload);
            Assert.AreEqual(1073741824, limits.MaximumVideoUpload);
            Assert.AreEqual(180, limits.MaximumVideoDuration);
        }
示例#7
0
        public void PhotosetsGetListWithExtras()
        {
            var testUserPhotoSets = AuthInstance.PhotosetsGetList(TestData.TestUserId, 1, 5, PhotoSearchExtras.All);

            testUserPhotoSets.Count.ShouldBeGreaterThan(0, "Should have returned at least 1 set for the authenticated user.");

            var firstPhotoSet = testUserPhotoSets.First();

            firstPhotoSet.PrimaryPhoto.ShouldNotBeNull("Primary Photo should not be null.");
            firstPhotoSet.PrimaryPhoto.LargeSquareThumbnailUrl.ShouldNotBeNullOrEmpty("LargeSquareThumbnailUrl should not be empty.");
        }
        public void PhotosGetContactsPhotosAsyncTest()
        {
            var w = new AsyncSubject <FlickrResult <PhotoCollection> >();

            AuthInstance.PhotosGetContactsPhotosAsync(50, true, true, true, PhotoSearchExtras.All, r => { w.OnNext(r); w.OnCompleted(); });
            var result = w.Next().First();

            Assert.IsFalse(result.HasError);
            Assert.IsNotNull(result.Result);

            Assert.IsTrue(result.Result.Count > 0, "Should return some photos.");
        }
示例#9
0
        public void PhotosGetContactsPhotosExtrasTest()
        {
            PhotoCollection photos = AuthInstance.PhotosGetContactsPhotos(10, false, false, false, PhotoSearchExtras.All);

            photos.Count.ShouldBeInRange(9, 10, "Should return 9-10 photos");

            foreach (Photo p in photos)
            {
                Assert.IsNotNull(p.OwnerName, "OwnerName should not be null");
                Assert.AreNotEqual(default(DateTime), p.DateTaken, "DateTaken should not be default DateTime");
            }
        }
示例#10
0
        public void GroupsPoolsGetGroupsBasicTest()
        {
            MemberGroupInfoCollection groups = AuthInstance.GroupsPoolsGetGroups();

            Assert.IsNotNull(groups, "MemberGroupInfoCollection should not be null.");
            Assert.AreNotEqual(0, groups.Count, "MemberGroupInfoCollection.Count should not be zero.");
            Assert.IsTrue(groups.Count > 1, "Count should be greater than one.");

            Assert.AreEqual(400, groups.PerPage, "PerPage should be 400.");
            Assert.AreEqual(1, groups.Page, "Page should be 1.");
            Assert.IsTrue(groups.Total > 1, "Total chould be greater than one");
        }
示例#11
0
        public void PhotosGetGetLocationNullTest()
        {
            var photos = AuthInstance.PhotosSearch(new PhotoSearchOptions {
                HasGeo = false, UserId = TestData.TestUserId, Extras = PhotoSearchExtras.Geo
            });

            var photo = photos.First();

            var location = AuthInstance.PhotosGeoGetLocation(photo.PhotoId);

            Assert.IsNull(location, "Location should be null.");
        }
示例#12
0
        public void TagsGetListUserBasicTest()
        {
            TagCollection tags = AuthInstance.TagsGetListUser();

            Assert.IsNotNull(tags, "TagCollection should not be null.");
            Assert.AreNotEqual(0, tags.Count, "TagCollection.Count should not be zero.");

            foreach (Tag tag in tags)
            {
                Assert.IsNotNull(tag.TagName, "Tag.TagName should not be null.");
                Assert.AreEqual(0, tag.Count, "Tag.Count should be zero. Not ser for this method.");
            }
        }
示例#13
0
        public void TagsGetListUserRawBasicTest()
        {
            var tags = AuthInstance.TagsGetListUserRaw();

            Assert.AreNotEqual(0, tags.Count, "There should be one or more raw tags returned");

            foreach (RawTag tag in tags)
            {
                Assert.IsNotNull(tag.CleanTag, "Clean tag should not be null");
                Assert.IsTrue(tag.CleanTag.Length > 0, "Clean tag should not be empty string");
                Assert.IsTrue(tag.RawTags.Count > 0, "Should be one or more raw tag for each clean tag");
            }
        }
示例#14
0
        public void UrlFormatPhotoInfoTest()
        {
            var photoId   = "7176125763"; // Rainbow rose
            var size      = "medium";
            var extension = "jpg";
            var expected  = "https://farm9.staticflickr.com/8162/7176125763_7eac68f450.jpg";

            var photoInfo = AuthInstance.PhotosGetInfo(photoId);

            var actual = UtilityMethods.UrlFormat(photoInfo, size, extension);

            Assert.AreEqual(expected, actual);
        }
        public void ContactsGetListTestBasicTest()
        {
            var contacts = AuthInstance.ContactsGetList();

            Assert.IsNotNull(contacts);

            foreach (var contact in contacts)
            {
                Assert.IsNotNull(contact.UserId, "UserId should not be null.");
                Assert.IsNotNull(contact.UserName, "UserName should not be null.");
                Assert.IsNotNull(contact.BuddyIconUrl, "BuddyIconUrl should not be null.");
            }
        }
示例#16
0
        public void PhotosForLocationReturnsPhotos()
        {
            var photos = Instance.PhotosSearch(new PhotoSearchOptions {
                HasGeo = true, UserId = TestData.TestUserId, Extras = PhotoSearchExtras.Geo, PerPage = 10
            });

            var geoPhoto = photos.First();

            var geoPhotos = AuthInstance.PhotosGeoPhotosForLocation(geoPhoto.Latitude, geoPhoto.Longitude,
                                                                    GeoAccuracy.Street, PhotoSearchExtras.None, 100, 1);

            Assert.IsTrue(geoPhotos.Select(p => p.PhotoId).Contains(geoPhoto.PhotoId));
        }
        public async void ShouldFailToUploadSampleBinaryDataAsImage()
        {
            var    imageBytes = TestData.TestImageBytes;
            Stream s          = new MemoryStream(imageBytes);

            s.Position = 1;

            const string title   = "Test Title";
            const string desc    = "Test Description\nSecond Line";
            const string tags    = "testtag1,testtag2";
            var          photoId = await AuthInstance.UploadPictureAsync(s, "Test.fig", title, desc, tags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible);

            Exception ex = null;

            try
            {
                PhotoInfo info = await AuthInstance.PhotosGetInfoAsync(photoId);

                Assert.AreEqual(title, info.Title);
                Assert.AreEqual(desc, info.Description);
                Assert.AreEqual(2, info.Tags.Count);
                Assert.AreEqual("testtag1", info.Tags[0].Raw);
                Assert.AreEqual("testtag2", info.Tags[1].Raw);

                Assert.IsFalse(info.IsPublic);
                Assert.IsFalse(info.IsFamily);
                Assert.IsFalse(info.IsFriend);

                var sizes = await AuthInstance.PhotosGetSizesAsync(photoId);

                var url = sizes[sizes.Count - 1].Source;
                using (var client = new WebClient())
                {
                    var downloadBytes  = client.DownloadData(url);
                    var downloadBase64 = Convert.ToBase64String(downloadBytes);

                    Assert.AreEqual(TestData.TestImageBase64, downloadBase64);
                }
            }
            catch (Exception exception)
            {
                ex = exception;
            }

            await AuthInstance.PhotosDeleteAsync(photoId);

            if (ex != null)
            {
                throw ex;
            }
        }
示例#18
0
        public void PeopleGetInfoGenderTest()
        {
            Person p = AuthInstance.PeopleGetInfo("10973297@N00");

            Assert.IsNotNull(p, "Person object should be returned");
            Assert.AreEqual("F", p.Gender, "Gender of M should be returned");

            Assert.IsNotNull(p.IsReverseContact, "IsReverseContact should not be null.");
            Assert.IsNotNull(p.IsContact, "IsContact should not be null.");
            Assert.IsNotNull(p.IsIgnored, "IsIgnored should not be null.");
            Assert.IsNotNull(p.IsFriend, "IsFriend should not be null.");

            Assert.IsNotNull(p.PhotosSummary, "PhotosSummary should not be null.");
        }
        public void PhotosGetNotInSetPagesTest()
        {
            var photos = AuthInstance.PhotosGetNotInSet(1, 11);

            Assert.IsNotNull(photos);
            Assert.AreEqual(11, photos.Count);

            // Overloads
            AuthInstance.PhotosGetNotInSet();
            AuthInstance.PhotosGetNotInSet(new PartialSearchOptions()
            {
                Page = 1, PerPage = 10, PrivacyFilter = PrivacyFilter.CompletelyPrivate
            });
        }
        public void ContactsGetListFilteredTest()
        {
            var contacts = AuthInstance.ContactsGetList("friends");

            Assert.IsNotNull(contacts);

            foreach (var contact in contacts)
            {
                Assert.IsNotNull(contact.UserId, "UserId should not be null.");
                Assert.IsNotNull(contact.UserName, "UserName should not be null.");
                Assert.IsNotNull(contact.BuddyIconUrl, "BuddyIconUrl should not be null.");
                Assert.IsNotNull(contact.IsFriend, "IsFriend should not be null.");
                Assert.IsTrue(contact.IsFriend.Value);
            }
        }
示例#21
0
        public void StatGetCsvFilesTest()
        {
            CsvFileCollection col = AuthInstance.StatsGetCsvFiles();

            Assert.IsNotNull(col, "CsvFileCollection should not be null.");

            Assert.IsTrue(col.Count > 1, "Should be more than one CsvFile returned.");

            foreach (var file in col)
            {
                Assert.IsNotNull(file.Href, "Href should not be null.");
                Assert.IsNotNull(file.Type, "Type should not be null.");
                Assert.AreNotEqual(DateTime.MinValue, file.Date);
            }
        }
示例#22
0
 public void AddAuthInst(AuthInstance Auth)
 {
     if (GetAuthInsts().FirstOrDefault(c => c.Name == Auth.Name) != null)
     {
         this.Log(MessageStatus.Error, LogStrings.Error.Auth.InstExists + Auth.Name);
         return;
     }
     (Configs.Property("AuthList").Value as JArray).Add(new JObject(
                                                            new JProperty("Name", Auth.Name),
                                                            new JProperty("EmailOrAccKey", Auth.EmailOrAccKey),
                                                            new JProperty("PassOrId", Auth.PassOrId),
                                                            new JProperty("IsNormal", Auth.IsNormal)
                                                            ));
     this.Log(MessageStatus.Info, LogStrings.Info.Auth.InstAdded + Auth.Name);
 }
示例#23
0
        public void PhotosGetGetLocationTest()
        {
            var photos = AuthInstance.PhotosSearch(new PhotoSearchOptions {
                HasGeo = true, UserId = TestData.TestUserId, Extras = PhotoSearchExtras.Geo
            });

            var photo = photos.First();

            Console.WriteLine(photo.PhotoId);

            var location = AuthInstance.PhotosGeoGetLocation(photo.PhotoId);

            Assert.AreEqual(photo.Longitude, location.Longitude, "Longitudes should match exactly.");
            Assert.AreEqual(photo.Latitude, location.Latitude, "Latitudes should match exactly.");
        }
        public void PhotosRecentlyUpdatedTests()
        {
            var sixMonthsAgo = DateTime.Today.AddMonths(-6);
            var photos       = AuthInstance.PhotosRecentlyUpdated(sixMonthsAgo, PhotoSearchExtras.All, 1, 20);

            Assert.IsNotNull(photos);
            Assert.AreEqual(20, photos.PerPage);
            Assert.AreNotEqual(0, photos.Count);

            // Overloads

            photos = AuthInstance.PhotosRecentlyUpdated(sixMonthsAgo);
            photos = AuthInstance.PhotosRecentlyUpdated(sixMonthsAgo, PhotoSearchExtras.DateTaken);
            photos = AuthInstance.PhotosRecentlyUpdated(sixMonthsAgo, 1, 10);
        }
        public void BlogsGetListTest()
        {
            BlogCollection blogs = AuthInstance.BlogsGetList();

            Assert.IsNotNull(blogs, "Blogs should not be null.");

            foreach (Blog blog in blogs)
            {
                Assert.IsNotNull(blog.BlogId, "BlogId should not be null.");
                Assert.IsNotNull(blog.NeedsPassword, "NeedsPassword should not be null.");
                Assert.IsNotNull(blog.BlogName, "BlogName should not be null.");
                Assert.IsNotNull(blog.BlogUrl, "BlogUrl should not be null.");
                Assert.IsNotNull(blog.Service, "Service should not be null.");
            }
        }
示例#26
0
        public void PhotosSearchCameraIphone()
        {
            var o = new PhotoSearchOptions
            {
                Camera        = "iPhone 5S",
                MinUploadDate = DateTime.Now.AddDays(-7),
                MaxUploadDate = DateTime.Now,
                Extras        = PhotoSearchExtras.Tags
            };

            var ps = AuthInstance.PhotosSearch(o);

            Assert.IsNotNull(ps);
            Assert.AreNotEqual(0, ps.Count);
        }
        public void CollectionGetInfoBasicTest()
        {
            string id = "78188-72157618817175751";

            CollectionInfo info = AuthInstance.CollectionsGetInfo(id);

            Assert.AreEqual(id, info.CollectionId, "CollectionId should be correct.");
            Assert.AreEqual(1, info.ChildCount, "ChildCount should be 1.");
            Assert.AreEqual("Global Collection", info.Title, "Title should be 'Global Collection'.");
            Assert.AreEqual("My global collection.", info.Description, "Description should be set correctly.");
            Assert.AreEqual("3629", info.Server, "Server should be 3629.");

            Assert.AreEqual(12, info.IconPhotos.Count, "IconPhotos.Length should be 12.");

            Assert.AreEqual("Tires", info.IconPhotos[0].Title, "The first IconPhoto Title should be 'Tires'.");
        }
        public void ContactsGetListPagedTest()
        {
            var contacts = AuthInstance.ContactsGetList(2, 20);

            Assert.IsNotNull(contacts);
            Assert.AreEqual(2, contacts.Page);
            Assert.AreEqual(20, contacts.PerPage);
            Assert.AreEqual(20, contacts.Count);

            foreach (var contact in contacts)
            {
                Assert.IsNotNull(contact.UserId, "UserId should not be null.");
                Assert.IsNotNull(contact.UserName, "UserName should not be null.");
                Assert.IsNotNull(contact.BuddyIconUrl, "BuddyIconUrl should not be null.");
            }
        }
示例#29
0
        public void PhotosGetWithGeoDataBasicTest()
        {
            PhotoCollection photos = AuthInstance.PhotosGetWithGeoData();

            Assert.IsNotNull(photos);
            Assert.AreNotEqual(0, photos.Count);
            Assert.AreNotEqual(0, photos.Total);
            Assert.AreEqual(1, photos.Page);
            Assert.AreNotEqual(0, photos.PerPage);
            Assert.AreNotEqual(0, photos.Pages);

            foreach (var p in photos)
            {
                Assert.IsNotNull(p.PhotoId);
            }
        }
        public void PhotosSetMetaLargeDescription()
        {
            string description;

            using (WebClient wc = new WebClient())
            {
                description = wc.DownloadString("http://en.wikipedia.org/wiki/Scots_Pine");
                // Limit to size of a url to 65519 characters, so chop the description down to a large but not too large size.
                description = description.Substring(0, 6551);
            }

            string title   = "Blacksway Cat";
            string photoId = "5279984467";

            AuthInstance.PhotosSetMeta(photoId, title, description);
        }