Skip to content

Commit

Permalink
#197 Беда с методом поиска групп
Browse files Browse the repository at this point in the history
  • Loading branch information
inyutin-maxim committed Feb 16, 2016
1 parent a182de1 commit 8cd843d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
27 changes: 14 additions & 13 deletions VkNet.Tests/Categories/GroupsCategoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,9 @@ public void Search_DefaultCase_ListOfGroups()
const string url = "https://api.vk.com/method/groups.search?q=Music&sort=0&v=5.44&access_token=token";
const string json =
@"{
'response': [
78152,
{
'response': {
count: 78152,
items:[{
'id': 339767,
'name': 'A-ONE HIP-HOP MUSIC CHANNEL',
'screen_name': 'a1tv',
Expand All @@ -704,8 +704,8 @@ public void Search_DefaultCase_ListOfGroups()
'photo_50': 'http://cs410222.userapi.com/g27895931/e_d8c8a46f.jpg',
'photo_100': 'http://cs410222.userapi.com/g27895931/d_2869e827.jpg',
'photo_200': 'http://cs410222.userapi.com/g27895931/a_32935e91.jpg'
}
]
}]
}
}";

int totalCount;
Expand Down Expand Up @@ -744,9 +744,9 @@ public void Search_DefaulCaseAllParams_ListOfGroups()
const string url = "https://api.vk.com/method/groups.search?q=Music&sort=0&offset=20&count=3&v=5.44&access_token=token";
const string json =
@"{
'response': [
78152,
{
'response': {
count: 78152,
items: [{
'id': 26442631,
'name': 'Music Quotes. First Public.',
'screen_name': 'music_quotes_public',
Expand Down Expand Up @@ -781,8 +781,8 @@ public void Search_DefaulCaseAllParams_ListOfGroups()
'photo_50': 'http://cs9913.userapi.com/g23995866/e_319d8573.jpg',
'photo_100': 'http://cs9913.userapi.com/g23995866/d_166572a9.jpg',
'photo_200': 'http://cs9913.userapi.com/g23995866/a_fc553960.jpg'
}
]
}]
}
}";

int totalCount;
Expand Down Expand Up @@ -833,9 +833,10 @@ public void Search_GroupsNotFounded_EmptyList()

const string json =
@"{
'response': [
0
]
response: {
count: 0,
items: []
}
}";

var category = GetMockedGroupCategory(url, json);
Expand Down
6 changes: 3 additions & 3 deletions VkNet/Categories/GroupsCategory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,11 @@ public ReadOnlyCollection<Group> Search([NotNull] string query, out int totalCou
[ApiVersion("5.44")]
public ReadOnlyCollection<Group> Search(out int totalCount, GroupsSearchParams @params)
{
VkResponseArray response = _vk.Call("groups.search", @params);
var response = _vk.Call("groups.search", @params);

totalCount = response[0];
totalCount = response["count"];

return response.Skip(1).ToReadOnlyCollectionOf<Group>(r => r);
return response["items"].ToReadOnlyCollectionOf<Group>(r => r);
}

/// <summary>
Expand Down

0 comments on commit 8cd843d

Please sign in to comment.