Exemple #1
0
        public void PlacesPlacesForBoundingBoxUsaTest()
        {
            Flickr f = TestData.GetInstance();

            var places = f.PlacesPlacesForBoundingBox(PlaceType.County, null, null, BoundaryBox.UKNewcastle);

            Assert.IsNotNull(places);
            Assert.AreNotEqual(0, places.Count);

            foreach (var place in places)
            {
                Assert.IsNotNull(place.PlaceId);
                Assert.AreEqual <PlaceType>(PlaceType.County, place.PlaceType);
            }
        }
Exemple #2
0
        public void PlacesGetInfoByUrlBasicTest()
        {
            var       f       = TestData.GetInstance();
            var       placeId = "X9sTR3BSUrqorQ";
            PlaceInfo p1      = f.PlacesGetInfo(placeId, null);
            PlaceInfo p2      = f.PlacesGetInfoByUrl(p1.PlaceUrl);

            Assert.IsNotNull(p2);
            Assert.AreEqual(p1.PlaceId, p2.PlaceId);
            Assert.AreEqual(p1.WoeId, p2.WoeId);
            Assert.AreEqual(p1.PlaceType, p2.PlaceType);
            Assert.AreEqual(p1.Description, p2.Description);

            Assert.IsNotNull(p2.PlaceFlickrUrl);
        }
Exemple #3
0
        public void PeopleGetInfoBasicTestUnauth()
        {
            Flickr f = TestData.GetInstance();
            Person p = f.PeopleGetInfo(TestData.TestUserId);

            Assert.AreEqual("Sam Judson", p.UserName);
            Assert.AreEqual("Sam Judson", p.RealName);
            Assert.AreEqual("samjudson", p.PathAlias);
            Assert.IsTrue(p.IsPro, "IsPro should be true.");
            Assert.AreEqual("Newcastle, UK", p.Location);
            Assert.AreEqual("+00:00", p.TimeZoneOffset);
            Assert.AreEqual("GMT: Dublin, Edinburgh, Lisbon, London", p.TimeZoneLabel);
            Assert.IsNotNull(p.Description, "Description should not be null.");
            Assert.IsTrue(p.Description.Length > 0, "Description should not be empty");
        }
Exemple #4
0
        public void PlacesGetTopPlacesListTest()
        {
            var f      = TestData.GetInstance();
            var places = f.PlacesGetTopPlacesList(PlaceType.Continent);

            Assert.IsNotNull(places);
            Assert.AreNotEqual(0, places.Count);

            foreach (var p in places)
            {
                Assert.AreEqual <PlaceType>(PlaceType.Continent, p.PlaceType);
                Assert.IsNotNull(p.PlaceId);
                Assert.IsNotNull(p.WoeId);
            }
        }
Exemple #5
0
        public void PlacesGetTagsForPlace()
        {
            var placeId = "X9sTR3BSUrqorQ";
            var f       = TestData.GetInstance();
            var col     = f.PlacesTagsForPlace(placeId, null);

            Assert.IsNotNull(col, "TagCollection should not be null.");
            Assert.AreEqual(100, col.Count, "Count should be one hundred.");

            foreach (var t in col)
            {
                Assert.AreNotEqual(0, t.Count, "Count should be greater than zero.");
                Assert.IsNotNull(t.TagName, "TagName should not be null.");
            }
        }
        public void GroupsPoolGetPhotosDateAddedTest()
        {
            Flickr f = TestData.GetInstance();

            PhotoCollection photos = f.GroupsPoolsGetPhotos(TestData.GroupId);

            Assert.IsNotNull(photos, "Photos should not be null");
            Assert.IsTrue(photos.Count > 0, "Should be more than 0 photos returned");

            foreach (Photo p in photos)
            {
                Assert.AreNotEqual(default(DateTime), p.DateAddedToGroup, "DateAddedToGroup should not be default value");
                Assert.IsTrue(p.DateAddedToGroup < DateTime.Now, "DateAddedToGroup should be in the past");
            }
        }
        public void PhotosSearchInterestingnessBasicTest()
        {
            Flickr             f = TestData.GetInstance();
            PhotoSearchOptions o = new PhotoSearchOptions();

            o.SortOrder = PhotoSearchSortOrder.InterestingnessDescending;
            o.Tags      = "colorful";
            o.PerPage   = 500;

            PhotoCollection ps = f.PhotosSearch(o);

            Assert.IsNotNull(ps, "Photos should not be null");
            Assert.AreEqual(500, ps.PerPage, "PhotosPerPage should be 500");
            Assert.AreEqual(500, ps.Count, "Count should be 500 as well");
        }
