예제 #1
0
		public async Task TestGetObjectOneObject()
		{
			var settProv= new ApiSettingsJsonFileProvider("Api/Settings/Vk.json");
			var apiRequest = new VkApiRequest();
			IApi api = new VkApi(apiRequest, settProv);

			var result = await api.Get<List<VkUser>>("users.get", "1");

			Assert.AreEqual(1, result.Count);
			Assert.AreEqual(1, result[0].Id);
			Assert.AreEqual("durov", result[0].ScreenName);
		}
예제 #2
0
		public async Task TestGetObjectVkList()
		{
			var settProv = new ApiSettingsJsonFileProvider("Api/Settings/Vk.json");
			var apiRequest = new VkApiRequest();
			IApi api = new VkApi(apiRequest, settProv);

			var result = await api.Get<VkList<VkPost>>("wall.get", "174111803");

			Assert.AreEqual(305, result.Count);
			Assert.AreEqual(305, result.Items.Count);
			Assert.AreEqual(536, result.Items[0].Id);
			Assert.AreEqual(185202286, result.Items[0].FromId);
		}
        public void TestGetSettingsForMethod()
        {
            var sp = new ApiSettingsJsonFileProvider("Api/Settings/Vk.json");

            var sett = sp.GetSettingsForMethod("groups.getById");

            Assert.AreEqual(300, sett.BatchSize);
            Assert.AreEqual(1, sett.ItemsMaxCount);
            Assert.AreEqual(1, sett.IdParams.Count);
            Assert.AreEqual("group_ids", sett.IdParams[0]);
            Assert.AreEqual(1, sett.Params.Count);
            Assert.AreEqual("members_count", sett.Params["fields"]);
            Assert.AreEqual(false, sett.IsNeedAccessToken);
        }
 public void TestLoadSettings()
 {
     var sp = new ApiSettingsJsonFileProvider("Api/Settings/Vk.json");
 }