public void PhotosGetInfoBasicTest() { PhotoInfo info = AuthInstance.PhotosGetInfo("4268023123"); Assert.IsNotNull(info); Assert.AreEqual("4268023123", info.PhotoId); Assert.AreEqual("a4283bac01", info.Secret); Assert.AreEqual("2795", info.Server); Assert.AreEqual("3", info.Farm); Assert.AreEqual(UtilityMethods.UnixTimestampToDate("1263291891"), info.DateUploaded); Assert.AreEqual(false, info.IsFavorite); Assert.AreEqual(LicenseType.AttributionNoncommercialShareAlikeCC, info.License); Assert.AreEqual(0, info.Rotation); Assert.AreEqual("9d3d4bf24a", info.OriginalSecret); Assert.AreEqual("jpg", info.OriginalFormat); Assert.IsTrue(info.ViewCount > 87, "ViewCount should be greater than 87."); Assert.AreEqual(MediaType.Photos, info.Media); Assert.AreEqual("12. Sudoku", info.Title); Assert.AreEqual("It scares me sometimes how much some of my handwriting reminds me of Dad's " + "- in this photo there is one 5 that especially reminds me of his handwriting.", info.Description); //Owner Assert.AreEqual("41888973@N00", info.OwnerUserId); //Dates Assert.AreEqual(new DateTime(2010, 01, 12, 11, 01, 20), info.DateTaken, "DateTaken is not set correctly."); //Editability Assert.IsTrue(info.CanComment, "CanComment should be true when authenticated."); Assert.IsTrue(info.CanAddMeta, "CanAddMeta should be true when authenticated."); //Permissions Assert.AreEqual(PermissionComment.Everybody, info.PermissionComment); Assert.AreEqual(PermissionAddMeta.Everybody, info.PermissionAddMeta); //Visibility // Notes Assert.AreEqual(1, info.Notes.Count, "Notes.Count should be one."); Assert.AreEqual("72157623069944527", info.Notes[0].NoteId); Assert.AreEqual("41888973@N00", info.Notes[0].AuthorId); Assert.AreEqual("Sam Judson", info.Notes[0].AuthorName); Assert.AreEqual(267, info.Notes[0].XPosition); Assert.AreEqual(238, info.Notes[0].YPosition); // Tags Assert.AreEqual(5, info.Tags.Count); Assert.AreEqual("78188-4268023123-586", info.Tags[0].TagId); Assert.AreEqual("green", info.Tags[0].Raw); // URLs Assert.AreEqual(1, info.Urls.Count); Assert.AreEqual("photopage", info.Urls[0].UrlType); Assert.AreEqual("https://www.flickr.com/photos/samjudson/4268023123/", info.Urls[0].Url); }
public void PhotosGetInfoTestLocation() { string photoId = "4268756940"; PhotoInfo info = AuthInstance.PhotosGetInfo(photoId); Assert.IsNotNull(info.Location); }
public void PhotosSetDatesTest() { var photoId = Data.PhotoId; var info = AuthInstance.PhotosGetInfo(photoId); AuthInstance.PhotosSetDates(photoId, info.DatePosted, info.DateTaken, info.DateTakenGranularity); }
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 PhotosLicensesSetLicenseTest() { string photoId = "7176125763"; var photoInfo = AuthInstance.PhotosGetInfo(photoId); // Rainbow Rose var origLicense = photoInfo.License; var newLicense = origLicense == LicenseType.AttributionCC ? LicenseType.AttributionNoDerivativesCC : LicenseType.AttributionCC; AuthInstance.PhotosLicensesSetLicense(photoId, newLicense); var newPhotoInfo = IgnoreInstance.PhotosGetInfo(photoId); Assert.AreEqual(newLicense, newPhotoInfo.License, "License has not changed to correct value."); // Reset license AuthInstance.PhotosLicensesSetLicense(photoId, origLicense); }
public void ShouldUploadSampleBinaryDataAsImage() { var imageBytes = TestData.TestImageBytes; Stream s = new MemoryStream(imageBytes); s.Position = 0; const string title = "Test Title"; const string desc = "Test Description\nSecond Line"; const string tags = "testtag1,testtag2"; var photoId = AuthInstance.UploadPicture(s, "Test.jpg", title, desc, tags, false, false, false, ContentType.Other, SafetyLevel.Safe, HiddenFromSearch.Visible); try { PhotoInfo info = AuthInstance.PhotosGetInfo(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 = AuthInstance.PhotosGetSizes(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); } } finally { AuthInstance.PhotosDelete(photoId); } }