Exemple #8
0
        public void PhotosGetInfoCanBlogTest()
        {
            PhotoSearchOptions o = new PhotoSearchOptions();

            o.UserId  = TestData.TestUserId;
            o.PerPage = 5;

            Flickr f = TestData.GetInstance();

            PhotoCollection photos = f.PhotosSearch(o);
            PhotoInfo       info   = f.PhotosGetInfo(photos[0].PhotoId);

            Assert.AreEqual(false, info.CanBlog);
            Assert.AreEqual(true, info.CanDownload);
        }
        public void MachinetagsGetPredicatesBasicTest()
        {
            Flickr f = TestData.GetInstance();

            var col = f.MachineTagsGetPredicates();

            Assert.IsTrue(col.Count > 10, "Should be greater than 10 namespaces.");

            foreach (var n in col)
            {
                Assert.IsNotNull(n.PredicateName, "PredicateName should not be null.");
                Assert.AreNotEqual(0, n.Namespaces, "Namespaces should not be zero.");
                Assert.AreNotEqual(0, n.Usage, "Usage should not be zero.");
            }
        }
Exemple #10
0
        public void TagsGetListPhotoBasicTest()
        {
            var tags = TestData.GetInstance().TagsGetListPhoto(TestData.PhotoId);

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

            foreach (var tag in tags)
            {
                Assert.IsNotNull(tag.TagId, "TagId should not be null.");
                Assert.IsNotNull(tag.TagText, "TagText should not be null.");
                Assert.IsNotNull(tag.Raw, "Raw should not be null.");
                Assert.IsNotNull(tag.IsMachineTag, "IsMachineTag should not be null.");
            }
        }
        public void PhotosSearchAsyncBasicTest()
        {
            Flickr f = TestData.GetInstance();

            PhotoSearchOptions o = new PhotoSearchOptions();

            o.Tags = "microsoft";

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

            f.PhotosSearchAsync(o, r => { w.OnNext(r); w.OnCompleted(); });
            var result = w.Next().First();

            Assert.IsTrue(result.Result.Total > 0);
        }
Exemple #12
0
        public void PeopleGetInfoBasicTestUnauth()
        {
            Flickr f = TestData.GetInstance();
            Person p = f.PeopleGetInfo("10973297@N00");

            Assert.AreEqual("Miss Aniela", p.UserName);
            Assert.IsNull(p.RealName, "RealName should be null.");
            Assert.AreEqual("ndybisz", p.PathAlias);
            Assert.IsTrue(p.IsPro, "IsPro should be true.");
            Assert.AreEqual("London, UK", p.Location);
            Assert.AreEqual("+00:00", p.TimeZoneOffset);
            Assert.AreEqual("GMT: Dublin, Edinburgh, Lisbon, London", p.TimeZoneLabel);
            Assert.IsNotNull(p.Description, "Description should not be null.");
            Assert.IsTrue(p.Description.Length > 0, "Description should not be empty");
        }
