예제 #1
0
        public void CreateRequestProcessor_Returns_ProperRequestProcessor()
        {
            var ctx = new TwitterContext(auth);

            var showQuery =
                from tweet in ctx.Status
                where tweet.Type == StatusType.Show
                select tweet;

            var statusProc = ctx.CreateRequestProcessor<Status>(showQuery.Expression);
            Assert.IsType(typeof(StatusRequestProcessor<Status>), statusProc);
        }
예제 #2
0
        public void CreateAccountRequestProcessorTest()
        {
            var ctx = new TwitterContext(auth);

            var queryResult = from tweet in ctx.Account select tweet;

            IRequestProcessor<Account> actual = ctx.CreateRequestProcessor<Account>(queryResult.Expression);
            Assert.IsType(typeof(AccountRequestProcessor<Account>), actual);
        }
예제 #3
0
        public void CreateStatusRequestProcessorTest()
        {
            var ctx = new TwitterContext(auth);

            var queryResult = from tweet in ctx.Status select tweet;

            IRequestProcessor<Status> actual = ctx.CreateRequestProcessor<Status>(queryResult.Expression);
            Assert.IsType(typeof(StatusRequestProcessor<Status>), actual);
        }
예제 #4
0
        public void CreateRequestProcessor_Returns_StreamingRequestProcessor()
        {
            var ctx = new TwitterContext(auth) {StreamingUrl = "https://stream.twitter.com/1/"};
            var execMock = new Mock<ITwitterExecute>();
            ctx.TwitterExecutor = execMock.Object;
            var streamingQuery =
                from tweet in ctx.Streaming
                where tweet.Type == StreamingType.Sample
                select tweet;

            var reqProc = ctx.CreateRequestProcessor<Streaming>(streamingQuery.Expression);

            Assert.IsType(typeof(StreamingRequestProcessor<Streaming>), reqProc);
            Assert.Equal("https://stream.twitter.com/1/", reqProc.BaseUrl);
            var streamingRequestProcessor = reqProc as StreamingRequestProcessor<Streaming>;
            if (streamingRequestProcessor != null)
                Assert.Equal(execMock.Object, streamingRequestProcessor.TwitterExecutor);
        }
예제 #5
0
        public void CreateRequestProcessor_Returns_UserStreamRequestProcessor()
        {
            var ctx = new TwitterContext(auth) {StreamingUrl = "https://userstream.twitter.com/1.1/"};
            var execMock = new Mock<ITwitterExecute>();
            ctx.TwitterExecutor = execMock.Object;
            var streamingQuery =
                from tweet in ctx.UserStream
                where tweet.Type == UserStreamType.User
                select tweet;

            var reqProc = ctx.CreateRequestProcessor<UserStream>(streamingQuery.Expression);

            Assert.IsType(typeof(UserStreamRequestProcessor<UserStream>), reqProc);
            var userStreamRequestProcessor = reqProc as UserStreamRequestProcessor<UserStream>;
            if (userStreamRequestProcessor != null)
                Assert.Equal("https://userstream.twitter.com/1.1/", userStreamRequestProcessor.UserStreamUrl);
            var streamRequestProcessor = reqProc as UserStreamRequestProcessor<UserStream>;
            if (streamRequestProcessor != null)
                Assert.Equal(execMock.Object, streamRequestProcessor.TwitterExecutor);
        }
예제 #6
0
        public void CreateRequestProcessor_Returns_RelatedResultsRequestProcessor()
        {
            var ctx = new TwitterContext(auth) {BaseUrl = "https://api.twitter.com/1.1/"};
            var execMock = new Mock<ITwitterExecute>();
            ctx.TwitterExecutor = execMock.Object;
            var resultsQuery =
                from tweet in ctx.RelatedResults
                where tweet.Type == RelatedResultsType.Show
                select tweet;

            var reqProc = ctx.CreateRequestProcessor<RelatedResults>(resultsQuery.Expression);

            Assert.IsType(typeof(RelatedResultsRequestProcessor<RelatedResults>), reqProc);
            Assert.Equal("https://api.twitter.com/1.1/", reqProc.BaseUrl);
        }
예제 #7
0
        public void CreateRequestProcessorNullExpressionTest1()
        {
            var ctx = new TwitterContext(auth);

            var ex = Assert.Throws<ArgumentNullException>(() => ctx.CreateRequestProcessor<Status>((Expression)null));

            Assert.Equal("Expression", ex.ParamName);
        }
예제 #8
0
        public void CreateSearchRequestProcessor_Returns_RawRequestProcessor()
        {
            var ctx = new TwitterContext(auth);

            var queryResult = from raw in ctx.RawQuery select raw;

            IRequestProcessor<Raw> actual = ctx.CreateRequestProcessor<Raw>(queryResult.Expression);
            Assert.IsType(typeof(RawRequestProcessor<Raw>), actual);
        }
예제 #9
0
        public void CreateFriendshipRequestProcessorTest()
        {
            var ctx = new TwitterContext(auth);

            var queryResult = from tweet in ctx.Friendship select tweet;

            IRequestProcessor<Friendship> actual = ctx.CreateRequestProcessor<Friendship>(queryResult.Expression);
            Assert.IsType(typeof(FriendshipRequestProcessor<Friendship>), actual);
        }
예제 #10
0
        public void CreateDirectMessageRequestProcessorTest()
        {
            var ctx = new TwitterContext(auth);

            var queryResult = from tweet in ctx.DirectMessage select tweet;

            IRequestProcessor<DirectMessage> actual = ctx.CreateRequestProcessor<DirectMessage>(queryResult.Expression);
            Assert.IsType(typeof(DirectMessageRequestProcessor<DirectMessage>), actual);
        }