private AppVk Parse(string json) { JObject userJObject = JObject.Parse(json); JToken appInfo = userJObject["response"]; AppVk app = new AppVk(); app.id = appInfo["items"][0]["id"].ToString(); app.genre = appInfo["items"][0]["genre"].ToString(); app.members_count = (int)appInfo["items"][0]["members_count"]; return(app); }
public void GetAppFromRepositoryTest() //тест app репозитория с помощью мок сервера { IAppRepository appRepository = new AppRepositoryVk(); appRepository.URL = "http://localhost:8080/method/"; AppVk app = appRepository.GetAppById("4063926"); Assert.AreEqual("4063926", app.id); Assert.AreEqual("Головоломка", app.genre); Assert.AreEqual(1853250, app.members_count); }
public string GetPopularAppVk(string id) { AppVk app = _appRepository.GetAppById(id); string popular; if (app.members_count < 100000) { popular = "Непопулярно"; } else if (app.members_count < 1000000) { popular = "Популярно"; } else { popular = "Очень популярно"; } return(popular); //return CalculateAge(enteredDate); }