Exemple #13
0
        public void PhotosetsGetListBasicTest()
        {
            PhotosetCollection photosets = TestData.GetInstance().PhotosetsGetList(TestData.TestUserId);

            Assert.IsTrue(photosets.Count > 0, "Should be at least one photoset");
            Assert.IsTrue(photosets.Count > 100, "Should be greater than 100 photosets. (" + photosets.Count + " returned)");

            foreach (Photoset set in photosets)
            {
                Assert.IsNotNull(set.OwnerId, "OwnerId should not be null");
                Assert.IsTrue(set.NumberOfPhotos > 0, "NumberOfPhotos should be greater than zero");
                Assert.IsNotNull(set.Title, "Title should not be null");
                Assert.IsNotNull(set.Description, "Description should not be null");
                Assert.AreEqual(TestData.TestUserId, set.OwnerId);
            }
        }
Exemple #14
0
        public void PhotosSearchRussianTagsReturned()
        {
            Flickr f = TestData.GetInstance();

            var o = new PhotoSearchOptions();

            o.UserId = "31828860@N08";
            o.Extras = PhotoSearchExtras.Tags;

            var photos = f.PhotosSearch(o);

            foreach (var photo in photos)
            {
                Console.WriteLine(photo.Title + " = " + String.Join(",", photo.Tags));
            }
        }
Exemple #15
0
        public void PhotosSearchUrlLimitTest()
        {
            PhotoSearchOptions o = new PhotoSearchOptions();

            o.Extras  = PhotoSearchExtras.All;
            o.TagMode = TagMode.AnyTag;
            StringBuilder sb = new StringBuilder();

            for (int i = 1; i < 200; i++)
            {
                sb.Append("tagnumber" + i);
            }
            o.Tags = sb.ToString();

            PhotoCollection photos = TestData.GetInstance().PhotosSearch(o);
        }
Exemple #16
0
        public void PeopleGetPublicPhotosBasicTest()
        {
            var f      = TestData.GetInstance();
            var photos = f.PeopleGetPublicPhotos(TestData.TestUserId, 1, 100, SafetyLevel.None, PhotoSearchExtras.OriginalDimensions);

            Assert.IsNotNull(photos);
            Assert.AreNotEqual(0, photos.Count);

            foreach (var photo in photos)
            {
                Assert.IsNotNull(photo.PhotoId, "PhotoId should not be null.");
                Assert.AreEqual(TestData.TestUserId, photo.UserId);
                Assert.AreNotEqual(0, photo.OriginalWidth, "OriginalWidth should not be zero.");
                Assert.AreNotEqual(0, photo.OriginalHeight, "OriginalHeight should not be zero.");
            }
        }
Exemple #17
0
        public void MachinetagsGetPairsBasicTest()
        {
            var pairs = TestData.GetInstance().MachineTagsGetPairs(null, null, 0, 0);

            Assert.IsNotNull(pairs);

            Assert.AreNotEqual(0, pairs.Count, "Count should not be zero.");

            foreach (Pair p in pairs)
            {
                Assert.IsNotNull(p.NamespaceName, "NamespaceName should not be null.");
                Assert.IsNotNull(p.PairName, "PairName should not be null.");
                Assert.IsNotNull(p.PredicateName, "PredicateName should not be null.");
                Assert.AreNotEqual(0, p.Usage, "Usage should be greater than zero.");
            }
        }
Exemple #18
0
        public void PhotosSearchDoesLargeExist()
        {
            PhotoSearchOptions o = new PhotoSearchOptions();

            o.Extras  = PhotoSearchExtras.AllUrls;
            o.PerPage = 50;
            o.Tags    = "test";

            PhotoCollection photos = TestData.GetInstance().PhotosSearch(o);

            foreach (Photo p in photos)
            {
                Assert.IsTrue(p.DoesLargeExist == true || p.DoesLargeExist == false);
                Assert.IsTrue(p.DoesMediumExist == true || p.DoesMediumExist == false);
            }
        }
