public void ProfilePageSortsProfilesByProfileID() { BuzzTwitterProfiles profiles = new BuzzTwitterProfiles(); profiles.Add(CreateNewProfile("D")); profiles.Add(CreateNewProfile("B")); profiles.Add(CreateNewProfile("A")); profiles.Add(CreateNewProfile("C")); List<String> profileIdsToSort = new List<string>(); foreach (var p in profiles) { profileIdsToSort.Add(p.ProfileId); } profileIdsToSort.Sort(); Assert.IsFalse(CompareProfileIds(profiles, profileIdsToSort)); profiles.Sort(); Assert.IsTrue(CompareProfileIds(profiles, profileIdsToSort)); }
/// <summary> /// Filter twitter profiles based on the site /// </summary> /// <param name="profileList"></param> /// <param name="siteType"></param> /// <returns></returns> private BuzzTwitterProfiles GetSiteSpecificProfileList(BuzzTwitterProfiles profileList, string siteType) { BuzzTwitterProfiles filteredProfileList = new BuzzTwitterProfiles(); foreach (BuzzTwitterProfile profile in profileList) { if (false == string.IsNullOrEmpty(profile.SiteURL) && profile.SiteURL.Equals(siteType)) { filteredProfileList.Add(profile); } } return filteredProfileList; }
/// <summary> /// Filter twitter profiles based on the site list /// </summary> /// <param name="profileList"></param> /// <param name="siteIdList"></param> /// <returns></returns> private BuzzTwitterProfiles GenerateUserSpecificProfileList(BuzzTwitterProfiles profileList, List<int> siteIdList) { BuzzTwitterProfiles filteredProfileList = new BuzzTwitterProfiles(); foreach (int siteId in siteIdList) { foreach (BuzzTwitterProfile profile in profileList) { if(false == string.IsNullOrEmpty(profile.SiteURL) && profile.SiteURL.Equals(InputContext.TheSiteList.GetSite(siteId).SiteName)) { filteredProfileList.Add(profile); } } } return filteredProfileList; }
/// <summary> /// Filtered profile list based on the site type /// </summary> /// <param name="profileList">BuzzTwitterProfiles</param> /// <param name="siteType">BuzzSiteType</param> /// <returns></returns> private BuzzTwitterProfiles ProcessCommand(BuzzTwitterProfiles profileList, string siteType) { BuzzTwitterProfiles filteredProfileList = new BuzzTwitterProfiles(); //Get active only profiles if (_activeOnly.ToUpper().Equals("ON")) { foreach (BuzzTwitterProfile profile in profileList) { if (true == profile.Active.Value) { filteredProfileList.Add(profile); } } if (false == string.IsNullOrEmpty(siteType) && false == siteType.ToUpper().Equals("ALL")) { filteredProfileList = GetSiteSpecificProfileList(filteredProfileList, siteType); } } else { filteredProfileList = profileList; if (false == string.IsNullOrEmpty(_siteType) && false == siteType.ToUpper().Equals("ALL")) { filteredProfileList = GetSiteSpecificProfileList(filteredProfileList, siteType); } } return filteredProfileList; }