示例#1
0
        public void AddToSetFailTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            setOAuthForTst(target);

            string photoset_id = "72157631845760499"; // TestAlbum
            string filename = "c:\\nonexistentfile";
            string actual;
            actual = target.AddToSet(photoset_id, filename);
            Assert.IsTrue( actual.Length == 0 );
        }
示例#2
0
        public void AddSetTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            setOAuthForTst(target);

            string parent_collection_id = null;
            string set_name = "DeleteMeEmptySet";
            string representative_filename = "c:\\temp\\koala.jpg";
            string actual;
            actual = target.AddSet(parent_collection_id, set_name, representative_filename);
            Assert.IsTrue(actual.Length > 0);

            target.GetFlickrHandle_forTesting().PhotosetsDelete(actual);
        }
示例#3
0
        public void runner()
        {
            IFlickrConnect fc = new FlickrConnect();
            IDriveEnumerator de = new DriveEnumerator();
            IFolderEnumerator fe = new FolderEnumerator();

            FlickrDriveSynchronizer syncer = new FlickrDriveSynchronizer(de, fe, fc);
            try
            {
                syncer.Sync(m_root_folder);
            }
            catch (Exception e)
            {
                DisplayException(e);
            }

            if (Application.Current.Dispatcher.CheckAccess())
                EnableStartButton();
            else
            {
                Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                    new Action(() => { EnableStartButton(); }));
            }
        }
示例#4
0
        public void AddToSetTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            setOAuthForTst(target);

            string photoset_id = "72157631845760499"; // TestAlbum
            string filename = "c:\\temp\\Koala.jpg";
            string actual;
            actual = target.AddToSet(photoset_id, filename);
            Assert.IsTrue( actual.Length > 0 );
            target.DeletePhoto(actual);
        }
示例#5
0
 private void setOAuthForTst(FlickrConnect fconnect)
 {
     System.IO.StreamReader cred_file = new System.IO.StreamReader("c:\\temp\\testcredentials.txt");
     String oauth_token = cred_file.ReadLine();
     String oauth_secret = cred_file.ReadLine();
     cred_file.Close();
     fconnect.setOAuth(oauth_token, oauth_secret);
 }
示例#6
0
        public void UploadPhotoTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            setOAuthForTst(target);

            string filename = "c:\\temp\\koala.jpg";
            string actual;
            actual = target.UploadPhoto(filename);
            Assert.IsNotNull(actual);
            target.GetFlickrHandle_forTesting().PhotosDelete(actual);
        }
示例#7
0
        public void PhotoSetExistsTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);

            setOAuthForTst(target);

            //target.cached_collection_collection = new FakeCollectionCollection().fake_collection;

            string photoset_name = "TestAlbum";
            bool actual;
            actual = target.PhotoSetExists(photoset_name);
            Assert.IsNotNull(actual);
        }
示例#8
0
        public void GetPhotosInSetTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            setOAuthForTst(target);

            string photoset_id = "72157631845760499";
            Photo[] actual;
            actual = target.GetPhotosInSet(photoset_id);

            List<Photo> actual_list = new List<Photo>(actual);

            Assert.IsTrue( actual_list.Count == 1);
            Assert.IsTrue(actual_list[0].Title == "IMG_0059");
        }
示例#9
0
        public void GetPhotoSetByNameTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);
            string photoset_name = "TestAlbum";
            string actual;

            setOAuthForTst(target);

            /*
            CollectionCollection fcol = new FakeCollectionCollection().fake_collection;
            Collection col = fcol[1];
             */
            actual = target.GetPhotoSetByName(photoset_name);
            Assert.IsNotNull(actual);
            //Assert.AreEqual(expected, actual);
        }
示例#10
0
        public void GetCollectionTest()
        {
            FlickrConnect target = new FlickrConnect(null, null);

            setOAuthForTst(target);

            FlickrNet.CollectionCollection result = target.GetCollections();

            bool found_result = false;
            for (int i = 0; i < result.Count; i++)
                if (result[i].Title == "2009")
                    found_result = true;

            Assert.IsTrue( found_result );
        }