Exemple #19
0
        public void MachinetagsGetPairsDcAuthorTest()
        {
            var pairs = TestData.GetInstance().MachineTagsGetPairs("dc", "author", 0, 0);

            Assert.IsNotNull(pairs);

            Assert.AreEqual(1, pairs.Count, "Count should be 1.");

            foreach (Pair p in pairs)
            {
                Assert.AreEqual("author", p.PredicateName, "PredicateName should be 'author'.");
                Assert.AreEqual("dc", p.NamespaceName, "NamespaceName should be 'dc'.");
                Assert.AreEqual("dc:author", p.PairName, "PairName should be 'dc:author'.");
                Assert.AreNotEqual(0, p.Usage, "Usage should be greater than zero.");
            }
        }
Exemple #20
0
        public void PhotosGetSizes10Test()
        {
            var o = new PhotoSearchOptions {
                Tags = "microsoft", PerPage = 10
            };

            var photos = TestData.GetInstance().PhotosSearch(o);

            foreach (var p in photos)
            {
                var sizes = TestData.GetInstance().PhotosGetSizes(p.PhotoId);
                foreach (var s in sizes)
                {
                }
            }
        }
        public void PhotosGetContactsPublicPhotosExceptExtrasTest()
        {
            Flickr f = TestData.GetInstance();

            string userId = TestData.TestUserId;

            int  count       = 4;
            bool justFriends = true;
            bool singlePhoto = true;
            bool includeSelf = false;

            var photos = f.PhotosGetContactsPublicPhotos(userId, count, justFriends, singlePhoto, includeSelf);

            Assert.IsNotNull(photos);
            Assert.AreNotEqual(0, photos.Count, "Should have returned more than 0 photos");
        }
Exemple #22
0
        public void GalleriesGetListForPhotoTest()
        {
            string photoId = "2891347068";

            var galleries = TestData.GetInstance().GalleriesGetListForPhoto(photoId);

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

            foreach (var g in galleries)
            {
                Assert.IsNotNull(g);
                Assert.IsNotNull(g.Title, "Title should not be null.");
                Assert.IsNotNull(g.GalleryId, "GalleryId should not be null.");
                Assert.IsNotNull(g.GalleryUrl, "GalleryUrl should not be null.");
            }
        }
Exemple #23
0
        public void GalleriesGetListUserIdTest()
        {
            Flickr f = TestData.GetInstance();

            GalleryCollection galleries = f.GalleriesGetList(TestData.TestUserId);

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

            foreach (var g in galleries)
            {
                Assert.IsNotNull(g);
                Assert.IsNotNull(g.Title, "Title should not be null.");
                Assert.IsNotNull(g.GalleryId, "GalleryId should not be null.");
                Assert.IsNotNull(g.GalleryUrl, "GalleryUrl should not be null.");
            }
        }
Exemple #24
0
        public void MachinetagsGetPairsPredicateTest()
        {
            var pairs = TestData.GetInstance().MachineTagsGetPairs(null, "author", 0, 0);

            Assert.IsNotNull(pairs);

            Assert.AreNotEqual(0, pairs.Count, "Count should not be zero.");

            foreach (Pair p in pairs)
            {
                Assert.AreEqual("author", p.PredicateName, "PredicateName should be 'dc'.");
                Assert.IsNotNull(p.PairName, "PairName should not be null.");
                Assert.IsTrue(p.PairName.EndsWith(":author"), "PairName should end with ':author'.");
                Assert.IsNotNull(p.NamespaceName, "NamespaceName should not be null.");
                Assert.AreNotEqual(0, p.Usage, "Usage should be greater than zero.");
            }
        }
Exemple #25
0
        public void MachinetagsGetPairsNamespaceTest()
        {
            var pairs = TestData.GetInstance().MachineTagsGetPairs("dc", null, 0, 0);

            Assert.IsNotNull(pairs);

            Assert.AreNotEqual(0, pairs.Count, "Count should not be zero.");

            foreach (Pair p in pairs)
            {
                Assert.AreEqual("dc", p.NamespaceName, "NamespaceName should be 'dc'.");
                Assert.IsNotNull(p.PairName, "PairName should not be null.");
                Assert.IsTrue(p.PairName.StartsWith("dc:"), "PairName should start with 'dc:'.");
                Assert.IsNotNull(p.PredicateName, "PredicateName should not be null.");
                Assert.AreNotEqual(0, p.Usage, "Usage should be greater than zero.");
            }
        }
