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

            var TwitterDataContext = new TwitterContext(autentikasi);

            var friendship = TwitterDataContext.CreateFriendship("dnnspy", string.Empty, string.Empty, true);
        }
예제 #2
0
        private static void CreateFriendshipNoDeviceUpdatesDemo(TwitterContext twitterCtx)
        {
            var user = twitterCtx.CreateFriendship(string.Empty, "JoeMayo", false);

            Console.WriteLine(
                "User Name: {0}, Status: {1}",
                user.Name,
                user.Status.Text);
        }
예제 #3
0
        private static void CreateFriendshipFollowDemo(TwitterContext twitterCtx)
        {
            var user = twitterCtx.CreateFriendship(null, "JoeMayo", true);

            Console.WriteLine(
                "User Name: {0}, Status: {1}",
                user.Name,
                user.Status.Text);
        }
예제 #4
0
        private static void CreateFriendshipFollowDemo(TwitterContext twitterCtx)
        {
            var user = twitterCtx.CreateFriendship("LinqToTweeter", string.Empty, string.Empty, true);

            Console.WriteLine(
                "User Name: {0}, Status: {1}",
                user.Name,
                user.Status.Text);
        }
예제 #5
0
        private static void CreateFriendshipAsyncDemo(TwitterContext twitterCtx)
        {
            twitterCtx.CreateFriendship(string.Empty, "JoeMayo", false,
                response =>
                {
                    User usr = response.State;

                    Console.WriteLine(
                        "User Name: {0}, Status: {1}",
                        usr.Name,
                        usr.Status.Text);
                });
        }
        public void CreateFriendshipTest()
        {
            const string UserID = "2";
            const string ScreenName = "JoeMayo";
            const bool Follow = false;
            string expectedName = "Joe Mayo";
            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, User>>()))
                .Returns(SingleUserResponse);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");

            User actual = ctx.CreateFriendship(UserID, ScreenName, Follow);

            Assert.Equal(expectedName, actual.Name);
        }
        public void CreateFriendshipNoInputTest()
        {
            string userID = string.Empty;
            const bool Follow = false;
            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, User>>()))
                .Returns(SingleUserResponse);
            var ctx = new TwitterContext(authMock.Object, execMock.Object, "", "");

            var ex = Assert.Throws<ArgumentException>(() => ctx.CreateFriendship(userID, null, Follow));

            Assert.Equal("UserIDOrScreenName", ex.ParamName);
        }