private void BindDemo()
        {
            ITwitterAuthorizer autentikasi = GetInformasiKredensial();

            var TwitterDataContext = new TwitterContext(autentikasi);

            Friendship friend = TwitterDataContext.UpdateFriendshipSettings("dnnspy", /*enable disable retweets:*/ true, /* enalbe disable device:*/ true);
        }
        public void UpdateFriendshipSettings_Throws_Without_ScreenName_Or_UserID()
        {
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            execMock.Setup(exec => exec.PostToTwitter(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Func<string, Friendship>>())).Returns(RelationshipResponse);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "https://api.twitter.com/1/", "");

            var ex = Assert.Throws<ArgumentNullException>(() => ctx.UpdateFriendshipSettings(null, true, true));

            Assert.Equal("screenNameOrUserID", ex.ParamName);
        }
        public void UpdateFriendshipSettings_Calls_Execute()
        {
            var authMock = new Mock<ITwitterAuthorizer>();
            var execMock = new Mock<ITwitterExecute>();
            execMock.SetupGet(exec => exec.AuthorizedClient).Returns(authMock.Object);
            execMock.Setup(exec => exec.PostToTwitter(It.IsAny<string>(), It.IsAny<Dictionary<string, string>>(), It.IsAny<Func<string, Friendship>>())).Returns(RelationshipResponse);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "https://api.twitter.com/1/", "");

            ctx.UpdateFriendshipSettings("Linq2Tweeter", true, true);

            execMock.Verify(exec => exec.PostToTwitter(
                "https://api.twitter.com/1/friendships/update.json",
                It.IsAny<Dictionary<string, string>>(),
                It.IsAny<Func<string, Friendship>>()),
                Times.Once());
        }
예제 #4
0
        private static void UpdateSettingsDemo(TwitterContext twitterCtx)
        {
            Friendship friend = twitterCtx.UpdateFriendshipSettings("Linq2Tweeter", true, true);

            Console.WriteLine("Settings for {0} are: Can Retweet is {1} and Can Send Device Notifications is {2}",
                friend.SourceRelationship.ScreenName,
                friend.SourceRelationship.RetweetsWanted,
                friend.SourceRelationship.NotificationsEnabled);
        }