Exemple #26
0
        public void PhotosPeopleGetListTest()
        {
            var photoId = "3547137580";

            var people = TestData.GetInstance().PhotosPeopleGetList(photoId);

            Assert.AreNotEqual(0, people.Total, "Total should not be zero.");
            Assert.AreNotEqual(0, people.Count, "Count should not be zero.");
            Assert.AreEqual(people.Count, people.Total, "Count should equal Total.");

            foreach (var person in people)
            {
                Assert.IsNotNull(person.UserId, "UserId should not be null.");
                Assert.IsNotNull(person.PhotostreamUrl, "PhotostreamUrl should not be null.");
                Assert.IsNotNull(person.BuddyIconUrl, "BuddyIconUrl should not be null.");
            }
        }
Exemple #27
0
        public void PhotosUploadCheckTicketsTest()
        {
            Flickr f = TestData.GetInstance();

            string[] tickets = new string[3];
            tickets[0] = "invalid1";
            tickets[1] = "invalid2";
            tickets[2] = "invalid3";

            var t = f.PhotosUploadCheckTickets(tickets);

            Assert.AreEqual(3, t.Count);

            Assert.AreEqual("invalid1", t[0].TicketId);
            Assert.IsNull(t[0].PhotoId);
            Assert.IsTrue(t[0].InvalidTicketId);
        }
Exemple #28
0
        public void PhotosGetSizesBasicTest()
        {
            var sizes = TestData.GetInstance().PhotosGetSizes("4114887196");

            Assert.IsNotNull(sizes);
            Assert.AreNotEqual(0, sizes.Count);

            foreach (Size s in sizes)
            {
                Assert.IsNotNull(s.Label, "Label should not be null.");
                Assert.IsNotNull(s.Source, "Source should not be null.");
                Assert.IsNotNull(s.Url, "Url should not be null.");
                Assert.AreNotEqual(0, s.Height, "Height should not be zero.");
                Assert.AreNotEqual(0, s.Width, "Width should not be zero.");
                Assert.AreNotEqual(MediaType.None, s.MediaType, "MediaType should be set.");
            }
        }
Exemple #29
0
        public void GroupsPoolGetPhotosFullParamTest()
        {
            Flickr f = TestData.GetInstance();

            PhotoCollection photos = f.GroupsPoolsGetPhotos(TestData.GroupId, null, TestData.TestUserId, PhotoSearchExtras.All, 1, 20);

            Assert.IsNotNull(photos, "Photos should not be null");
            Assert.IsTrue(photos.Count > 0, "Should be more than 0 photos returned");
            Assert.AreEqual(20, photos.PerPage);
            Assert.AreEqual(1, photos.Page);

            foreach (Photo p in photos)
            {
                Assert.AreNotEqual(default(DateTime), p.DateAddedToGroup, "DateAddedToGroup should not be default value");
                Assert.IsTrue(p.DateAddedToGroup < DateTime.Now, "DateAddedToGroup should be in the past");
            }
        }
        public void PhotosGetContactsPublicPhotosAllParamsTest()
        {
            Flickr f = TestData.GetInstance();

            string userId = TestData.TestUserId;

            int  count               = 4;     // TODO: Initialize to an appropriate value
            bool justFriends         = true;  // TODO: Initialize to an appropriate value
            bool singlePhoto         = true;  // TODO: Initialize to an appropriate value
            bool includeSelf         = false; // TODO: Initialize to an appropriate value
            PhotoSearchExtras extras = PhotoSearchExtras.None;

            var photos = f.PhotosGetContactsPublicPhotos(userId, count, justFriends, singlePhoto, includeSelf, extras);

            Assert.IsNotNull(photos);
            Assert.AreNotEqual(0, photos.Count, "Should have returned more than 0 photos");
        }