public void TwitterUtility_GetUserID() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); long id = XMLUtility.GetUserId(t.Xml); Assert.IsNotNull(id); }
public void TwitterUtility_GetNextRunInterval() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); DateTime nextRun = XMLUtility.GetNextRunInterval(t.Xml); Assert.IsNotNull(nextRun); }
public void PostTwitterMentionsToRest() { string result = string.Empty; //http://localhost/BIDataAPI/api/twitter/mentions requestPost = (HttpWebRequest)WebRequest.Create("http://localhost/BIdataApi/api/twitter/mentions"); requestPost.Method = "POST"; requestPost.ContentType = "application/json"; requestPost.UseDefaultCredentials = true; TweetManager tm = new TweetManager(); KeywordStatus ks = new KeywordStatus(); Twitter.Components.Twitter t = new Twitter.Components.Twitter(); ks.KeywordId = 7; ks.StatusList = tm.GetTweetsByQuery(20, Uri.EscapeDataString("\"go daddy\" OR godaddy OR go-daddy"), Twitter.Utility.GetOAuthToken(t.Xml)); string requestData = new JavaScriptSerializer().Serialize(ks); byte[] data = Encoding.UTF8.GetBytes(requestData); using (Stream dataStream = requestPost.GetRequestStream()) dataStream.Write(data, 0, data.Length); HttpWebResponse response = requestPost.GetResponse() as HttpWebResponse; result = new StreamReader(response.GetResponseStream()).ReadToEnd(); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); }
public void PostTwitterUsersToRest() { string result = string.Empty; requestPost = (HttpWebRequest)WebRequest.Create("http://localhost/BIdataApi/api/twitter/users"); requestPost.Method = "POST"; requestPost.ContentType = "application/json"; requestPost.UseDefaultCredentials = true; List <User> _twitterUserList = new List <User>(); TwitterUserDataSource dataSource = new TwitterUserDataSource(); UserManager um = new UserManager(); Twitter.Components.Twitter t = new Twitter.Components.Twitter(); foreach (Competitor comp in dataSource.GetCompetitorAccounts()) { _twitterUserList.Add(um.GetTwitterUserInfo(comp.TwitterID, Twitter.Utility.GetOAuthToken(t.Xml))); } string requestData = new JavaScriptSerializer().Serialize(_twitterUserList); byte[] data = Encoding.UTF8.GetBytes(requestData); using (Stream dataStream = requestPost.GetRequestStream()) dataStream.Write(data, 0, data.Length); HttpWebResponse response = requestPost.GetResponse() as HttpWebResponse; result = new StreamReader(response.GetResponseStream()).ReadToEnd(); Assert.AreEqual(response.StatusCode, HttpStatusCode.Created); }
public void TwitterUtility_IsComponentEnabled() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); bool enabledProperty = XMLUtility.IsComponentEnabled(t.Xml, "twittertrend"); Assert.IsFalse(enabledProperty); }
public void TwitterUtility_IsEnabled_BadXmlDefaultsFalse() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); bool enabledProperty = XMLUtility.IsEnabled(new XmlDocument()); Assert.IsFalse(enabledProperty); }
public void TwitterUtility_UseSinceID() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); bool enabledProperty = XMLUtility.UseSinceId(t.Xml, "twitter"); Assert.IsTrue(enabledProperty); }
public void TwitterUtility_IsEnabled() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); bool enabledProperty = XMLUtility.IsEnabled(t.Xml); Assert.IsTrue(enabledProperty); }
public void TwitterUtility_GetNext15MinRunTime() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); DateTime nextRun = XMLUtility.GetNext15MinRunTime(); Assert.IsNotNull(nextRun); Assert.IsTrue(nextRun.Minute % 15 == 0); }
public void TwitterUser_GetALlFollowers() { Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); OAuthTokens oat = Drone.Twitter.Utility.GetOAuthToken(t.Xml); UserManager um = new UserManager(); um.GetAllFollowers(oat); }
public void Twitter_GetData() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterDataSource()); t.GetData(t.Context); TwitterDataComponent tdc = t.DroneDataComponent as TwitterDataComponent; Assert.AreEqual(Drone.Twitter.Components.Twitter.ComponentTypeName, "TwitterComponent"); //Assert.IsNotNull(tdc.AllTwitterMentions); }
public void TwitterUtility_GetOAuthToken() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); Drone.API.Twitter.OAuth.OAuthTokens oat = Drone.Twitter.Utility.GetOAuthToken(t.Xml); Assert.IsNotNull(oat); Assert.IsTrue(oat.HasAccessToken); Assert.IsTrue(oat.HasConsumerToken); }
public void TwitterUtility_GetPageResultCounts_DefaultsCorrectly() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); int countPerPage; int pageCount; XMLUtility.GetPageResultCounts(new XmlDocument(), "twitter", out countPerPage, out pageCount, 100, 3); Assert.AreEqual(countPerPage, 100); Assert.AreEqual(pageCount, 3); }
public void TwitterUtility_GetPageResultCounts() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); int countPerPage; int pageCount; XMLUtility.GetPageResultCounts(t.Xml, "twitter", out countPerPage, out pageCount, 100, 3); Assert.AreEqual(countPerPage, 100); Assert.AreEqual(pageCount, 5); }
public void TwitterUser_GetFollowerCountsFromCSV() { Utility.ComponentBaseFolder = AppDomain.CurrentDomain.BaseDirectory; Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); OAuthTokens oat = Drone.Twitter.Utility.GetOAuthToken(t.Xml); UserManager um = new UserManager(); um.GetFollowerCounts(oat); }
public void Twitter_GetAvailablePlaces() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); TwitterDataComponent tdc = t.DroneDataComponent as TwitterDataComponent; tdc.TwitterAvailablePlaces = Drone.Twitter.Components.Twitter.GetAvailablePlaces(); foreach (var item in tdc.TwitterAvailablePlaces.OrderBy(x => x.country)) { Debug.WriteLine(string.Format("Country:{0}. Name:{1}. WoeID:{3} Type:{2}", item.country, item.name, item.placeType.name, item.woeid)); } Assert.IsNotNull(tdc.TwitterAvailablePlaces); }
public void Twitter_GetData_RateLimitTest() { Drone.Twitter.Components.Twitter t = new Twitter.Components.Twitter(new TwitterTestDataSource()); while (true) { try { t.GetData(t.Context); } catch (System.Exception) { } Thread.Sleep(60000); //one minute seems to be the fastest w/out hitting rate limits } }