public void TestVkUserAlSearchParseResult() { string logfilePath = @"..\..\testdata\TestVkUserParseAlSearchResult.txt"; string response = string.Empty; using (StreamReader streamReader = new StreamReader(logfilePath, Encoding.UTF8)) { response = streamReader.ReadToEnd(); } string cityId = "1"; List <VkUser> listVkUsers = (VkUserEx.AlSearchParsePeopleRow(response)).SetCityIdToAllUsers(cityId); Assert.IsTrue(listVkUsers.Count == 3); Assert.AreEqual("1421583", listVkUsers[0].Id); Assert.AreEqual("tooniegirl", listVkUsers[0].Href); Assert.AreEqual("Мария Смолина", listVkUsers[0].Name); Assert.AreEqual(cityId, listVkUsers[0].CityId); Assert.AreEqual("5202819", listVkUsers[1].Id); Assert.AreEqual("amirsanova", listVkUsers[1].Href); Assert.AreEqual("Анастасия Мирсанова", listVkUsers[1].Name); Assert.AreEqual(cityId, listVkUsers[1].CityId); Assert.AreEqual("154914280", listVkUsers[2].Id); Assert.AreEqual("bizneschans", listVkUsers[2].Href); Assert.AreEqual("Максим Кузнецов", listVkUsers[2].Name); Assert.AreEqual(cityId, listVkUsers[2].CityId); }
public void TestGetHasIdFrom() { string logfilePath1 = @"..\..\testdata\TestVkUserParseAlSearchResult.txt"; string response1 = string.Empty; string logfilePath2 = @"..\..\testdata\TestVkUserParseFriendsList.txt"; string response2 = string.Empty; using (StreamReader streamReader = new StreamReader(logfilePath1, Encoding.UTF8)) { response1 = streamReader.ReadToEnd(); } using (StreamReader streamReader = new StreamReader(logfilePath2, Encoding.UTF8)) { response2 = streamReader.ReadToEnd(); } string cityId = "1"; List <VkUser> usersInTheCity = (VkUserEx.AlSearchParsePeopleRow(response1)).SetCityIdToAllUsers(cityId); List <VkUser> friends = VkUserEx.ParseFriendsList(response2); friends[1].Id = "1421583"; friends[2].Id = "5202819"; usersInTheCity = usersInTheCity.GetHasIdFrom(friends); Assert.IsTrue(usersInTheCity.Count == 3); Assert.AreEqual(friends[1].HashId, usersInTheCity[0].HashId); Assert.AreEqual(friends[2].HashId, usersInTheCity[1].HashId); Assert.AreEqual(null, usersInTheCity[2].HashId); }