Esempio n. 1
0
        private static Reviews ParseMovieReviews(JToken jToken)
        {            
            Reviews MovieReviews = new Reviews();

            var jsonArray = (JArray)jToken;

            if (jsonArray == null)
                return MovieReviews;

            foreach (var review in jsonArray)
            {
                Review newReview = new Review();

                newReview.Critic = (string)review["critic"];
                newReview.Date = (string)review["date"];
                newReview.Freshness = (string)review["freshness"];
                newReview.Publication = (string)review["publication"];
                newReview.Quote = (string)review["quote"];

                if ((string)review["original_score"] != null) { newReview.OrgScore = (string)review["original_score"]; }               
                
                var links = (JObject)review["links"];

                if (links != null)
                {
                    foreach (var link in links)
                    {
                        Link newLink = new Link { Type = (string)link.Key, Url = (string)link.Value };
                        if ((string)link.Key == "review")
                        {
                            newReview.AbsoluteLink = (string)link.Value;
                        }
                        newReview.Links.Add(newLink);
                    }
                }

                MovieReviews.MovieReviews.Add(newReview);
            }

            return MovieReviews;
        }
Esempio n. 2
0
 public void CheckReviewsObjectCreation()
 {
     wp7rt_client.Classes.Reviews review = new wp7rt_client.Classes.Reviews();
     Assert.IsNotNull(review);
 }