예제 #1
0
        public void TestSplitShowsByComedyGenre()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            var result = JsonSplitter.SplitShowsByGenre(trendingShowsJson, "Comedy");

            stopwatch.Stop();
            Console.WriteLine(string.Format("Millisecs = {0}, Ticks = {1}", stopwatch.ElapsedMilliseconds, stopwatch.ElapsedTicks));

            Assert.AreEqual(comedyShowsJson, result.Item1);
            Assert.AreEqual(otherShowsJson, result.Item2);
        }
예제 #2
0
        public Response(string json)
        {
            // On return data contains an unknown object that will be treated as a string at first.
            // Workaround: MS json serializer does not have the option to convert object to string
            var dict = new JsonSplitter().CreateDictionary(json);

            if (dict.ContainsKey("status"))
            {
                Status = dict["status"];
            }
            if (dict.ContainsKey("data"))
            {
                Data = dict["data"];
            }
        }