예제 #1
0
        public void DeserializeTo_ValidJson_ResultIsNotNull()
        {
            Review testReview = new Review()
            {
                Iso_639_1   = "iso1",
                Author      = "Testauthor",
                Content     = "test content",
                Id          = "test id",
                Media_id    = 1,
                Media_title = "test title",
                Media_type  = "test type",
                Url         = "testurl"
            };

            string jsonData = JsonConvert.SerializeObject(testReview);

            var testResult = _serializer.DeserializeTo <Review>(jsonData);

            Assert.IsNotNull(testResult);
        }
예제 #2
0
        public async Task <TmdbEasyModel> GetResponseAsync <TmdbEasyModel>(string query)
        {
            if (string.IsNullOrEmpty(query) || string.IsNullOrWhiteSpace(query))
            {
                throw new ArgumentException($"{nameof(TmdbEasyClient)} query param null or empty");
            }

            string jsonResult = await _httpClient.GetStringAsync(query);

            return(_jsonDeserializer.DeserializeTo <TmdbEasyModel>(jsonResult));
        }