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); }
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); }
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); }
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); }
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); }
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); }
public void CreateRequestProcessorNullExpressionTest1() { var ctx = new TwitterContext(auth); var ex = Assert.Throws<ArgumentNullException>(() => ctx.CreateRequestProcessor<Status>((Expression)null)); Assert.Equal("Expression", ex.ParamName); }
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); }
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); }
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); }