Permalink
Browse files

Merge pull request #52 from sconno05/develop

Adding additional search result properties to TwitterSearchResultCollect...
  • Loading branch information...
DigitallyBorn committed Jan 24, 2013
2 parents c8337fb + c8dc604 commit c49e722d3a90b0a3cb9249bf58dfb8968b440266
@@ -26,6 +26,13 @@ public static void Search()
Assert.That(request.Result == RequestResult.Success, request.ErrorMessage);
Assert.IsNotNull(request.ResponseObject);
Assert.Greater(request.ResponseObject.MaxId, 0);
Assert.Greater(request.ResponseObject.CompletedIn, 0);
Assert.IsNotNullOrEmpty(request.ResponseObject.MaxIdStr);
Assert.IsNotNullOrEmpty(request.ResponseObject.NextPage);
Assert.Greater(request.ResponseObject.Page, 0);
Assert.AreEqual("twitter", request.ResponseObject.Query);
Assert.IsNotNullOrEmpty(request.ResponseObject.RefreshUrl);
}
[Test]
@@ -48,6 +48,55 @@ namespace Twitterizer
#endif
public class TwitterSearchResultCollection : Core.TwitterCollection<TwitterSearchResult>, ITwitterObject
{
/// <summary>
/// Gets or sets the completed_in.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public double CompletedIn { get; internal set; }
/// <summary>
/// Gets or sets the max_id.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public long MaxId { get; internal set; }
/// <summary>
/// Gets or sets the max_id as a string.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public string MaxIdStr { get; internal set; }
/// <summary>
/// Gets or sets the next_page.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public string NextPage { get; internal set; }
/// <summary>
/// Gets or sets the page.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public int Page { get; internal set; }
/// <summary>
/// Gets or sets the query.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public string Query { get; internal set; }
/// <summary>
/// Gets or sets the refresh URL.
/// </summary>
/// <param name="value">The value.</param>
/// <returns></returns>
public string RefreshUrl { get; internal set; }
/// <summary>
/// Deserializes the specified value.
/// </summary>
@@ -58,7 +107,16 @@ internal static TwitterSearchResultCollection Deserialize(JObject value)
if (value == null || value["results"] == null)
return null;
return JsonConvert.DeserializeObject<TwitterSearchResultCollection>(value["results"].ToString());
TwitterSearchResultCollection result = JsonConvert.DeserializeObject<TwitterSearchResultCollection>(value["results"].ToString());
result.CompletedIn = value.SelectToken("completed_in").Value<double>();
result.MaxId = value.SelectToken("max_id").Value<long>();
result.MaxIdStr = value.SelectToken("max_id_str").Value<string>();
result.NextPage = value.SelectToken("next_page").Value<string>();
result.Page = value.SelectToken("page").Value<int>();
result.Query = value.SelectToken("query").Value<string>();
result.RefreshUrl = value.SelectToken("refresh_url").Value<string>();
return result;
}
}
}

0 comments on commit c49e722

Please sign in to comment.