コード例 #1
0
        public void UnfollowAndFollowAgain()
        {
            try
            {
                // Get follows
                var prevFollows = RelationshipsManager.GetFollows();
                Assert.IsNotNull(prevFollows);

                // unfollow the first user
                RelationshipsManager.DestroyRelationship(prevFollows.First().Id);

                // Check if the user is not a follow
                var currentFollows = RelationshipsManager.GetFollows();
                Assert.IsNotNull(currentFollows);
                Assert.AreEqual(prevFollows.Count - 1, currentFollows.Count);

                // Follow again
                RelationshipsManager.CreateRelationship(prevFollows.First().Id);

                // Update current follows and check again
                currentFollows = RelationshipsManager.GetFollows();
                Assert.IsNotNull(currentFollows);
                Assert.AreEqual(prevFollows.Count, currentFollows.Count);
            }
            catch (Exceptions.InstagramAPICallException)
            {
                Assert.Fail("Instagram Api error.");
            }
        }
コード例 #2
0
        public void GetRecentMediaWithParameters()
        {
            try
            {
                // Get one user who follows you
                var followingUser = RelationshipsManager.GetFollowedBy().First();
                Assert.IsNotNull(followingUser);

                // Get his media using parameters
                var mediaFromFollower = UserManager.GetRecentMedia(new Parameters.UsersQueryParameters()
                {
                    Count = 5,
                    Id    = followingUser.Id
                });

                // Check the media
                Assert.IsNotNull(mediaFromFollower);
                Assert.AreEqual(5, mediaFromFollower.Count);
                Assert.IsTrue(mediaFromFollower.First().CreatedBy.Equals(followingUser));
            }
            catch (Exceptions.InstagramAPICallException)
            {
                Assert.Fail("instagram api call exception.");
            }
        }
コード例 #3
0
        public void TryToApproveAnAlreadyFollowedUser()
        {
            // Get follows
            var follows = RelationshipsManager.GetFollows();

            Assert.IsNotNull(follows);

            // unfollow the first user
            RelationshipsManager.ApproveRelationship(follows.First().Id);
        }
コード例 #4
0
        public void GetFollowsAndRelationshipInfo()
        {
            try
            {
                // Get follows
                var follows = RelationshipsManager.GetFollows();
                Assert.IsNotNull(follows);

                // Get relationship info with the first user (for example)
                var relInfo = RelationshipsManager.GetRelationshipinfo(follows.First().Id);

                // Check if relationship info is correct
                Assert.IsNotNull(relInfo);
                Assert.AreEqual(OutgoingRelationshipStatus.Follows, relInfo.OutgoingRelation);
            }
            catch (Exceptions.InstagramAPICallException)
            {
                Assert.Fail("Instagram Api error.");
            }
        }
コード例 #5
0
        public void GetFollowersAndRelationshipInfo()
        {
            try
            {
                // Get followers
                var followers = RelationshipsManager.GetFollowedBy();
                Assert.IsNotNull(followers);

                // Get relationship info with the first user (for example)
                var relInfo = RelationshipsManager.GetRelationshipinfo(followers.First().Id);

                // Check if relationship info is correct
                // If the user is a follower the ingoing status must by followed_by
                Assert.IsNotNull(relInfo);
                Assert.AreEqual(IngoingRelationshipStatus.FollowedBy, relInfo.IngoingRelation);
            }
            catch (Exceptions.InstagramAPICallException)
            {
                Assert.Fail("Instagram Api error.");
            }
        }